What call functions are included in the stock trading c interface?

The C interface of stock trading may contain multiple call functions, and the specific call function depends on the interface specification used and the requirements of the exchange. Let's take a look at the following examples of some possible common stock trading C interface call functions:

1. Connect function (Connect): used to establish a network connection with the exchange.

2. Login function (Login): used to authenticate and log in to the exchange system.

3. Inquiry function (GetMarketData): used to obtain stock market data, such as stock quotes, index quotes, etc.

4. Fund query function (GetAccountInfo): used to query the user's fund balance, available funds, position information, etc.

For batch query and acquisition of multiple accounts:

sign

void GetMultiAccountsQuotes(int ClientId[], const char* Zqdm[], int Count,

char* Result[], char* ErrorInfo[]);

Function

Get five quotations in batches from multiple accounts, and distinguish each query by subscript

parameter

ClientId[]

ClientId array

zqdm[]

Security code array

Count

The number of query items, that is, the length of the array

Result[]

Query result array, each result needs to allocate 1024*1024 bytes of space

Please refer to [Result format] for the format

ErrorInfo[]

Error message array, each error message needs to allocate 256 bytes of space

return value

None, whether the i-th query is successful or not is judged by whether ErrorInfo[i] is an empty string

5. Buy function (BuyOrder): used to send an order to buy stocks.

6. Sell function (SellOrder): used to send an order to sell stocks.

7. Cancellation function (CancelOrder): used to cancel the unexecuted buy or sell order.

8. Inquiry transaction function (GetTradeInfo): used to inquire about the order information that has been executed.

9. Query position function (GetPositionInfo): Used to query the stock information of the current position.

Please note that the above functions are examples only, and the specific calling functions may vary depending on exchanges and interface specifications. When analyzing the C interface of stock trading, it is necessary to refer to the interface documents and sample codes provided by the exchange to understand the specific function calling methods and parameter settings. Like source code documentation: MetaTradeAPI (metatradeapi) - Gitee.com

1. #include <Windows.h>

2. #include <iostream>

3. #include <stdexcept>

4. #include <string>

5.

6. // API  initialization , returns the number of transaction accounts that have been successfully authorized

7. // 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 ! 

8. typedef int (*InitFn)();

9. // API  deinitialization

10. typedef void (*DeinitFn)();

11. // Login to trading account

12. typedef int (*LogonFn)(const char* Ip, short Port, const char* Version,

13. short Yybid, const char* Account,

14. const char* TradeAccount, const char* JyPassword,

15. const char* TxPassword, char* ErrorInfo);

16. // Log out of trading account

17. typedef void (*LogoffFn)(int ClientId);

18. // Query various transaction data

19. typedef void (*QueryDataFn)(int ClientId, int Category, char* Result,

20. char* ErrorInfo);

21. // Single-account batch query of various transaction data

22. typedef void (*QueryDatasFn)(int ClientId, int Category[], int Count,

23. char* Result[], char* ErrorInfo[]);

24. // Multi-account batch query of various transaction data

25. typedef void (*QueryMultiAccountsDatasFn)(int ClientId[], int Category[],

26. int Count, char* Result[],

27. char* ErrorInfo[]);

28. // 查询各类历史数据

29. typedef void (*QueryHistoryDataFn)(int ClientId, int Category,

30. const char* StartDate, const char* EndDate,

31. char* Result, char* ErrorInfo);

32. // 委托下单

33. typedef void (*SendOrderFn)(int ClientId, int Category, int EntrustType,

34. const char* Gddm, const char* Zqdm, float Price,

35. int Quantity, char* Result, char* ErrorInfo);

36. // 单账户批量下单

37. typedef void (*SendOrdersFn)(int ClientId, int Category[], int EntrustType[],

38. const char* Gddm[], const char* Zqdm[],

39. float Price[], int Quantity[], int Count,

40. char* Result[], char* ErrorInfo[]);

41. // 多账户批量下单

42. typedef void (*SendMultiAccountsOrdersFn)(int ClientId[], int Category[],

43. int EntrustType[], const char* Gddm[],

44. const char* Zqdm[], float Price[],

 

Guess you like

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