Communication Interface of Internet traffic

Source: Internet
Author: User

I can't understand the cross-View Interface of the Internet. I haven't found any suitable content on the Internet. I mainly use C # To Call stock. dll and then display the information. Anyone who has written similar source code or specific steps is appreciated. Specifications for 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
**************************************** **************************************** ********/

/*************************************** **************************************** *********
*
DriverProgramAfter installation, you should register the following information in the system registry, and the analysis software starts the dynamic library through this 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
// TypeCodeLength
# 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, 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 );

//////////////////////////////////////// //////////////////////////////////////// //
// 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 __

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.