[Add] wrapper for da future and stock api

This commit is contained in:
vn.py 2019-08-29 14:48:40 +08:00
parent e43df6d9e6
commit 8eb0553574
18 changed files with 797 additions and 377 deletions

View File

@ -6,61 +6,61 @@ virtual void onHeartBeatWarning(int reqid) {};
virtual void onRspNeedVerify(bool last, bool last) {}; virtual void onRspNeedVerify(bool last, bool last) {};
virtual void onRspUserLogin(const dict &data, int reqid, bool last) {}; virtual void onRspUserLogin(const dict &error, int reqid, bool last) {};
virtual void onRspUserLogout(const dict &data, int reqid, bool last) {}; virtual void onRspUserLogout(const dict &error, int reqid, bool last) {};
virtual void onRspVerifyCode(const dict &data, int reqid, bool last) {}; virtual void onRspVerifyCode(const dict &error, int reqid, bool last) {};
virtual void onRspSafeVerify(const dict &data, int reqid, bool last) {}; virtual void onRspSafeVerify(const dict &error, int reqid, bool last) {};
virtual void onRspSetVerifyQA(const dict &data, int reqid, bool last) {}; virtual void onRspSetVerifyQA(const dict &error, int reqid, bool last) {};
virtual void onRspAccount(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspAccount(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQuestion(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQuestion(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspOrderInsert(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspOrderInsert(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspOrderModify(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspOrderModify(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspOrderCancel(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspOrderCancel(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspPasswordUpdate(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspPasswordUpdate(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRtnTrade(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRtnTrade(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRtnOrder(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRtnOrder(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRtnCapital(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRtnCapital(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRtnPosition(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRtnPosition(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryOrder(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryOrder(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryTrade(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryTrade(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryCapital(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryCapital(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryVersion(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryVersion(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryPosition(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryPosition(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryCurrency(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryCurrency(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryExchange(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryExchange(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryStrategy(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryStrategy(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryCommodity(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryCommodity(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryInstrument(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryInstrument(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryExchangeTime(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryExchangeTime(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryCommodityTime(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryCommodityTime(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryTotalPosition(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryTotalPosition(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryStrategyDetail(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryStrategyDetail(const dict &data, const dict &error, int reqid, bool last) {};

View File

@ -46,11 +46,11 @@ void onRspNeedVerify(bool last, bool last) override
} }
}; };
void onRspUserLogin(const dict &data, int reqid, bool last) override void onRspUserLogin(const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspUserLogin, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspUserLogin, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -58,11 +58,11 @@ void onRspUserLogin(const dict &data, int reqid, bool last) override
} }
}; };
void onRspUserLogout(const dict &data, int reqid, bool last) override void onRspUserLogout(const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspUserLogout, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspUserLogout, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -70,11 +70,11 @@ void onRspUserLogout(const dict &data, int reqid, bool last) override
} }
}; };
void onRspVerifyCode(const dict &data, int reqid, bool last) override void onRspVerifyCode(const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspVerifyCode, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspVerifyCode, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -82,11 +82,11 @@ void onRspVerifyCode(const dict &data, int reqid, bool last) override
} }
}; };
void onRspSafeVerify(const dict &data, int reqid, bool last) override void onRspSafeVerify(const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspSafeVerify, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspSafeVerify, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -94,11 +94,11 @@ void onRspSafeVerify(const dict &data, int reqid, bool last) override
} }
}; };
void onRspSetVerifyQA(const dict &data, int reqid, bool last) override void onRspSetVerifyQA(const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspSetVerifyQA, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspSetVerifyQA, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -106,11 +106,11 @@ void onRspSetVerifyQA(const dict &data, int reqid, bool last) override
} }
}; };
void onRspAccount(const dict &data, const dict &data, int reqid, bool last) override void onRspAccount(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspAccount, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspAccount, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -118,11 +118,11 @@ void onRspAccount(const dict &data, const dict &data, int reqid, bool last) over
} }
}; };
void onRspQuestion(const dict &data, const dict &data, int reqid, bool last) override void onRspQuestion(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspQuestion, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspQuestion, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -130,11 +130,11 @@ void onRspQuestion(const dict &data, const dict &data, int reqid, bool last) ove
} }
}; };
void onRspOrderInsert(const dict &data, const dict &data, int reqid, bool last) override void onRspOrderInsert(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspOrderInsert, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspOrderInsert, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -142,11 +142,11 @@ void onRspOrderInsert(const dict &data, const dict &data, int reqid, bool last)
} }
}; };
void onRspOrderModify(const dict &data, const dict &data, int reqid, bool last) override void onRspOrderModify(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspOrderModify, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspOrderModify, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -154,11 +154,11 @@ void onRspOrderModify(const dict &data, const dict &data, int reqid, bool last)
} }
}; };
void onRspOrderCancel(const dict &data, const dict &data, int reqid, bool last) override void onRspOrderCancel(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspOrderCancel, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspOrderCancel, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -166,11 +166,11 @@ void onRspOrderCancel(const dict &data, const dict &data, int reqid, bool last)
} }
}; };
void onRspPasswordUpdate(const dict &data, const dict &data, int reqid, bool last) override void onRspPasswordUpdate(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspPasswordUpdate, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspPasswordUpdate, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -178,11 +178,11 @@ void onRspPasswordUpdate(const dict &data, const dict &data, int reqid, bool las
} }
}; };
void onRtnTrade(const dict &data, const dict &data, int reqid, bool last) override void onRtnTrade(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRtnTrade, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRtnTrade, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -190,11 +190,11 @@ void onRtnTrade(const dict &data, const dict &data, int reqid, bool last) overri
} }
}; };
void onRtnOrder(const dict &data, const dict &data, int reqid, bool last) override void onRtnOrder(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRtnOrder, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRtnOrder, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -202,11 +202,11 @@ void onRtnOrder(const dict &data, const dict &data, int reqid, bool last) overri
} }
}; };
void onRtnCapital(const dict &data, const dict &data, int reqid, bool last) override void onRtnCapital(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRtnCapital, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRtnCapital, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -214,11 +214,11 @@ void onRtnCapital(const dict &data, const dict &data, int reqid, bool last) over
} }
}; };
void onRtnPosition(const dict &data, const dict &data, int reqid, bool last) override void onRtnPosition(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRtnPosition, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRtnPosition, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -226,11 +226,11 @@ void onRtnPosition(const dict &data, const dict &data, int reqid, bool last) ove
} }
}; };
void onRspQryOrder(const dict &data, const dict &data, int reqid, bool last) override void onRspQryOrder(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspQryOrder, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspQryOrder, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -238,11 +238,11 @@ void onRspQryOrder(const dict &data, const dict &data, int reqid, bool last) ove
} }
}; };
void onRspQryTrade(const dict &data, const dict &data, int reqid, bool last) override void onRspQryTrade(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspQryTrade, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspQryTrade, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -250,11 +250,11 @@ void onRspQryTrade(const dict &data, const dict &data, int reqid, bool last) ove
} }
}; };
void onRspQryCapital(const dict &data, const dict &data, int reqid, bool last) override void onRspQryCapital(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspQryCapital, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspQryCapital, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -262,11 +262,11 @@ void onRspQryCapital(const dict &data, const dict &data, int reqid, bool last) o
} }
}; };
void onRspQryVersion(const dict &data, const dict &data, int reqid, bool last) override void onRspQryVersion(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspQryVersion, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspQryVersion, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -274,11 +274,11 @@ void onRspQryVersion(const dict &data, const dict &data, int reqid, bool last) o
} }
}; };
void onRspQryPosition(const dict &data, const dict &data, int reqid, bool last) override void onRspQryPosition(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspQryPosition, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspQryPosition, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -286,11 +286,11 @@ void onRspQryPosition(const dict &data, const dict &data, int reqid, bool last)
} }
}; };
void onRspQryCurrency(const dict &data, const dict &data, int reqid, bool last) override void onRspQryCurrency(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspQryCurrency, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspQryCurrency, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -298,11 +298,11 @@ void onRspQryCurrency(const dict &data, const dict &data, int reqid, bool last)
} }
}; };
void onRspQryExchange(const dict &data, const dict &data, int reqid, bool last) override void onRspQryExchange(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspQryExchange, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspQryExchange, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -310,11 +310,11 @@ void onRspQryExchange(const dict &data, const dict &data, int reqid, bool last)
} }
}; };
void onRspQryStrategy(const dict &data, const dict &data, int reqid, bool last) override void onRspQryStrategy(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspQryStrategy, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspQryStrategy, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -322,11 +322,11 @@ void onRspQryStrategy(const dict &data, const dict &data, int reqid, bool last)
} }
}; };
void onRspQryCommodity(const dict &data, const dict &data, int reqid, bool last) override void onRspQryCommodity(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspQryCommodity, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspQryCommodity, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -334,11 +334,11 @@ void onRspQryCommodity(const dict &data, const dict &data, int reqid, bool last)
} }
}; };
void onRspQryInstrument(const dict &data, const dict &data, int reqid, bool last) override void onRspQryInstrument(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspQryInstrument, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspQryInstrument, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -346,11 +346,11 @@ void onRspQryInstrument(const dict &data, const dict &data, int reqid, bool last
} }
}; };
void onRspQryExchangeTime(const dict &data, const dict &data, int reqid, bool last) override void onRspQryExchangeTime(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspQryExchangeTime, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspQryExchangeTime, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -358,11 +358,11 @@ void onRspQryExchangeTime(const dict &data, const dict &data, int reqid, bool la
} }
}; };
void onRspQryCommodityTime(const dict &data, const dict &data, int reqid, bool last) override void onRspQryCommodityTime(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspQryCommodityTime, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspQryCommodityTime, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -370,11 +370,11 @@ void onRspQryCommodityTime(const dict &data, const dict &data, int reqid, bool l
} }
}; };
void onRspQryTotalPosition(const dict &data, const dict &data, int reqid, bool last) override void onRspQryTotalPosition(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspQryTotalPosition, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspQryTotalPosition, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -382,11 +382,11 @@ void onRspQryTotalPosition(const dict &data, const dict &data, int reqid, bool l
} }
}; };
void onRspQryStrategyDetail(const dict &data, const dict &data, int reqid, bool last) override void onRspQryStrategyDetail(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, FutureApi, onRspQryStrategyDetail, data, data, reqid, last); PYBIND11_OVERLOAD(void, FutureApi, onRspQryStrategyDetail, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {

View File

@ -25,61 +25,61 @@ void FutureApi::OnRspNeedVerify(bool bFirstLogin, bool bHasSetQA)
void FutureApi::OnRspUserLogin(CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspUserLogin(CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
{ {
gil_scoped_acquire acquire; gil_scoped_acquire acquire;
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspUserLogin(data, iRequestID, bIsLast); this->onRspUserLogin(error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspUserLogout(CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspUserLogout(CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
{ {
gil_scoped_acquire acquire; gil_scoped_acquire acquire;
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspUserLogout(data, iRequestID, bIsLast); this->onRspUserLogout(error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspVerifyCode(CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspVerifyCode(CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
{ {
gil_scoped_acquire acquire; gil_scoped_acquire acquire;
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspVerifyCode(data, iRequestID, bIsLast); this->onRspVerifyCode(error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspSafeVerify(CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspSafeVerify(CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
{ {
gil_scoped_acquire acquire; gil_scoped_acquire acquire;
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspSafeVerify(data, iRequestID, bIsLast); this->onRspSafeVerify(error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspSetVerifyQA(CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspSetVerifyQA(CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
{ {
gil_scoped_acquire acquire; gil_scoped_acquire acquire;
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspSetVerifyQA(data, iRequestID, bIsLast); this->onRspSetVerifyQA(error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspAccount(CFutureRspAccountField *pRspAccount, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspAccount(CFutureRspAccountField *pRspAccount, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -135,13 +135,13 @@ void FutureApi::OnRspAccount(CFutureRspAccountField *pRspAccount, CFutureRspInfo
data["CanTradeStockAU"] = toUtf(pRspAccount->CanTradeStockAU); data["CanTradeStockAU"] = toUtf(pRspAccount->CanTradeStockAU);
data["NyFlag"] = toUtf(pRspAccount->NyFlag); data["NyFlag"] = toUtf(pRspAccount->NyFlag);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspAccount(data, data, iRequestID, bIsLast); this->onRspAccount(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspQuestion(CFutureRspQuestionField *pRspVersion, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspQuestion(CFutureRspQuestionField *pRspVersion, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -155,13 +155,13 @@ void FutureApi::OnRspQuestion(CFutureRspQuestionField *pRspVersion, CFutureRspIn
data["QuestionCN"] = toUtf(pRspVersion->QuestionCN); data["QuestionCN"] = toUtf(pRspVersion->QuestionCN);
data["QuestionEN"] = toUtf(pRspVersion->QuestionEN); data["QuestionEN"] = toUtf(pRspVersion->QuestionEN);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQuestion(data, data, iRequestID, bIsLast); this->onRspQuestion(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspOrderInsert(CFutureRspOrderInsertField *pRspOrderInsert, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspOrderInsert(CFutureRspOrderInsertField *pRspOrderInsert, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -203,13 +203,13 @@ void FutureApi::OnRspOrderInsert(CFutureRspOrderInsertField *pRspOrderInsert, CF
data["ExchangeTime"] = toUtf(pRspOrderInsert->ExchangeTime); data["ExchangeTime"] = toUtf(pRspOrderInsert->ExchangeTime);
data["CancelTime"] = toUtf(pRspOrderInsert->CancelTime); data["CancelTime"] = toUtf(pRspOrderInsert->CancelTime);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspOrderInsert(data, data, iRequestID, bIsLast); this->onRspOrderInsert(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspOrderModify(CFutureRspOrderModifyField *pRspOrderModify, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspOrderModify(CFutureRspOrderModifyField *pRspOrderModify, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -251,13 +251,13 @@ void FutureApi::OnRspOrderModify(CFutureRspOrderModifyField *pRspOrderModify, CF
data["ExchangeTime"] = toUtf(pRspOrderModify->ExchangeTime); data["ExchangeTime"] = toUtf(pRspOrderModify->ExchangeTime);
data["CancelTime"] = toUtf(pRspOrderModify->CancelTime); data["CancelTime"] = toUtf(pRspOrderModify->CancelTime);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspOrderModify(data, data, iRequestID, bIsLast); this->onRspOrderModify(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspOrderCancel(CFutureRspOrderCancelField *pRspOrderCancel, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspOrderCancel(CFutureRspOrderCancelField *pRspOrderCancel, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -287,13 +287,13 @@ void FutureApi::OnRspOrderCancel(CFutureRspOrderCancelField *pRspOrderCancel, CF
data["ErrorCode"] = toUtf(pRspOrderCancel->ErrorCode); data["ErrorCode"] = toUtf(pRspOrderCancel->ErrorCode);
data["IsRiskOrder"] = toUtf(pRspOrderCancel->IsRiskOrder); data["IsRiskOrder"] = toUtf(pRspOrderCancel->IsRiskOrder);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspOrderCancel(data, data, iRequestID, bIsLast); this->onRspOrderCancel(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspPasswordUpdate(CFutureRspPasswordUpdateField *pRspPasswordUpdate, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspPasswordUpdate(CFutureRspPasswordUpdateField *pRspPasswordUpdate, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -306,13 +306,13 @@ void FutureApi::OnRspPasswordUpdate(CFutureRspPasswordUpdateField *pRspPasswordU
data["OldPassword"] = toUtf(pRspPasswordUpdate->OldPassword); data["OldPassword"] = toUtf(pRspPasswordUpdate->OldPassword);
data["NewPassword"] = toUtf(pRspPasswordUpdate->NewPassword); data["NewPassword"] = toUtf(pRspPasswordUpdate->NewPassword);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspPasswordUpdate(data, data, iRequestID, bIsLast); this->onRspPasswordUpdate(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRtnTrade(CFutureRtnTradeField *pRtnTrade, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRtnTrade(CFutureRtnTradeField *pRtnTrade, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -344,13 +344,13 @@ void FutureApi::OnRtnTrade(CFutureRtnTradeField *pRtnTrade, CFutureRspInfoField
data["AddReduce"] = toUtf(pRtnTrade->AddReduce); data["AddReduce"] = toUtf(pRtnTrade->AddReduce);
data["ErrorDescription"] = toUtf(pRtnTrade->ErrorDescription); data["ErrorDescription"] = toUtf(pRtnTrade->ErrorDescription);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRtnTrade(data, data, iRequestID, bIsLast); this->onRtnTrade(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRtnOrder(CFutureRtnOrderField *pRtnOrder, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRtnOrder(CFutureRtnOrderField *pRtnOrder, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -382,13 +382,13 @@ void FutureApi::OnRtnOrder(CFutureRtnOrderField *pRtnOrder, CFutureRspInfoField
data["CurrPrice"] = pRtnOrder->CurrPrice; data["CurrPrice"] = pRtnOrder->CurrPrice;
data["FloatProfit"] = pRtnOrder->FloatProfit; data["FloatProfit"] = pRtnOrder->FloatProfit;
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRtnOrder(data, data, iRequestID, bIsLast); this->onRtnOrder(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRtnCapital(CFutureRtnCapitalField *pRtnCapital, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRtnCapital(CFutureRtnCapitalField *pRtnCapital, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -444,13 +444,13 @@ void FutureApi::OnRtnCapital(CFutureRtnCapitalField *pRtnCapital, CFutureRspInfo
data["SellInterest"] = pRtnCapital->SellInterest; data["SellInterest"] = pRtnCapital->SellInterest;
data["SellNeedAddMargin"] = pRtnCapital->SellNeedAddMargin; data["SellNeedAddMargin"] = pRtnCapital->SellNeedAddMargin;
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRtnCapital(data, data, iRequestID, bIsLast); this->onRtnCapital(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRtnPosition(CFutureRtnPositionField *pRtnPosition, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRtnPosition(CFutureRtnPositionField *pRtnPosition, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -482,13 +482,13 @@ void FutureApi::OnRtnPosition(CFutureRtnPositionField *pRtnPosition, CFutureRspI
data["CurrPrice"] = pRtnPosition->CurrPrice; data["CurrPrice"] = pRtnPosition->CurrPrice;
data["FloatProfit"] = pRtnPosition->FloatProfit; data["FloatProfit"] = pRtnPosition->FloatProfit;
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRtnPosition(data, data, iRequestID, bIsLast); this->onRtnPosition(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspQryOrder(CFutureRspOrderField *pRspOrder, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspQryOrder(CFutureRspOrderField *pRspOrder, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -530,13 +530,13 @@ void FutureApi::OnRspQryOrder(CFutureRspOrderField *pRspOrder, CFutureRspInfoFie
data["ExchangeTime"] = toUtf(pRspOrder->ExchangeTime); data["ExchangeTime"] = toUtf(pRspOrder->ExchangeTime);
data["CancelTime"] = toUtf(pRspOrder->CancelTime); data["CancelTime"] = toUtf(pRspOrder->CancelTime);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryOrder(data, data, iRequestID, bIsLast); this->onRspQryOrder(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspQryTrade(CFutureRspTradeField *pRspTrade, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspQryTrade(CFutureRspTradeField *pRspTrade, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -568,13 +568,13 @@ void FutureApi::OnRspQryTrade(CFutureRspTradeField *pRspTrade, CFutureRspInfoFie
data["AddReduce"] = toUtf(pRspTrade->AddReduce); data["AddReduce"] = toUtf(pRspTrade->AddReduce);
data["ErrorDescription"] = toUtf(pRspTrade->ErrorDescription); data["ErrorDescription"] = toUtf(pRspTrade->ErrorDescription);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryTrade(data, data, iRequestID, bIsLast); this->onRspQryTrade(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspQryCapital(CFutureRspCapitalField *pRspCapital, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspQryCapital(CFutureRspCapitalField *pRspCapital, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -626,13 +626,13 @@ void FutureApi::OnRspQryCapital(CFutureRspCapitalField *pRspCapital, CFutureRspI
data["RiskRate"] = toUtf(pRspCapital->RiskRate); data["RiskRate"] = toUtf(pRspCapital->RiskRate);
data["ErrorDescription"] = toUtf(pRspCapital->ErrorDescription); data["ErrorDescription"] = toUtf(pRspCapital->ErrorDescription);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryCapital(data, data, iRequestID, bIsLast); this->onRspQryCapital(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspQryVersion(CFutureRspVersionField *pRspVersion, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspQryVersion(CFutureRspVersionField *pRspVersion, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -647,13 +647,13 @@ void FutureApi::OnRspQryVersion(CFutureRspVersionField *pRspVersion, CFutureRspI
data["VersionContent_CN"] = toUtf(pRspVersion->VersionContent_CN); data["VersionContent_CN"] = toUtf(pRspVersion->VersionContent_CN);
data["VersionContent_US"] = toUtf(pRspVersion->VersionContent_US); data["VersionContent_US"] = toUtf(pRspVersion->VersionContent_US);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryVersion(data, data, iRequestID, bIsLast); this->onRspQryVersion(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspQryPosition(CFutureRspPositionField *pRspPosition, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspQryPosition(CFutureRspPositionField *pRspPosition, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -681,13 +681,13 @@ void FutureApi::OnRspQryPosition(CFutureRspPositionField *pRspPosition, CFutureR
data["ContCode"] = toUtf(pRspPosition->ContCode); data["ContCode"] = toUtf(pRspPosition->ContCode);
data["HoldMargin"] = pRspPosition->HoldMargin; data["HoldMargin"] = pRspPosition->HoldMargin;
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryPosition(data, data, iRequestID, bIsLast); this->onRspQryPosition(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspQryCurrency(CFutureRspCurrencyField *pRspCurrency, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspQryCurrency(CFutureRspCurrencyField *pRspCurrency, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -702,13 +702,13 @@ void FutureApi::OnRspQryCurrency(CFutureRspCurrencyField *pRspCurrency, CFutureR
data["CurrencyName"] = toUtf(pRspCurrency->CurrencyName); data["CurrencyName"] = toUtf(pRspCurrency->CurrencyName);
data["CurrencyNameEN"] = toUtf(pRspCurrency->CurrencyNameEN); data["CurrencyNameEN"] = toUtf(pRspCurrency->CurrencyNameEN);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryCurrency(data, data, iRequestID, bIsLast); this->onRspQryCurrency(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspQryExchange(CFutureRspExchangeField *pRspExchange, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspQryExchange(CFutureRspExchangeField *pRspExchange, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -722,13 +722,13 @@ void FutureApi::OnRspQryExchange(CFutureRspExchangeField *pRspExchange, CFutureR
data["SettleType"] = toUtf(pRspExchange->SettleType); data["SettleType"] = toUtf(pRspExchange->SettleType);
data["NameEN"] = toUtf(pRspExchange->NameEN); data["NameEN"] = toUtf(pRspExchange->NameEN);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryExchange(data, data, iRequestID, bIsLast); this->onRspQryExchange(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspQryStrategy(CFutureRspStrategyField *pRspStrategy, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspQryStrategy(CFutureRspStrategyField *pRspStrategy, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -767,13 +767,13 @@ void FutureApi::OnRspQryStrategy(CFutureRspStrategyField *pRspStrategy, CFutureR
data["DotLen"] = pRspStrategy->DotLen; data["DotLen"] = pRspStrategy->DotLen;
data["TradeTime"] = toUtf(pRspStrategy->TradeTime); data["TradeTime"] = toUtf(pRspStrategy->TradeTime);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryStrategy(data, data, iRequestID, bIsLast); this->onRspQryStrategy(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspQryCommodity(CFutureRspCommodityField *pRspCommodity, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspQryCommodity(CFutureRspCommodityField *pRspCommodity, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -798,13 +798,13 @@ void FutureApi::OnRspQryCommodity(CFutureRspCommodityField *pRspCommodity, CFutu
data["ExchangeNo2"] = toUtf(pRspCommodity->ExchangeNo2); data["ExchangeNo2"] = toUtf(pRspCommodity->ExchangeNo2);
data["IsSFuture"] = toUtf(pRspCommodity->IsSFuture); data["IsSFuture"] = toUtf(pRspCommodity->IsSFuture);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryCommodity(data, data, iRequestID, bIsLast); this->onRspQryCommodity(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspQryInstrument(CFutureRspInstrumentField *pRspInstrument, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspQryInstrument(CFutureRspInstrumentField *pRspInstrument, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -853,13 +853,13 @@ void FutureApi::OnRspQryInstrument(CFutureRspInstrumentField *pRspInstrument, CF
data["CommodityFNameEN"] = toUtf(pRspInstrument->CommodityFNameEN); data["CommodityFNameEN"] = toUtf(pRspInstrument->CommodityFNameEN);
data["OptionStyle"] = toUtf(pRspInstrument->OptionStyle); data["OptionStyle"] = toUtf(pRspInstrument->OptionStyle);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryInstrument(data, data, iRequestID, bIsLast); this->onRspQryInstrument(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspQryExchangeTime(CFutureRspExchangeTimeField *pRspExchangeTime, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspQryExchangeTime(CFutureRspExchangeTimeField *pRspExchangeTime, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -874,13 +874,13 @@ void FutureApi::OnRspQryExchangeTime(CFutureRspExchangeTimeField *pRspExchangeTi
data["ExchangeNo"] = toUtf(pRspExchangeTime->ExchangeNo); data["ExchangeNo"] = toUtf(pRspExchangeTime->ExchangeNo);
data["Name"] = toUtf(pRspExchangeTime->Name); data["Name"] = toUtf(pRspExchangeTime->Name);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryExchangeTime(data, data, iRequestID, bIsLast); this->onRspQryExchangeTime(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspQryCommodityTime(CFutureRspCommodityTimeField *pRspCommodityTime, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspQryCommodityTime(CFutureRspCommodityTimeField *pRspCommodityTime, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -899,13 +899,13 @@ void FutureApi::OnRspQryCommodityTime(CFutureRspCommodityTimeField *pRspCommodit
data["ExchangeNo"] = toUtf(pRspCommodityTime->ExchangeNo); data["ExchangeNo"] = toUtf(pRspCommodityTime->ExchangeNo);
data["ExName"] = toUtf(pRspCommodityTime->ExName); data["ExName"] = toUtf(pRspCommodityTime->ExName);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryCommodityTime(data, data, iRequestID, bIsLast); this->onRspQryCommodityTime(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspQryTotalPosition(CFutureRspTotalPositionField *pRspTotalPosition, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspQryTotalPosition(CFutureRspTotalPositionField *pRspTotalPosition, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -937,13 +937,13 @@ void FutureApi::OnRspQryTotalPosition(CFutureRspTotalPositionField *pRspTotalPos
data["CurrPrice"] = pRspTotalPosition->CurrPrice; data["CurrPrice"] = pRspTotalPosition->CurrPrice;
data["FloatProfit"] = pRspTotalPosition->FloatProfit; data["FloatProfit"] = pRspTotalPosition->FloatProfit;
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryTotalPosition(data, data, iRequestID, bIsLast); this->onRspQryTotalPosition(data, error, iRequestID, bIsLast);
}; };
void FutureApi::OnRspQryStrategyDetail(CFutureRspStrategyDetailField *pRspStrategyDetail, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void FutureApi::OnRspQryStrategyDetail(CFutureRspStrategyDetailField *pRspStrategyDetail, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -981,12 +981,12 @@ void FutureApi::OnRspQryStrategyDetail(CFutureRspStrategyDetailField *pRspStrate
data["SafeDeep"] = pRspStrategyDetail->SafeDeep; data["SafeDeep"] = pRspStrategyDetail->SafeDeep;
data["MainRange"] = pRspStrategyDetail->MainRange; data["MainRange"] = pRspStrategyDetail->MainRange;
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryStrategyDetail(data, data, iRequestID, bIsLast); this->onRspQryStrategyDetail(data, error, iRequestID, bIsLast);
}; };

View File

@ -6,51 +6,51 @@ virtual void onHeartBeatWarning(int reqid) {};
virtual void onRspNeedVerify(bool last, bool last) {}; virtual void onRspNeedVerify(bool last, bool last) {};
virtual void onRspUserLogin(const dict &data, int reqid, bool last) {}; virtual void onRspUserLogin(const dict &error, int reqid, bool last) {};
virtual void onRspUserLogout(const dict &data, int reqid, bool last) {}; virtual void onRspUserLogout(const dict &error, int reqid, bool last) {};
virtual void onRspVerifyCode(const dict &data, int reqid, bool last) {}; virtual void onRspVerifyCode(const dict &error, int reqid, bool last) {};
virtual void onRspSafeVerify(const dict &data, int reqid, bool last) {}; virtual void onRspSafeVerify(const dict &error, int reqid, bool last) {};
virtual void onRspSetVerifyQA(const dict &data, int reqid, bool last) {}; virtual void onRspSetVerifyQA(const dict &error, int reqid, bool last) {};
virtual void onRspAccount(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspAccount(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQuestion(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQuestion(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspOrderInsert(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspOrderInsert(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspOrderModify(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspOrderModify(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspOrderCancel(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspOrderCancel(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspPasswordUpdate(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspPasswordUpdate(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRtnTrade(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRtnTrade(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRtnOrder(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRtnOrder(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRtnCapital(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRtnCapital(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRtnPosition(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRtnPosition(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryTick(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryTick(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryOrder(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryOrder(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryTrade(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryTrade(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryCapital(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryCapital(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryVersion(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryVersion(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryPosition(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryPosition(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryCurrency(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryCurrency(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryExchange(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryExchange(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryInstrument(const dict &data, const dict &data, int reqid, bool last) {}; virtual void onRspQryInstrument(const dict &data, const dict &error, int reqid, bool last) {};

View File

@ -46,11 +46,11 @@ void onRspNeedVerify(bool last, bool last) override
} }
}; };
void onRspUserLogin(const dict &data, int reqid, bool last) override void onRspUserLogin(const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRspUserLogin, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRspUserLogin, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -58,11 +58,11 @@ void onRspUserLogin(const dict &data, int reqid, bool last) override
} }
}; };
void onRspUserLogout(const dict &data, int reqid, bool last) override void onRspUserLogout(const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRspUserLogout, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRspUserLogout, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -70,11 +70,11 @@ void onRspUserLogout(const dict &data, int reqid, bool last) override
} }
}; };
void onRspVerifyCode(const dict &data, int reqid, bool last) override void onRspVerifyCode(const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRspVerifyCode, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRspVerifyCode, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -82,11 +82,11 @@ void onRspVerifyCode(const dict &data, int reqid, bool last) override
} }
}; };
void onRspSafeVerify(const dict &data, int reqid, bool last) override void onRspSafeVerify(const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRspSafeVerify, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRspSafeVerify, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -94,11 +94,11 @@ void onRspSafeVerify(const dict &data, int reqid, bool last) override
} }
}; };
void onRspSetVerifyQA(const dict &data, int reqid, bool last) override void onRspSetVerifyQA(const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRspSetVerifyQA, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRspSetVerifyQA, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -106,11 +106,11 @@ void onRspSetVerifyQA(const dict &data, int reqid, bool last) override
} }
}; };
void onRspAccount(const dict &data, const dict &data, int reqid, bool last) override void onRspAccount(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRspAccount, data, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRspAccount, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -118,11 +118,11 @@ void onRspAccount(const dict &data, const dict &data, int reqid, bool last) over
} }
}; };
void onRspQuestion(const dict &data, const dict &data, int reqid, bool last) override void onRspQuestion(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRspQuestion, data, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRspQuestion, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -130,11 +130,11 @@ void onRspQuestion(const dict &data, const dict &data, int reqid, bool last) ove
} }
}; };
void onRspOrderInsert(const dict &data, const dict &data, int reqid, bool last) override void onRspOrderInsert(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRspOrderInsert, data, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRspOrderInsert, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -142,11 +142,11 @@ void onRspOrderInsert(const dict &data, const dict &data, int reqid, bool last)
} }
}; };
void onRspOrderModify(const dict &data, const dict &data, int reqid, bool last) override void onRspOrderModify(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRspOrderModify, data, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRspOrderModify, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -154,11 +154,11 @@ void onRspOrderModify(const dict &data, const dict &data, int reqid, bool last)
} }
}; };
void onRspOrderCancel(const dict &data, const dict &data, int reqid, bool last) override void onRspOrderCancel(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRspOrderCancel, data, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRspOrderCancel, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -166,11 +166,11 @@ void onRspOrderCancel(const dict &data, const dict &data, int reqid, bool last)
} }
}; };
void onRspPasswordUpdate(const dict &data, const dict &data, int reqid, bool last) override void onRspPasswordUpdate(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRspPasswordUpdate, data, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRspPasswordUpdate, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -178,11 +178,11 @@ void onRspPasswordUpdate(const dict &data, const dict &data, int reqid, bool las
} }
}; };
void onRtnTrade(const dict &data, const dict &data, int reqid, bool last) override void onRtnTrade(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRtnTrade, data, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRtnTrade, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -190,11 +190,11 @@ void onRtnTrade(const dict &data, const dict &data, int reqid, bool last) overri
} }
}; };
void onRtnOrder(const dict &data, const dict &data, int reqid, bool last) override void onRtnOrder(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRtnOrder, data, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRtnOrder, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -202,11 +202,11 @@ void onRtnOrder(const dict &data, const dict &data, int reqid, bool last) overri
} }
}; };
void onRtnCapital(const dict &data, const dict &data, int reqid, bool last) override void onRtnCapital(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRtnCapital, data, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRtnCapital, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -214,11 +214,11 @@ void onRtnCapital(const dict &data, const dict &data, int reqid, bool last) over
} }
}; };
void onRtnPosition(const dict &data, const dict &data, int reqid, bool last) override void onRtnPosition(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRtnPosition, data, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRtnPosition, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -226,11 +226,11 @@ void onRtnPosition(const dict &data, const dict &data, int reqid, bool last) ove
} }
}; };
void onRspQryTick(const dict &data, const dict &data, int reqid, bool last) override void onRspQryTick(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRspQryTick, data, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRspQryTick, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -238,11 +238,11 @@ void onRspQryTick(const dict &data, const dict &data, int reqid, bool last) over
} }
}; };
void onRspQryOrder(const dict &data, const dict &data, int reqid, bool last) override void onRspQryOrder(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRspQryOrder, data, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRspQryOrder, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -250,11 +250,11 @@ void onRspQryOrder(const dict &data, const dict &data, int reqid, bool last) ove
} }
}; };
void onRspQryTrade(const dict &data, const dict &data, int reqid, bool last) override void onRspQryTrade(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRspQryTrade, data, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRspQryTrade, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -262,11 +262,11 @@ void onRspQryTrade(const dict &data, const dict &data, int reqid, bool last) ove
} }
}; };
void onRspQryCapital(const dict &data, const dict &data, int reqid, bool last) override void onRspQryCapital(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRspQryCapital, data, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRspQryCapital, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -274,11 +274,11 @@ void onRspQryCapital(const dict &data, const dict &data, int reqid, bool last) o
} }
}; };
void onRspQryVersion(const dict &data, const dict &data, int reqid, bool last) override void onRspQryVersion(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRspQryVersion, data, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRspQryVersion, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -286,11 +286,11 @@ void onRspQryVersion(const dict &data, const dict &data, int reqid, bool last) o
} }
}; };
void onRspQryPosition(const dict &data, const dict &data, int reqid, bool last) override void onRspQryPosition(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRspQryPosition, data, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRspQryPosition, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -298,11 +298,11 @@ void onRspQryPosition(const dict &data, const dict &data, int reqid, bool last)
} }
}; };
void onRspQryCurrency(const dict &data, const dict &data, int reqid, bool last) override void onRspQryCurrency(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRspQryCurrency, data, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRspQryCurrency, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -310,11 +310,11 @@ void onRspQryCurrency(const dict &data, const dict &data, int reqid, bool last)
} }
}; };
void onRspQryExchange(const dict &data, const dict &data, int reqid, bool last) override void onRspQryExchange(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRspQryExchange, data, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRspQryExchange, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {
@ -322,11 +322,11 @@ void onRspQryExchange(const dict &data, const dict &data, int reqid, bool last)
} }
}; };
void onRspQryInstrument(const dict &data, const dict &data, int reqid, bool last) override void onRspQryInstrument(const dict &data, const dict &error, int reqid, bool last) override
{ {
try try
{ {
PYBIND11_OVERLOAD(void, StockApi, onRspQryInstrument, data, data, reqid, last); PYBIND11_OVERLOAD(void, StockApi, onRspQryInstrument, data, error, reqid, last);
} }
catch (const error_already_set &e) catch (const error_already_set &e)
{ {

View File

@ -25,61 +25,61 @@ void StockApi::OnRspNeedVerify(bool bFirstLogin, bool bHasSetQA)
void StockApi::OnRspUserLogin(CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRspUserLogin(CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
{ {
gil_scoped_acquire acquire; gil_scoped_acquire acquire;
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspUserLogin(data, iRequestID, bIsLast); this->onRspUserLogin(error, iRequestID, bIsLast);
}; };
void StockApi::OnRspUserLogout(CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRspUserLogout(CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
{ {
gil_scoped_acquire acquire; gil_scoped_acquire acquire;
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspUserLogout(data, iRequestID, bIsLast); this->onRspUserLogout(error, iRequestID, bIsLast);
}; };
void StockApi::OnRspVerifyCode(CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRspVerifyCode(CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
{ {
gil_scoped_acquire acquire; gil_scoped_acquire acquire;
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspVerifyCode(data, iRequestID, bIsLast); this->onRspVerifyCode(error, iRequestID, bIsLast);
}; };
void StockApi::OnRspSafeVerify(CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRspSafeVerify(CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
{ {
gil_scoped_acquire acquire; gil_scoped_acquire acquire;
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspSafeVerify(data, iRequestID, bIsLast); this->onRspSafeVerify(error, iRequestID, bIsLast);
}; };
void StockApi::OnRspSetVerifyQA(CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRspSetVerifyQA(CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
{ {
gil_scoped_acquire acquire; gil_scoped_acquire acquire;
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspSetVerifyQA(data, iRequestID, bIsLast); this->onRspSetVerifyQA(error, iRequestID, bIsLast);
}; };
void StockApi::OnRspAccount(CStockRspAccountField *pRspAccount, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRspAccount(CStockRspAccountField *pRspAccount, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -135,13 +135,13 @@ void StockApi::OnRspAccount(CStockRspAccountField *pRspAccount, CStockRspInfoFie
data["CanTradeStockAU"] = toUtf(pRspAccount->CanTradeStockAU); data["CanTradeStockAU"] = toUtf(pRspAccount->CanTradeStockAU);
data["NyFlag"] = toUtf(pRspAccount->NyFlag); data["NyFlag"] = toUtf(pRspAccount->NyFlag);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspAccount(data, data, iRequestID, bIsLast); this->onRspAccount(data, error, iRequestID, bIsLast);
}; };
void StockApi::OnRspQuestion(CStockRspQuestionField *pRspQuestion, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRspQuestion(CStockRspQuestionField *pRspQuestion, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -155,13 +155,13 @@ void StockApi::OnRspQuestion(CStockRspQuestionField *pRspQuestion, CStockRspInfo
data["QuestionCN"] = toUtf(pRspQuestion->QuestionCN); data["QuestionCN"] = toUtf(pRspQuestion->QuestionCN);
data["QuestionEN"] = toUtf(pRspQuestion->QuestionEN); data["QuestionEN"] = toUtf(pRspQuestion->QuestionEN);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQuestion(data, data, iRequestID, bIsLast); this->onRspQuestion(data, error, iRequestID, bIsLast);
}; };
void StockApi::OnRspOrderInsert(CStockRspOrderInsertField *pRspOrderInsert, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRspOrderInsert(CStockRspOrderInsertField *pRspOrderInsert, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -203,13 +203,13 @@ void StockApi::OnRspOrderInsert(CStockRspOrderInsertField *pRspOrderInsert, CSto
data["ExchangeTime"] = toUtf(pRspOrderInsert->ExchangeTime); data["ExchangeTime"] = toUtf(pRspOrderInsert->ExchangeTime);
data["CancelTime"] = toUtf(pRspOrderInsert->CancelTime); data["CancelTime"] = toUtf(pRspOrderInsert->CancelTime);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspOrderInsert(data, data, iRequestID, bIsLast); this->onRspOrderInsert(data, error, iRequestID, bIsLast);
}; };
void StockApi::OnRspOrderModify(CStockRspOrderModifyField *pRspOrderModify, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRspOrderModify(CStockRspOrderModifyField *pRspOrderModify, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -251,13 +251,13 @@ void StockApi::OnRspOrderModify(CStockRspOrderModifyField *pRspOrderModify, CSto
data["ExchangeTime"] = toUtf(pRspOrderModify->ExchangeTime); data["ExchangeTime"] = toUtf(pRspOrderModify->ExchangeTime);
data["CancelTime"] = toUtf(pRspOrderModify->CancelTime); data["CancelTime"] = toUtf(pRspOrderModify->CancelTime);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspOrderModify(data, data, iRequestID, bIsLast); this->onRspOrderModify(data, error, iRequestID, bIsLast);
}; };
void StockApi::OnRspOrderCancel(CStockRspOrderCancelField *pRspOrderCancel, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRspOrderCancel(CStockRspOrderCancelField *pRspOrderCancel, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -287,13 +287,13 @@ void StockApi::OnRspOrderCancel(CStockRspOrderCancelField *pRspOrderCancel, CSto
data["ErrorCode"] = toUtf(pRspOrderCancel->ErrorCode); data["ErrorCode"] = toUtf(pRspOrderCancel->ErrorCode);
data["IsRiskOrder"] = toUtf(pRspOrderCancel->IsRiskOrder); data["IsRiskOrder"] = toUtf(pRspOrderCancel->IsRiskOrder);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspOrderCancel(data, data, iRequestID, bIsLast); this->onRspOrderCancel(data, error, iRequestID, bIsLast);
}; };
void StockApi::OnRspPasswordUpdate(CStockRspPasswordUpdateField *pRspPasswordUpdate, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRspPasswordUpdate(CStockRspPasswordUpdateField *pRspPasswordUpdate, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -306,13 +306,13 @@ void StockApi::OnRspPasswordUpdate(CStockRspPasswordUpdateField *pRspPasswordUpd
data["OldPassword"] = toUtf(pRspPasswordUpdate->OldPassword); data["OldPassword"] = toUtf(pRspPasswordUpdate->OldPassword);
data["NewPassword"] = toUtf(pRspPasswordUpdate->NewPassword); data["NewPassword"] = toUtf(pRspPasswordUpdate->NewPassword);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspPasswordUpdate(data, data, iRequestID, bIsLast); this->onRspPasswordUpdate(data, error, iRequestID, bIsLast);
}; };
void StockApi::OnRtnTrade(CStockRtnTradeField *pRtnTrade, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRtnTrade(CStockRtnTradeField *pRtnTrade, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -344,13 +344,13 @@ void StockApi::OnRtnTrade(CStockRtnTradeField *pRtnTrade, CStockRspInfoField *pR
data["AddReduce"] = toUtf(pRtnTrade->AddReduce); data["AddReduce"] = toUtf(pRtnTrade->AddReduce);
data["ErrorDescription"] = toUtf(pRtnTrade->ErrorDescription); data["ErrorDescription"] = toUtf(pRtnTrade->ErrorDescription);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRtnTrade(data, data, iRequestID, bIsLast); this->onRtnTrade(data, error, iRequestID, bIsLast);
}; };
void StockApi::OnRtnOrder(CStockRtnOrderField *pRtnOrder, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRtnOrder(CStockRtnOrderField *pRtnOrder, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -382,13 +382,13 @@ void StockApi::OnRtnOrder(CStockRtnOrderField *pRtnOrder, CStockRspInfoField *pR
data["CurrPrice"] = pRtnOrder->CurrPrice; data["CurrPrice"] = pRtnOrder->CurrPrice;
data["FloatProfit"] = pRtnOrder->FloatProfit; data["FloatProfit"] = pRtnOrder->FloatProfit;
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRtnOrder(data, data, iRequestID, bIsLast); this->onRtnOrder(data, error, iRequestID, bIsLast);
}; };
void StockApi::OnRtnCapital(CStockRtnCapitalField *pRtnCapital, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRtnCapital(CStockRtnCapitalField *pRtnCapital, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -444,13 +444,13 @@ void StockApi::OnRtnCapital(CStockRtnCapitalField *pRtnCapital, CStockRspInfoFie
data["SellInterest"] = pRtnCapital->SellInterest; data["SellInterest"] = pRtnCapital->SellInterest;
data["SellNeedAddMargin"] = pRtnCapital->SellNeedAddMargin; data["SellNeedAddMargin"] = pRtnCapital->SellNeedAddMargin;
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRtnCapital(data, data, iRequestID, bIsLast); this->onRtnCapital(data, error, iRequestID, bIsLast);
}; };
void StockApi::OnRtnPosition(CStockRtnPositionField *pRtnPosition, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRtnPosition(CStockRtnPositionField *pRtnPosition, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -483,13 +483,13 @@ void StockApi::OnRtnPosition(CStockRtnPositionField *pRtnPosition, CStockRspInfo
data["SellFrozenMoney"] = pRtnPosition->SellFrozenMoney; data["SellFrozenMoney"] = pRtnPosition->SellFrozenMoney;
data["OpenPrice"] = pRtnPosition->OpenPrice; data["OpenPrice"] = pRtnPosition->OpenPrice;
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRtnPosition(data, data, iRequestID, bIsLast); this->onRtnPosition(data, error, iRequestID, bIsLast);
}; };
void StockApi::OnRspQryTick(CStockRspTickField *pRspTick, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRspQryTick(CStockRspTickField *pRspTick, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -505,13 +505,13 @@ void StockApi::OnRspQryTick(CStockRspTickField *pRspTick, CStockRspInfoField *pR
data["DotNum"] = toUtf(pRspTick->DotNum); data["DotNum"] = toUtf(pRspTick->DotNum);
data["LowerTick"] = toUtf(pRspTick->LowerTick); data["LowerTick"] = toUtf(pRspTick->LowerTick);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryTick(data, data, iRequestID, bIsLast); this->onRspQryTick(data, error, iRequestID, bIsLast);
}; };
void StockApi::OnRspQryOrder(CStockRspOrderField *pRspOrder, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRspQryOrder(CStockRspOrderField *pRspOrder, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -553,13 +553,13 @@ void StockApi::OnRspQryOrder(CStockRspOrderField *pRspOrder, CStockRspInfoField
data["ExchangeTime"] = toUtf(pRspOrder->ExchangeTime); data["ExchangeTime"] = toUtf(pRspOrder->ExchangeTime);
data["CancelTime"] = toUtf(pRspOrder->CancelTime); data["CancelTime"] = toUtf(pRspOrder->CancelTime);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryOrder(data, data, iRequestID, bIsLast); this->onRspQryOrder(data, error, iRequestID, bIsLast);
}; };
void StockApi::OnRspQryTrade(CStockRspTradeField *pRspTrade, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRspQryTrade(CStockRspTradeField *pRspTrade, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -591,13 +591,13 @@ void StockApi::OnRspQryTrade(CStockRspTradeField *pRspTrade, CStockRspInfoField
data["AddReduce"] = toUtf(pRspTrade->AddReduce); data["AddReduce"] = toUtf(pRspTrade->AddReduce);
data["ErrorDescription"] = toUtf(pRspTrade->ErrorDescription); data["ErrorDescription"] = toUtf(pRspTrade->ErrorDescription);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryTrade(data, data, iRequestID, bIsLast); this->onRspQryTrade(data, error, iRequestID, bIsLast);
}; };
void StockApi::OnRspQryCapital(CStockRspCapitalField *pRspCapital, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRspQryCapital(CStockRspCapitalField *pRspCapital, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -649,13 +649,13 @@ void StockApi::OnRspQryCapital(CStockRspCapitalField *pRspCapital, CStockRspInfo
data["RiskRate"] = toUtf(pRspCapital->RiskRate); data["RiskRate"] = toUtf(pRspCapital->RiskRate);
data["ErrorDescription"] = toUtf(pRspCapital->ErrorDescription); data["ErrorDescription"] = toUtf(pRspCapital->ErrorDescription);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryCapital(data, data, iRequestID, bIsLast); this->onRspQryCapital(data, error, iRequestID, bIsLast);
}; };
void StockApi::OnRspQryVersion(CStockRspVersionField *pRspVersion, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRspQryVersion(CStockRspVersionField *pRspVersion, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -670,13 +670,13 @@ void StockApi::OnRspQryVersion(CStockRspVersionField *pRspVersion, CStockRspInfo
data["VersionContent_CN"] = toUtf(pRspVersion->VersionContent_CN); data["VersionContent_CN"] = toUtf(pRspVersion->VersionContent_CN);
data["VersionContent_US"] = toUtf(pRspVersion->VersionContent_US); data["VersionContent_US"] = toUtf(pRspVersion->VersionContent_US);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryVersion(data, data, iRequestID, bIsLast); this->onRspQryVersion(data, error, iRequestID, bIsLast);
}; };
void StockApi::OnRspQryPosition(CStockRspPositionField *pRspPosition, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRspQryPosition(CStockRspPositionField *pRspPosition, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -709,13 +709,13 @@ void StockApi::OnRspQryPosition(CStockRspPositionField *pRspPosition, CStockRspI
data["SellFrozenMoney"] = pRspPosition->SellFrozenMoney; data["SellFrozenMoney"] = pRspPosition->SellFrozenMoney;
data["OpenPrice"] = pRspPosition->OpenPrice; data["OpenPrice"] = pRspPosition->OpenPrice;
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryPosition(data, data, iRequestID, bIsLast); this->onRspQryPosition(data, error, iRequestID, bIsLast);
}; };
void StockApi::OnRspQryCurrency(CStockRspCurrencyField *pRspCurrency, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRspQryCurrency(CStockRspCurrencyField *pRspCurrency, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -730,13 +730,13 @@ void StockApi::OnRspQryCurrency(CStockRspCurrencyField *pRspCurrency, CStockRspI
data["CurrencyName"] = toUtf(pRspCurrency->CurrencyName); data["CurrencyName"] = toUtf(pRspCurrency->CurrencyName);
data["CurrencyNameEN"] = toUtf(pRspCurrency->CurrencyNameEN); data["CurrencyNameEN"] = toUtf(pRspCurrency->CurrencyNameEN);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryCurrency(data, data, iRequestID, bIsLast); this->onRspQryCurrency(data, error, iRequestID, bIsLast);
}; };
void StockApi::OnRspQryExchange(CStockRspExchangeField *pRspExchange, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRspQryExchange(CStockRspExchangeField *pRspExchange, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -750,13 +750,13 @@ void StockApi::OnRspQryExchange(CStockRspExchangeField *pRspExchange, CStockRspI
data["SettleType"] = toUtf(pRspExchange->SettleType); data["SettleType"] = toUtf(pRspExchange->SettleType);
data["NameEN"] = toUtf(pRspExchange->NameEN); data["NameEN"] = toUtf(pRspExchange->NameEN);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryExchange(data, data, iRequestID, bIsLast); this->onRspQryExchange(data, error, iRequestID, bIsLast);
}; };
void StockApi::OnRspQryInstrument(CStockRspInstrumentField *pRspInstrument, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast) void StockApi::OnRspQryInstrument(CStockRspInstrumentField *pRspInstrument, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast)
@ -815,12 +815,12 @@ void StockApi::OnRspQryInstrument(CStockRspInstrumentField *pRspInstrument, CSto
data["CallPutFlag"] = toUtf(pRspInstrument->CallPutFlag); data["CallPutFlag"] = toUtf(pRspInstrument->CallPutFlag);
data["Publisher"] = toUtf(pRspInstrument->Publisher); data["Publisher"] = toUtf(pRspInstrument->Publisher);
} }
dict data; dict error;
if (pRspInfo) if (pRspInfo)
{ {
data["ErrorID"] = pRspInfo->ErrorID; error["ErrorID"] = pRspInfo->ErrorID;
data["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg); error["ErrorMsg"] = toUtf(pRspInfo->ErrorMsg);
} }
this->onRspQryInstrument(data, data, iRequestID, bIsLast); this->onRspQryInstrument(data, error, iRequestID, bIsLast);
}; };

View File

@ -103,7 +103,7 @@ class ApiGenerator:
args_list.append("int reqid") args_list.append("int reqid")
elif type_ == "bool": elif type_ == "bool":
args_list.append("bool last") args_list.append("bool last")
elif type_ == "CMarketRspInfoField": elif "RspInfoField" in type_:
args_list.append("const dict &error") args_list.append("const dict &error")
else: else:
args_list.append("const dict &data") args_list.append("const dict &data")
@ -143,7 +143,7 @@ class ApiGenerator:
args.append(field) args.append(field)
elif type_ == "char*": elif type_ == "char*":
args.append(f"string({field})") args.append(f"string({field})")
elif type_ == "CMarketRspInfoField": elif "RspInfoField" in type_:
args.append("error") args.append("error")
f.write("\tdict error;\n") f.write("\tdict error;\n")
@ -220,7 +220,7 @@ class ApiGenerator:
elif type_ == "bool": elif type_ == "bool":
args.append("bool last") args.append("bool last")
bind_args.append("last") bind_args.append("last")
elif type_ == "CMarketRspInfoField": elif "RspInfoField" in type_:
args.append("const dict &error") args.append("const dict &error")
bind_args.append("error") bind_args.append("error")
else: else:

View File

@ -0,0 +1,207 @@
//系统
#ifdef WIN32
#include "stdafx.h"
#endif
#include <string>
#include "vnda.h"
#include "pybind11/pybind11.h"
#include "da/DAFutureApi.h"
using namespace pybind11;
using namespace std;
///-------------------------------------------------------------------------------------
///C++ SPI的回调函数方法实现
///-------------------------------------------------------------------------------------
//API的继承实现
class FutureApi : public IFutureEvent
{
private:
CFutureApi* api; //API对象
public:
FutureApi()
{
};
~FutureApi()
{
};
//-------------------------------------------------------------------------------------
//API回调函数
//-------------------------------------------------------------------------------------
void OnFrontConnected();
void OnFrontDisconnected(int iReason);
void OnHeartBeatWarning(int iTimeLapse);
void OnRspNeedVerify(bool bFirstLogin, bool bHasSetQA);
void OnRspUserLogin(CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspUserLogout(CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspVerifyCode(CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspSafeVerify(CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspSetVerifyQA(CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspAccount(CFutureRspAccountField *pRspAccount, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQuestion(CFutureRspQuestionField *pRspVersion, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspOrderInsert(CFutureRspOrderInsertField *pRspOrderInsert, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspOrderModify(CFutureRspOrderModifyField *pRspOrderModify, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspOrderCancel(CFutureRspOrderCancelField *pRspOrderCancel, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspPasswordUpdate(CFutureRspPasswordUpdateField *pRspPasswordUpdate, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRtnTrade(CFutureRtnTradeField *pRtnTrade, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRtnOrder(CFutureRtnOrderField *pRtnOrder, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRtnCapital(CFutureRtnCapitalField *pRtnCapital, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRtnPosition(CFutureRtnPositionField *pRtnPosition, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryOrder(CFutureRspOrderField *pRspOrder, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryTrade(CFutureRspTradeField *pRspTrade, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryCapital(CFutureRspCapitalField *pRspCapital, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryVersion(CFutureRspVersionField *pRspVersion, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryPosition(CFutureRspPositionField *pRspPosition, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryCurrency(CFutureRspCurrencyField *pRspCurrency, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryExchange(CFutureRspExchangeField *pRspExchange, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryStrategy(CFutureRspStrategyField *pRspStrategy, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryCommodity(CFutureRspCommodityField *pRspCommodity, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryInstrument(CFutureRspInstrumentField *pRspInstrument, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryExchangeTime(CFutureRspExchangeTimeField *pRspExchangeTime, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryCommodityTime(CFutureRspCommodityTimeField *pRspCommodityTime, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryTotalPosition(CFutureRspTotalPositionField *pRspTotalPosition, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryStrategyDetail(CFutureRspStrategyDetailField *pRspStrategyDetail, CFutureRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
//-------------------------------------------------------------------------------------
//Python回调函数
//-------------------------------------------------------------------------------------
virtual void onFrontConnected() {};
virtual void onFrontDisconnected(int reqid) {};
virtual void onHeartBeatWarning(int reqid) {};
virtual void onRspNeedVerify(bool firstLogin, bool hasSetQA) {};
virtual void onRspUserLogin(const dict &error, int reqid, bool last) {};
virtual void onRspUserLogout(const dict &error, int reqid, bool last) {};
virtual void onRspVerifyCode(const dict &error, int reqid, bool last) {};
virtual void onRspSafeVerify(const dict &error, int reqid, bool last) {};
virtual void onRspSetVerifyQA(const dict &error, int reqid, bool last) {};
virtual void onRspAccount(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQuestion(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspOrderInsert(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspOrderModify(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspOrderCancel(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspPasswordUpdate(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRtnTrade(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRtnOrder(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRtnCapital(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRtnPosition(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryOrder(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryTrade(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryCapital(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryVersion(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryPosition(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryCurrency(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryExchange(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryStrategy(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryCommodity(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryInstrument(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryExchangeTime(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryCommodityTime(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryTotalPosition(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryStrategyDetail(const dict &data, const dict &error, int reqid, bool last) {};
//-------------------------------------------------------------------------------------
//req:主动函数的请求字典
//-------------------------------------------------------------------------------------
string getVersion();
void createFutureApi(bool recordLog, string logFileName);
void init();
void release();
int exit();
void setHeartbeatTimeout(int timeout);
void registerNameServer(string address);
int reqUserLogin(const dict &req, int reqid);
int reqUserLogout(const dict &req, int reqid);
int reqSafeVerify(const dict &req, int reqid);
int reqVerifyCode(const dict &req, int reqid);
int reqSetVerifyQA(const dict &req, int reqid);
int reqGetQuestion(const dict &req, int reqid);
int reqOrderInsert(const dict &req, int reqid);
int reqOrderModify(const dict &req, int reqid);
int reqOrderCancel(const dict &req, int reqid);
int reqPasswordUpdate(const dict &req, int reqid);
int reqQryOrder(const dict &req, int reqid);
int reqQryTrade(const dict &req, int reqid);
int reqQryCapital(const dict &req, int reqid);
int reqQryVersion(const dict &req, int reqid);
int reqQryCurrency(const dict &req, int reqid);
int reqQryExchange(const dict &req, int reqid);
int reqQryPosition(const dict &req, int reqid);
int reqQryStrategy(const dict &req, int reqid);
int reqQryCommodity(const dict &req, int reqid);
int reqQryInstrument(const dict &req, int reqid);
int reqQryExchangeTime(const dict &req, int reqid);
int reqQryCommodityTime(const dict &req, int reqid);
int reqQryTotalPosition(const dict &req, int reqid);
int reqQryStrategyDetail(const dict &req, int reqid);
};

View File

@ -81,6 +81,10 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)..\</OutDir>
<TargetExt>.pyd</TargetExt>
<IncludePath>C:\Miniconda3\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\da;$(IncludePath)</IncludePath>
<LibraryPath>C:\Miniconda3\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
@ -136,22 +140,27 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;VNDAFUTURE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NOMINMAX;_CRT_SECURE_NO_WARNINGS;NDEBUG;VNDAFUTURE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>C:\GitHub\vnpy\vnpy\api\da\libs;C:\Miniconda3\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>DAApi_x64.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\include\da\DADataType.h" /> <ClInclude Include="..\..\include\da\DADataType.h" />
<ClInclude Include="..\..\include\da\DAFutureApi.h" /> <ClInclude Include="..\..\include\da\DAFutureApi.h" />
<ClInclude Include="..\..\include\da\DAFutureStruct.h" /> <ClInclude Include="..\..\include\da\DAFutureStruct.h" />
<ClInclude Include="..\vnda.h" />
<ClInclude Include="stdafx.h" /> <ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" /> <ClInclude Include="targetver.h" />
<ClInclude Include="vndafuture.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="dllmain.cpp" /> <ClCompile Include="dllmain.cpp" />

View File

@ -30,6 +30,12 @@
<ClInclude Include="..\..\include\da\DAFutureApi.h"> <ClInclude Include="..\..\include\da\DAFutureApi.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\vnda.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="vndafuture.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="stdafx.cpp"> <ClCompile Include="stdafx.cpp">

View File

@ -42,7 +42,7 @@ public:
void OnRspRawData(const char* rawData); void OnRspRawData(const char* rawData);
void OnRspUserLogin(CMarketRspInfoField *pRspInfo, int iRequestID, bool bIsLast); void OnRspUserLogin(CMarketRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspTradeDate(CMarketRspTradeDateField *pRspTradeDate, CMarketRspInfoField *pRspInfo, int iRequestID, bool bIsLast); void OnRspTradeDate(CMarketRspTradeDateField *pRspTradeDate, CMarketRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspBrokerData(CMarketRspBrokerDataField *pRspBrokerData, CMarketRspInfoField *pRspInfo, int iRequestID, bool bIsLast); void OnRspBrokerData(CMarketRspBrokerDataField *pRspBrokerData, CMarketRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspMarketData(CMarketRspMarketDataField *pRspMarketData, CMarketRspInfoField *pRspInfo, int iRequestID, bool bIsLast); void OnRspMarketData(CMarketRspMarketDataField *pRspMarketData, CMarketRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------

View File

@ -0,0 +1,183 @@
//系统
#ifdef WIN32
#include "stdafx.h"
#endif
#include <string>
#include "vnda.h"
#include "pybind11/pybind11.h"
#include "da/DAStockApi.h"
using namespace pybind11;
using namespace std;
///-------------------------------------------------------------------------------------
///C++ SPI的回调函数方法实现
///-------------------------------------------------------------------------------------
//API的继承实现
class StockApi : public IStockEvent
{
private:
CStockApi* api; //API对象
public:
StockApi()
{
};
~StockApi()
{
};
//-------------------------------------------------------------------------------------
//API回调函数
//-------------------------------------------------------------------------------------
void OnFrontConnected();
void OnFrontDisconnected(int iReason);
void OnHeartBeatWarning(int iTimeLapse);
void OnRspNeedVerify(bool bFirstLogin, bool bHasSetQA);
void OnRspUserLogin(CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspUserLogout(CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspVerifyCode(CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspSafeVerify(CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspSetVerifyQA(CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspAccount(CStockRspAccountField *pRspAccount, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQuestion(CStockRspQuestionField *pRspQuestion, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspOrderInsert(CStockRspOrderInsertField *pRspOrderInsert, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspOrderModify(CStockRspOrderModifyField *pRspOrderModify, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspOrderCancel(CStockRspOrderCancelField *pRspOrderCancel, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspPasswordUpdate(CStockRspPasswordUpdateField *pRspPasswordUpdate, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRtnTrade(CStockRtnTradeField *pRtnTrade, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRtnOrder(CStockRtnOrderField *pRtnOrder, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRtnCapital(CStockRtnCapitalField *pRtnCapital, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRtnPosition(CStockRtnPositionField *pRtnPosition, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryTick(CStockRspTickField *pRspTick, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryOrder(CStockRspOrderField *pRspOrder, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryTrade(CStockRspTradeField *pRspTrade, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryCapital(CStockRspCapitalField *pRspCapital, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryVersion(CStockRspVersionField *pRspVersion, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryPosition(CStockRspPositionField *pRspPosition, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryCurrency(CStockRspCurrencyField *pRspCurrency, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryExchange(CStockRspExchangeField *pRspExchange, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
void OnRspQryInstrument(CStockRspInstrumentField *pRspInstrument, CStockRspInfoField *pRspInfo, int iRequestID, bool bIsLast);
//-------------------------------------------------------------------------------------
//Python回调函数
//-------------------------------------------------------------------------------------
virtual void onFrontConnected() {};
virtual void onFrontDisconnected(int reqid) {};
virtual void onHeartBeatWarning(int reqid) {};
virtual void onRspNeedVerify(bool firstLogin, bool hasSetQA) {};
virtual void onRspUserLogin(const dict &error, int reqid, bool last) {};
virtual void onRspUserLogout(const dict &error, int reqid, bool last) {};
virtual void onRspVerifyCode(const dict &error, int reqid, bool last) {};
virtual void onRspSafeVerify(const dict &error, int reqid, bool last) {};
virtual void onRspSetVerifyQA(const dict &error, int reqid, bool last) {};
virtual void onRspAccount(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQuestion(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspOrderInsert(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspOrderModify(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspOrderCancel(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspPasswordUpdate(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRtnTrade(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRtnOrder(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRtnCapital(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRtnPosition(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryTick(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryOrder(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryTrade(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryCapital(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryVersion(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryPosition(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryCurrency(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryExchange(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryInstrument(const dict &data, const dict &error, int reqid, bool last) {};
//-------------------------------------------------------------------------------------
//req:主动函数的请求字典
//-------------------------------------------------------------------------------------
string getVersion();
void createStockApi(bool recordLog, string logFileName);
void init();
void release();
int exit();
void setHeartbeatTimeout(int timeout);
void registerNameServer(string address);
int reqUserLogin(const dict &req, int reqid);
int reqUserLogout(const dict &req, int reqid);
int reqSafeVerify(const dict &req, int reqid);
int reqVerifyCode(const dict &req, int reqid);
int reqSetVerifyQA(const dict &req, int reqid);
int reqGetQuestion(const dict &req, int reqid);
int reqOrderInsert(const dict &req, int reqid);
int reqOrderModify(const dict &req, int reqid);
int reqOrderCancel(const dict &req, int reqid);
int reqPasswordUpdate(const dict &req, int reqid);
int reqQryTick(const dict &req, int reqid);
int reqQryOrder(const dict &req, int reqid);
int reqQryTrade(const dict &req, int reqid);
int reqQryCapital(const dict &req, int reqid);
int reqQryVersion(const dict &req, int reqid);
int reqQryPosition(const dict &req, int reqid);
int reqQryCurrency(const dict &req, int reqid);
int reqQryExchange(const dict &req, int reqid);
int reqQryInstrument(const dict &req, int reqid);
};

View File

@ -81,6 +81,10 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<TargetExt>.pyd</TargetExt>
<OutDir>$(SolutionDir)..\</OutDir>
<IncludePath>C:\Miniconda3\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\da;$(IncludePath)</IncludePath>
<LibraryPath>C:\Miniconda3\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
@ -136,22 +140,27 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;VNDASTOCK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NOMINMAX;_CRT_SECURE_NO_WARNINGS;NDEBUG;VNDASTOCK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>C:\GitHub\vnpy\vnpy\api\da\libs;C:\Miniconda3\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>DAApi_x64.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\include\da\DADataType.h" /> <ClInclude Include="..\..\include\da\DADataType.h" />
<ClInclude Include="..\..\include\da\DAStockApi.h" /> <ClInclude Include="..\..\include\da\DAStockApi.h" />
<ClInclude Include="..\..\include\da\DAStockStruct.h" /> <ClInclude Include="..\..\include\da\DAStockStruct.h" />
<ClInclude Include="..\vnda.h" />
<ClInclude Include="stdafx.h" /> <ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" /> <ClInclude Include="targetver.h" />
<ClInclude Include="vndastock.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="dllmain.cpp" /> <ClCompile Include="dllmain.cpp" />

View File

@ -30,6 +30,12 @@
<ClInclude Include="..\..\include\da\DADataType.h"> <ClInclude Include="..\..\include\da\DADataType.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\vnda.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="vndastock.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="stdafx.cpp"> <ClCompile Include="stdafx.cpp">

BIN
vnpy/api/da/vndafuture.pyd Normal file

Binary file not shown.

BIN
vnpy/api/da/vndastock.pyd Normal file

Binary file not shown.