Specifications of internetscape interface:
**************************************** **************************************** ********
*
Based on the general view card specification, refer to the flying fox Transaction Division Interface Specification 3.0 for expansion, real-time market prices increase the price limit;
*
Internal and external disks; Fixed settlement price and current settlement price for futures; added support for adding 5-minute lines, 1-minute lines, and split data
**************************************** **************************************** ********/
/*************************************** **************************************** *********
*
After the driver is installed, you should register the following information in the system registry, and the analysis software starts the dynamic library through the registration information.
*
HKEY_LOCAL_MACHINE/SOFTWARE/StockDrv
*
Driver = "Driver DLL full path"
**************************************** **************************************** ********/
# Ifndef _ STOCKDRV_H __
# Define _ STOCKDRV_H __
# If _ MSC_VER> 1000
# Pragma once
# Endif
Typedef long time_t;
//////////////////////////////////////// //////////////////////////////////////// /////////
// Define the work type
# Define RCV_WORK_SENDMSG
4
// Compatible with the standard text message processing mode
// Retain other work methods
//
Message Type
# Define RCV_REPORT
0x3f001234
# Define RCV_FILEDATA
0x3f001235
// ==================================================== Data Structure ========================================================== ==========
// Securities Market
# Define
SH_MARKET_EX
'Hs'
// Shanghai
# Define
SZ_MARKET_EX
'Zs'
// Shenzhen
# Define
HK_MARKET_EX
'Kh'
// Hong Kong
# Define
SQ_MARKET_EX
'Qs'
// Previous period
# Define
DL_MARKET_EX
'Ld'
// Dalian
# Define
ZZ_MARKET_EX
'Zz'
// Zhengzhou
# Define
JZ_MARKET_EX
'Jz'
// Gold Institute
# Define
WP_MARKET_EX
'PW'
// External Disk
# Define
ID_MARKET_EX
'Di'
// International Index
# Define
WH_MARKET_EX
'Wh'
// Foreign Currency
// File data type
# Define
FILE_HISTORY_MIN1_EX
0xA003
// Fill in the K-line data for 1 minute (extended)
# Define
FILE_HISTORY_EX
Zero x 0002
// Complement the daily data
# Define
FILE_HISTORY_MIN5_EX
Zero x 0051
// Fill in the K-line data (extended) for 5 minutes)
# Define
FILE_MINUTE_EX
4
// Time-sharing line data
# Define
FILE_MINUTE_EX
5
// Replenishment line data (extended)
# Define
FILE_POWER_EX
6
// Supplement the permission data
# Define
FILE_FINANCE_EX
7
// Supplement financial data (extended)
# Define
FILE_BASE_EX
Zero x 1000
// Basic information file, m_szFileName only contains the file name
# Define
FILE_NEWS_EX
Zero x 1002
// News class, which is determined by the m_szFileName sub-directory name
# Define
FILE_HTML_EX
Zero x 1004
// HTML file, m_szFileName is URL
# Define
FILE_SOFTWARE_EX
Zero x 2000
// Upgrade the software
# Define
FILE_SHAZQDATA_EX
Zero x 3000
// Shanghai bond net price transaction
# Define
FILE_TYPE_RES
-1
// Reserved
// Message subtype
# Define
News_Sha_Ex
2
// Shanghai Stock Exchange message
# Define
News_Szn_Ex
4
// Deep certificate message
# Define
News_Sqn_Ex
5
// Futures message
# Define
News_Fin_Ex
6
// Financial report
# Define
News_Unknown_Ex
-1
// Unknown provider
// Definition For nInfo of Function GetStockDrvInfo (int nInfo, void * pBuf );
# Define
RI_IDSTRING
1
// Vendor name. The return value is the vendor name.
# Define
RI_IDCODE
2
// Card number
# Define
RI_VERSION
3
// Driver version
# Define
RI_SUPPORTEXTHQ
6
// Whether JSJ format is supported
# Define
STKLABEL_LEN
10
// Length of the breed code
# Define
STKNAME_LEN
32
// Length of the breed name
//////////////////////////////////////// //////////////////////////////////////// //
// Market data structure, supporting futures
Typedef struct tagRCV_REPORT_STRUCTEx
{
WORD
M_cbSize;
// Structure size
Time_t
M_time;
// Transaction time (calendar time)
WORD
M_wMarket;
// Stock Market Type
Char
M_szLabel [STKLABEL_LEN];
// Stock code, ending with '\ 0'
Char
M_szName [STKNAME_LEN];
// Stock name, ending with '\ 0'
Float
M_fLastClose;
// Accept
Float
M_fOpen;
// Available today
Float
M_fHigh;
// Maximum
Float
M_fLow;
// Minimum
Float
M_fNewPrice;
// Latest
Float
M_fVolume;
// Transaction volume
Float
M_fAmount;
// Transaction amount
Float
M_fBuyPrice [3];
// Purchase price 1, 2, 3
Float
M_fBuyVolume [3];
// Purchase volume 1, 2, 3
Float
M_fSellPrice [3];
// Apply for 1, 2, 3
Float
M_fSellVolume [3];
// Application quantity: 1, 2, 3
Float
M_fBuyPrice4;
// Purchase price 4
Float
M_fBuyVolume4;
// Purchase volume 4
Float
M_fSellPrice4;
// Sell price 4
Float
M_fSellVolume4;
// Purchase volume 4
Float
M_fBuyPrice5;
// Purchase price 5
Float
M_fBuyVolume5;
// 6 purchases
Float
M_fSellPrice5;
// Apply for 5
Float
M_fSellVolume5;
// Application quantity 5
Float
M_fLastAverage;
// Futures settlement price (expansion)
Float
M_fAverage;
// Current settlement price for Futures (expansion)
} RCV_REPORT_STRUCTEx, * PRCV_REPORT_STRUCTEx;
//////////////////////////////////////// //////////////////////////////////////// //
// Supplement the data Header
// Data header m_dwHeadTag = EKE_HEAD_TAG
# Define EKE_HEAD_TAG
0 xffffffff
Typedef struct
TagRCV_EKE_HEADEx
{
DWORD
M_dwHeadTag;
// = EKE_HEAD_TAG
WORD
M_wMarket;
// Market type
Char
M_szLabel [STKLABEL_LEN];
// Stock code
} RCV_EKE_HEADEx, * PRCV_EKE_HEADEx;
// Supplement the daily, 5-minute, and 1-minute data
Typedef union tagRCV_HISTORY_STRUCTEx
{
Struct
{
Time_t
M_time;
// UCT
Float
M_fOpen;
// Opening
Float
M_fHigh;
// Maximum
Float
M_fLow;
// Minimum
Float
M_fClose;
// Close
Float
M_fVolume;
// Quantity
Float
M_fAmount;
// Amount
WORD
M_wAdvance;
// Increase, effective only for the dashboard
WORD
M_wDecline;
// Number of drops, effective only for the dashboard
};
RCV_EKE_HEADEx
M_head;
} RCV_HISTORY_STRUCTEx, * PRCV_HISTORY_STRUCTEx;
// Supplement the time-sharing data
Typedef union tagRCV_MINUTE_STRUCTEx
{
Struct {
Time_t
M_time;
// UCT
Float
M_fPrice;
Float
M_fVolume;
Float
M_fAmount;
};
RCV_EKE_HEADEx
M_head;
} RCV_MINUTE_STRUCTEx, * PRCV_MINUTE_STRUCTEx;
// Supplement the permission data
Typedef union tagRCV_POWER_STRUCTEx
{
Struct
{
Time_t
M_time;
// UCT
Float
M_fGive;
// Send per share
Float
M_fPei;
// Per share
Float
M_fPeiPrice;
// Stock price, only for m_fPei! = 0.0f valid
Float
M_fProfit;
// Dividend per share
};
RCV_EKE_HEADEx
M_head;
} RCV_POWER_STRUCTEx, * PRCV_POWER_STRUCTEx;
//////////////////////////////////////// //////////////////////////////////////// //
// File type data Header
// Note 1:
//
M_wDataType = FILE_BASE_EX
//
M_dwAttrib = stock market, m_szFileName only contains the file name
//
M_FileTime = date when the basic data file was created
// M_wDataType = FILE_NEWS_EX
//
M_dwAttrib = message source. m_szFileName contains the file name of the directory. The directory name is the message source.
//
M_dwSerialNo = serial number
//
For example: "Shanghai Stock Exchange message \ 0501Z012. TXT", "sinaland \ XLD0001.TXT"
// M_wDataType = FILE_HTML_EX
//
M_dwAttrib is retained, m_szFileName is URL
//
M_wDataType
= FILE_SOFTWARE_EX
//
M_dwAttrib Analysis Software type for preliminary judgment
//
M_szFileName Analysis Software ID feature string + '\' + file name
//
For example, "TongShi \ TS \ RECEIVE. EXE ",
//
The ID feature string is "TongShi", and "TS \ RECEIVE. EXE" is the file name.
//
Feature strings, file names, and their meanings are defined by the analysis software vendor.
// NOTE 2:
// Data files are repeatedly broadcasted. Each file has a unique serial number to avoid repeated reception.
Typedef struct tagRCV_FILE_HEADEx
{
DWORD
M_dwAttrib;
// File subtype
DWORD
M_dwLen;
// File length
DWORD
M_dwSerialNo;
// File serial number
Char
M_szFileName [MAX_PATH];
// File name or URL
} RCV_FILE_HEADEx, * PRCV_FILE_HEADEx;
//////////////////////////////////////// //////////////////////////////////////// //
// Data notification message
// Notification message in query mode
//
WParam = MsgPara_StkData
Stock Data
//
WParam = MsgPara_File
File data files
// Direct data reference notification message
//
WParam = RCV_WPARAM;
// LParam points to the RCV_DATA structure;
//
The returned value is 1, and 0 is not processed or cannot be processed. The returned value is ignored.
// Note 1:
//
The number of records indicates the number of quotation data and supplementary data packets (including headers). For file type data, = 1
// NOTE 2:
//
If m_bDISK = FALSE, m_pData is the data buffer pointer.
//
* ******* Data sharing, and data cannot be modified **********
//
M_bDISK = TRUE, m_pData is the name of the file's storage file, generally only
//
Upgrade software and other large file storage methods
Typedef struct tagRCV_DATA
{
Int
M_wDataType;
// File type
Int
M_nPacketNum;
// Number of records, see note 1
RCV_FILE_HEADEx
M_File;
// File Interface
BOOL
M_bDISK;
// Whether the file is saved to the disk
Union
{
RCV_REPORT_STRUCTEx * m_pReport;
RCV_HISTORY_STRUCTEx * m_pDay;
RCV_MINUTE_STRUCTEx * m_pMinute;
RCV_POWER_STRUCTEx * m_pPower;
Void
* M_pData;
// See Note 2
};
} RCV_DATA, * PRCV_DATA;
/* Message processing program DEMO (VC ++)
LONG OnStkDataOK (UINT wParam, LONG lParam)
{
UINT wFileType = wParam;
RCV_DATA *
PHeader;
PHeader = (RCV_DATA *) lParam;
Int nBufSize = pHeader-> m_pReport [0]. m_cbSize; // data structure size
PBYTE pBaseBuf = (PBYTE) & pHeader-> m_pReport [0]; // VC ++.
// PBYTE pBaseBuf = (PBYTE) & pHeader-> m_pReport [0]-2; // reduce BCB by 2.
Switch (wFileType)
{
Case RCV_REPORT:
// Real-time quotations
For (int I = 0; I <pHeader-> m_nPacketNum; I ++)
{
RCV_REPORT_STRUCTEx & Buf = * (PRCV_REPORT_STRUCTEx) (pBaseBuf + nBufSize * I );
If (Buf. m_fLastClose * 1000 <= 0) continue; // The closing price is zero. There may be no real-time data for this type.
If (Buf. m_szName = "Shanghai index") {;}; // retrieve data from the interface shared memory for processing
// Buf. m_time/60;
// Buf. m_wMarket;
// Buf. m_szLabel;
// Buf. m_szName;
// Buf. m_fLastClose;
}
Break;
Case RCV_FILEDATA:
// Kill data
Switch (pHeader-> m_wDataType)
{
Case FILE_HISTORY_EX:
// Complement the daily data
For (I = 0; I <pHeader-> m_nPacketNum; I ++)
{
PHeader-> m_pDay...
// Data Processing
// Compile a call example for the daily, 5-minute, and 1-minute line.
}
Break;
Case FILE_HISTORY_MIN5_EX:
// Fill in the K-line data (extended) for 5 minutes)
Break;
Case FILE_HISTORY_MIN1_EX:
// Fill in the K-line data for 1 minute (extended)
Break;
Case FILE_MINUTE_EX:
// Time-sharing line data
Break;
Case FILE_POWER_EX:
// Supplement the permission data
Break;
Case FILE_BASE_EX:
// Qian Long is compatible with the basic data file. m_szFileName only contains the file name.
Break;
Case FILE_NEWS_EX:
// News class, whose type is determined by the m_szFileName sub-directory name
Break;
Case FILE_HTML_EX:
// HTML file, m_szFileName is URL
Break;
Case FILE_SOFTWARE_EX:
// Upgrade the software
Break;
}
Break;
Default:
Return 0;
// Unknown data
}
Return 1;
}
*/
/* Message processing program DEMO (bcb c ++ Build)
Void _ fastcall OnStkDataOK (TMessage & Msg)
{
UINT wFileType = Msg. WParam;
RCV_DATA * pHeader;
PHeader = (RCV_DATA *) Msg. LParam;
Int nBufSize = pHeader-> m_pReport [0]. m_cbSize; // data structure size
PBYTE pBaseBuf = (PBYTE) & pHeader-> m_pReport [0]-2; // BCB needs to be reduced by 2.
Switch (wFileType)
{
Case RCV_REPORT:
// Real-time quotations
For (int I = 0; I <pHeader-> m_nPacketNum; I ++)
{
RCV_REPORT_STRUCTEx & Buf = * (PRCV_REPORT_STRUCTEx) (pBaseBuf + nBufSize * I );
If (Buf. m_fLastClose * 1000 <= 0) continue; // The closing price is zero. There may be no real-time data for this type.
If (AnsiString (Buf. m_szName) = "Shanghai index") ShowMessage (AnsiString (Buf. m_szLabel); // retrieve data from the interface shared memory for processing
Data processing ......
}
}
}
*/
//////////////////////////////////////// //////////////////////////////////////// //
// APIs
# Ifdef _ cplusplus
Extern "C "{
# Endif
//////////////////////////////////////// //////////////////////////////////////// //
// Register a function
// Stock Initialization
// Entry parameters:
//
HWnd
Window handle for Message Processing
//
Msg
Custom message
//
NWorkMode
Interface working method, which must be equal to RCV_WORK_SENDMSG
// Return parameters:
//
1
Successful
//
-1
Failed
Int WINAPI
Stock_Init (HWND hWnd, UINT Msg, int nWorkMode );
// Exit and stop sending messages
// Entry parameters:
//
HWnd
The window handle for message processing, which is the same as the call entry parameter of Stock_Init.
//
Response parameters:
//
1
Successful
//
-1
Failed
Int WINAPI
Stock_Quit (HWND hWnd );
//////////////////////////////////////// //////////////////////////////////////// //
// Quote Interface
// Obtain the total number of received shares
Int WINAPI
GetTotalNumber ();
// Obtain stock data by serial number (extended)
// Entry parameters:
//
NNo
Serial number
//
PBuf
Buffer zone for storing stock data
// Return parameters:
//
NoStockData
No stock data
// Note:
//
This function provides the primary data of stock data. When the analysis software is just running, you can quickly establish a data framework.
Int WINAPI
GetStockByNoEx (int nNo, RCV_REPORT_STRUCTEx * pBuf );
// Obtain stock data by stock number (extended)
// Entry parameters:
//
PszStockCode stock code
//
NMarket
Securities Market
//
PBuf
Buffer zone for storing stock data
// Return parameters:
//
NoStockData
No stock data
// Note:
//
This function provides the primary data of stock data. When the analysis software is just running, you can quickly establish a data framework.
Int WINAPI
GetStockByCodeEx (char * pszStockCode, int nMarket, RCV_REPORT_STRUCTEx * pBuf );
// Activate and set the receiver
// Entry parameters:
//
BShowWindow
TRUE
Display window, Set
//
FALSE
Implicit window
// Return parameters:
//
1
Successful
//
-1
Failed
Int
WINAPI SetupReceiver (BOOL bShowWindow );
//
Obtain stock-driven information
//
Entry parameters:
//
NInfo
Index
//
PBuf
Buffer Zone
//
Exit parameters:
//
NInfo = RI_IDSTRING,
Returns the feature String Length. pBuf is the feature string.
//
For example:
"TongShi_StockDrv_1.00"
//
NInfo = RI_IDCODE,
The ID of the Information Card. pBuf is a string ID.
//
For example:
Zero x 78001234
"78001234"
//
NInfo = RI_VERSION,
Returns the information card version. pBuf is a string version.
//
Example: 1.00
"1.00"
//
NInfo = RI_ERRRATE,
Receiving channel error code,
//
NInfo = RI_STKNUM,
Total number of listed stocks
Dword winapi GetStockDrvInfo (int nInfo, void * pBuf );
# Ifdef _ cplusplus
}
# Endif
# Endif/_ STOCKDRV_H __