代码拉取完成,页面将自动刷新
同步操作将从 老张/TdxTradeServer 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#ifndef TTS_TRADEAPI_H
#define TTS_TRADEAPI_H
#include <QtCore>
#include <Windows.h>
#include "json.hpp"
#include "tts_common.h"
using json = nlohmann::json;
typedef void (__stdcall *LPFN_OPENTDX)();
typedef void (__stdcall *LPFN_CLOSETDX)();
// int Logon(char* IP, short Port, char* Version, short YybID, char* AccountNo,char* TradeAccount, char* JyPassword, char* TxPassword, char* ErrInfo);//登录帐号
// void Logoff(int ClientID);//注销
// void QueryData(int ClientID, int Category, char* Result, char* ErrInfo);//查询各类交易数据
// void SendOrder(int ClientID, int Category ,int PriceType, char* Gddm, char* Zqdm , float Price, int Quantity, char* Result, char* ErrInfo);//下单
// void CancelOrder(int ClientID, char* ExchangeID, char* hth, char* Result, char* ErrInfo);//撤单
// void GetQuote(int ClientID, char* Zqdm, char* Result, char* ErrInfo);//获取五档报价
// void Repay(int ClientID, char* Amount, char* Result, char* ErrInfo);//融资融券账户直接还款
typedef int (__stdcall *LPFN_LOGON)(const char* IP, const short Port, const char* Version, short YybID, const char* AccountNo, const char* TradeAccount, const char* JyPassword, const char* TxPassword, char* ErrInfo);
typedef void(__stdcall *LPFN_LOGOFF)(int ClientID);
typedef void(__stdcall *LPFN_QUERYDATA)(int ClientID, int Category, char* result, char* errInfo);
typedef void(__stdcall *LPFN_SENDORDER)(int ClientID, int Category ,int PriceType, const char* Gddm, const char* Zqdm , float Price, int Quantity, char* Result, char* ErrInfo);
typedef void(__stdcall *LPFN_CANCELORDER)(int ClientID, const char* ExchangeID, const char* hth, char* Result, char* ErrInfo);
typedef void(__stdcall *LPFN_GETQUOTE)(int ClientID, const char* Zqdm, char* Result, char* ErrInfo);
typedef void(__stdcall *LPFN_REPAY)(int ClientID, const char* Amount, char* Result, char* ErrInfo);
#define P_LOGON "logon"
#define P_LOGOFF "logoff"
#define P_QUERYDATA "query_data"
#define P_SENDORDER "send_order"
#define P_CANCELORDER "cancel_order"
#define P_GETQUOTE "get_quote"
#define P_REPAY "repay"
class TTS_TradeApi
{
private:
HINSTANCE hDLL;
int32_t lastClientId;
/// api far call
LPFN_OPENTDX lpOpenTdx;
LPFN_CLOSETDX lpCloseTdx;
LPFN_LOGON lpLogon;
LPFN_LOGOFF lpLogoff;
LPFN_QUERYDATA lpQueryData;
LPFN_SENDORDER lpSendOrder;
LPFN_CANCELORDER lpCancelOrder;
LPFN_GETQUOTE lpGetQuote;
LPFN_REPAY lpRepay;
QMutex apiCallMutex; // add lock to all network call
// store error and result;
char* errout;
char* result;
bool outputUtf8;
/// end api far call
void setupErrForJson(const char* errout, json& resultJSON);
protected:
json convertTableToJSON(const char* result, const char* errout);
public:
TTS_TradeApi(const QString& dllFilePath);
~TTS_TradeApi();
void setOutputUtf8(bool utf8);
json logon(const char* IP, const short Port,
const char* Version, short YybID,
const char* AccountNo, const char* TradeAccount,
const char* JyPassword, const char* TxPassword);
json logoff(int ClientID);
json queryData(int ClientID, int Category);
json sendOrder(int ClientID, int Category ,int PriceType, const char* Gddm, const char* Zqdm , float Price, int Quantity);
json cancelOrder(int ClientID, const char* ExchangeID, const char* hth);
json getQuote(int ClientID, const char* Zqdm);
json repay(int ClientID, const char* Amount);
json jsonError(QString str);
};
#endif // TTS_TRADEAPI_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。