Usually, when developing a stock trading interface, it will include the research and development of multiple interface functions, so Tongdaxin's quantitative interface can realize automated trading. That is, through Tongdaxin's API interface (stock automatic order placement interface), it can realize the connection and interaction with the exchange, including functions such as placing orders, canceling orders, and querying account information. The specific forms are analyzed as follows.
The general steps for automated trading using the Tongdaxin quantitative interface are as follows:
1. Obtain Tongdaxin API interface: First, you need to obtain Tongdaxin API interface documents and related development tools from Tongdaxin official or other legal channels. The API interface of Tongdaxin mainly includes the market interface and the transaction interface. For example to analyze compatibility:
name |
Function |
|
basic function |
Init |
|
Deinit |
||
Logon |
||
logoff |
||
QueryData |
||
QueryHistoryData |
||
SendOrder |
||
CancelOrder |
||
GetQuote |
||
Repay |
||
GetExpireDate |
||
Single Account Batch Function |
QueryDatas |
|
SendOrders |
||
CancelOrders |
||
GetQuotes |
||
Multi-account batch function |
QueryMultiAccountsDatas |
|
SendMultiAccountsOrders |
||
CancelMultiAccountsOrders |
||
GetMultiAccountsQuotes |
2. Development environment configuration: According to the API interface document, configure the development environment, including installing Tongdaxin software, configuring API connection parameters, installing related development tools and dependent libraries, etc.
3. Connect to the transaction server: connect to the transaction server of Tongdaxin through the API interface, and establish a connection with the exchange. During the connection process, correct login information and authentication parameters need to be provided.
4. Order/Cancellation: Use the functions or methods provided by the API interface to realize order placement and cancellation operations. You can place and cancel orders according to your own trading strategies and conditions.
5. Query account information: Use the functions or methods provided by the API interface to query account information such as positions and funds. Real-time account information can be obtained as needed. As follows:
sign |
int Init(); |
Function |
API initialization |
parameter |
none |
return value |
Number of trading accounts authorized successfully When the return value is < 1, there is no need to call the Deinit interface, nor can you call other interfaces, otherwise an error will occur! |
sign |
void Deinit(); |
Function |
API deinitialization |
parameter |
none |
return value |
none |
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 |
6. Strategy execution: Write corresponding logic and algorithms according to your own trading strategy, judge and execute trading operations through market data. You can use the API interface functions provided by Tongdaxin to perform data analysis, calculate indicators, draw graphics and other operations.
It should be noted that when conducting automated trading, risk control, error handling and abnormal situation handling should be considered, such as setting stop loss and take profit, dealing with transaction failure, etc. At the same time, it is necessary to abide by relevant laws and regulations and avoid illegal operations.
To sum up, it is feasible to realize automated trading through Tongdaxin quantitative interface, but developers need to have relevant programming and quantitative trading knowledge, and follow relevant regulations and restrictions during use.