How to query the order details in the Tongdaxin one-by-one interface?

Tongdaxin's transaction-by-trade interface is generally developed according to the model of the real trading system, and then the stock quantitative trading interface can also quickly obtain user data, that is, the data information of your account order, which can be real-time during market transactions. Connect with a securities company to realize entrusted buying and selling operations. So, how to query the order details through such a convenient Tongdaxin one-by-one interface?

For example, you can understand the development features from the descriptions in Tongdaxin’s interface development documents one by one:

sign

int Logon(const char* Ip, short Port, const char* Version, short Yybid, const char* Account, const char* TradeAccount,

const char* JyPassword, const char* TxPassword,

char* ErrorInfo);

Function

Login to trading account

parameter

Ip

Brokerage trading server IP, pay attention to distinguish between ordinary and financial

Port

Brokerage trading server port, pay attention to distinguish between ordinary and Liangrong

Version

The version number of the client, usually an empty string

Yybid

Business department code, generally 0

Account

Login account, usually the fund account or customer number of the brokerage

Note: Liangrong account needs to add an additional .C ending, such as 123456 becomes 123456.C

TradeAccount

The trading account is generally the same as the login account, but there is no need to add an additional .C ending

You can log in to the brokerage software to view the list of shareholders, and the capital account in the list of shareholders is the trading account

JyPassword

transaction password

TxPassword

Communication password, usually an empty string or the same as the transaction password

ErrorInfo

Error message, need to allocate 256 bytes of space

return value

Successful call: Client Id

Call failed: return <= 0

sign

void Logoff(int ClientId);

Function

Log out of trading account

parameter

ClientId

Client ID

return value

none

sign

void QueryData(int

ClientId, int Category,

char* Result, char*

ErrorInfo);

Function

Query various transaction data

parameter

ClientId

Client ID

Category

Query Information Category

0: Funds, 1: Shares, 2: Order of the day, 3: Transaction of the day, 4: Cancellation order,

5: Shareholder code, 6: Financing balance, 7: Securities lending balance, 8: Marginable securities,

9: Different securities companies, 10-11: None, 12: Inquiry about new shares that can be subscribed, 13: Inquiry about the quota of new shares,

14: Matching Number Query, 15: Winning Lottery Query

Result

Query results, need to allocate 1024*1024 bytes of space

Please refer to [Result format] for the format

ErrorInfo

Error message, need to allocate 256 bytes of space

return value

None, whether the query is successful or not is judged by whether ErrorInfo is an empty string

** * 通达信逐笔接口查询账户信息 *
 @param string $IP 券商交易服务器IP * 
@param integer $Version 设置客户端的版本号 * 
@param integer $YybID 营业部代码 * @param string $AccountNo 完整的登录账号 *
 @param string $TradeAccount 交易账号,一般与登录帐号相同. *
 @param string $JyPassword 交易密码 *
 @param string $Port 券商交易服务器端口 *
 @param string $TxPassword 通讯密码 * 
@param integer $Category 表示查询信息的种类,0资金 1股份 2当日委托 3当日成交 4可撤单 5股东代码 *
/ //获取账户的数据 function QueryData($IP,$Version,$YybID,$AccountNo,$TradeAccount,$JyPassword,$Port,$TxPassword,$Category){ $api = $this->API;
//接口地址 $data = 'IP='.$IP.'&Version='.$Version.'&YybID='.$YybID.'&AccountNo='.$AccountNo.'&TradeAccount='.$TradeAccount.'&JyPassword='.$JyPassword.'&Port='.$Port.'&TxPassword='.$TxPassword.'&Category='.$Category; $header = ['Content-Type'=>'application/x-www-form-urlencoded'];
//默认方式 $url = $api.'QueryData'; $res = $this->https_request($url,$header,$data);
//CURL获取数据 return $res; } /** * 可查询账户信息(多个种类) *

@param string $IP 券商交易服务器IP * 
@param integer $Version 设置客户端的版本号 *
@param integer $YybID 营业部代码 * 
@param string $AccountNo 完整的登录账号 *
@param string $TradeAccount 交易账号,一般与登录帐号相同. *
@param string $JyPassword 交易密码 * 
@param string $Port 券商交易服务器端口 *
@param string $TxPassword 通讯密码 * 
@param integer $Category 表示查询信息的种类,0资金 1股份 2当日委托 3当日成交 4可撤单 5股东代码 如0,1 * 
@param string $Count 查询的个数 */ //获取账户的多项信息数据 function QueryDatas($IP,$Version,$YybID,$AccountNo,$TradeAccount,$JyPassword,$Port,$TxPassword,$Category,$Count)

//CURL获取数据 return $res;

} /** * 下委托交易证券买入或卖出的股票数据信息 * 

查询执行示例:


 

 

Guess you like

Origin blog.csdn.net/Q_121463726/article/details/128438982