将vn.lts的td api中部分原本手工修改的代码改为自动生成,用于防止空指针的问题
This commit is contained in:
parent
5ece1a7f36
commit
bf874016cb
3
.gitignore
vendored
3
.gitignore
vendored
@ -23,3 +23,6 @@ Release/
|
|||||||
|
|
||||||
# API的.con文件
|
# API的.con文件
|
||||||
*.con
|
*.con
|
||||||
|
|
||||||
|
# visual studio
|
||||||
|
*.opensdf
|
@ -35,6 +35,65 @@ def processCallBack(line):
|
|||||||
createTask(cbName, cbArgsTypeList, cbArgsValueList, orignalLine)
|
createTask(cbName, cbArgsTypeList, cbArgsValueList, orignalLine)
|
||||||
createProcess(cbName, cbArgsTypeList, cbArgsValueList)
|
createProcess(cbName, cbArgsTypeList, cbArgsValueList)
|
||||||
|
|
||||||
|
# 生成.h文件中的process部分
|
||||||
|
process_line = 'void process' + cbName[2:] + '(Task task);\n'
|
||||||
|
fheaderprocess.write(process_line)
|
||||||
|
fheaderprocess.write('\n')
|
||||||
|
|
||||||
|
# 生成.h文件中的on部分
|
||||||
|
if 'OnRspError' in cbName:
|
||||||
|
on_line = 'virtual void on' + cbName[2:] + '(dict error, int id, bool last) {};\n'
|
||||||
|
elif 'OnRsp' in cbName:
|
||||||
|
on_line = 'virtual void on' + cbName[2:] + '(dict data, dict error, int id, bool last) {};\n'
|
||||||
|
elif 'OnRtn' in cbName:
|
||||||
|
on_line = 'virtual void on' + cbName[2:] + '(dict data) {};\n'
|
||||||
|
elif 'OnErrRtn' in cbName:
|
||||||
|
on_line = 'virtual void on' + cbName[2:] + '(dict data, dict error) {};\n'
|
||||||
|
else:
|
||||||
|
on_line = ''
|
||||||
|
fheaderon.write(on_line)
|
||||||
|
fheaderon.write('\n')
|
||||||
|
|
||||||
|
# 生成封装部分
|
||||||
|
createWrap(cbName)
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
def createWrap(cbName):
|
||||||
|
"""在Python封装段代码中进行处理"""
|
||||||
|
# 生成.h文件中的on部分
|
||||||
|
if 'OnRspError' in cbName:
|
||||||
|
on_line = 'virtual void on' + cbName[2:] + '(dict error, int id, bool last)\n'
|
||||||
|
override_line = '("on' + cbName[2:] + '")(error, id, last);\n'
|
||||||
|
elif 'OnRsp' in cbName:
|
||||||
|
on_line = 'virtual void on' + cbName[2:] + '(dict data, dict error, int id, bool last)\n'
|
||||||
|
override_line = '("on' + cbName[2:] + '")(data, error, id, last);\n'
|
||||||
|
elif 'OnRtn' in cbName:
|
||||||
|
on_line = 'virtual void on' + cbName[2:] + '(dict data)\n'
|
||||||
|
override_line = '("on' + cbName[2:] + '")(data);\n'
|
||||||
|
elif 'OnErrRtn' in cbName:
|
||||||
|
on_line = 'virtual void on' + cbName[2:] + '(dict data, dict error)\n'
|
||||||
|
override_line = '("on' + cbName[2:] + '")(data, error);\n'
|
||||||
|
else:
|
||||||
|
on_line = ''
|
||||||
|
|
||||||
|
if on_line is not '':
|
||||||
|
fwrap.write(on_line)
|
||||||
|
fwrap.write('{\n')
|
||||||
|
fwrap.write('\t PyLock lock;\n')
|
||||||
|
fwrap.write('\n')
|
||||||
|
fwrap.write('\ttry\n')
|
||||||
|
fwrap.write('\t{\n')
|
||||||
|
fwrap.write('\t\tthis->get_override'+override_line)
|
||||||
|
fwrap.write('\t}\n')
|
||||||
|
fwrap.write('\tcatch (error_already_set const &)\n')
|
||||||
|
fwrap.write('\t{\n')
|
||||||
|
fwrap.write('\t\tPyErr_Print();\n')
|
||||||
|
fwrap.write('\t}\n')
|
||||||
|
fwrap.write('};\n')
|
||||||
|
fwrap.write('\n')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def createTask(cbName, cbArgsTypeList, cbArgsValueList, orignalLine):
|
def createTask(cbName, cbArgsTypeList, cbArgsValueList, orignalLine):
|
||||||
# 从回调函数生成任务对象,并放入队列
|
# 从回调函数生成任务对象,并放入队列
|
||||||
@ -66,6 +125,7 @@ def createTask(cbName, cbArgsTypeList, cbArgsValueList, orignalLine):
|
|||||||
elif type_ == 'bool':
|
elif type_ == 'bool':
|
||||||
ftask.write("\ttask.task_last = " + cbArgsValueList[i] + ";\n")
|
ftask.write("\ttask.task_last = " + cbArgsValueList[i] + ";\n")
|
||||||
elif 'RspInfoField' in type_:
|
elif 'RspInfoField' in type_:
|
||||||
|
ftask.write("\n")
|
||||||
ftask.write("\tif (pRspInfo)\n")
|
ftask.write("\tif (pRspInfo)\n")
|
||||||
ftask.write("\t{\n")
|
ftask.write("\t{\n")
|
||||||
ftask.write("\t\ttask.task_error = " + cbArgsValueList[i] + ";\n")
|
ftask.write("\t\ttask.task_error = " + cbArgsValueList[i] + ";\n")
|
||||||
@ -77,7 +137,17 @@ def createTask(cbName, cbArgsTypeList, cbArgsValueList, orignalLine):
|
|||||||
ftask.write("\t\ttask.task_error = empty_error;\n")
|
ftask.write("\t\ttask.task_error = empty_error;\n")
|
||||||
ftask.write("\t}\n")
|
ftask.write("\t}\n")
|
||||||
else:
|
else:
|
||||||
ftask.write("\ttask.task_data = " + cbArgsValueList[i] + ";\n")
|
ftask.write("\n")
|
||||||
|
ftask.write("\tif (" + cbArgsValueList[i][1:] + ")\n")
|
||||||
|
ftask.write("\t{\n")
|
||||||
|
ftask.write("\t\ttask.task_data = " + cbArgsValueList[i] + ";\n")
|
||||||
|
ftask.write("\t}\n")
|
||||||
|
ftask.write("\telse\n")
|
||||||
|
ftask.write("\t{\n")
|
||||||
|
ftask.write("\t\t" + type_ + " empty_data = " + type_ + "();\n")
|
||||||
|
ftask.write("\t\tmemset(&empty_data, 0, sizeof(empty_data));\n")
|
||||||
|
ftask.write("\t\ttask.task_data = empty_data;\n")
|
||||||
|
ftask.write("\t}\n")
|
||||||
|
|
||||||
ftask.write("\tthis->task_queue.push(task);\n")
|
ftask.write("\tthis->task_queue.push(task);\n")
|
||||||
ftask.write("};\n")
|
ftask.write("};\n")
|
||||||
@ -153,12 +223,18 @@ def processFunction(line):
|
|||||||
if len(fcArgsTypeList)>0 and fcArgsTypeList[0] in structDict:
|
if len(fcArgsTypeList)>0 and fcArgsTypeList[0] in structDict:
|
||||||
createFunction(fcName, fcArgsTypeList, fcArgsValueList)
|
createFunction(fcName, fcArgsTypeList, fcArgsValueList)
|
||||||
|
|
||||||
|
# 生成.h文件中的主动函数部分
|
||||||
|
if 'Req' in fcName:
|
||||||
|
req_line = 'int req' + fcName[3:] + '(dict req, int nRequestID);\n'
|
||||||
|
fheaderfunction.write(req_line)
|
||||||
|
fheaderfunction.write('\n')
|
||||||
|
|
||||||
|
|
||||||
def createFunction(fcName, fcArgsTypeList, fcArgsValueList):
|
def createFunction(fcName, fcArgsTypeList, fcArgsValueList):
|
||||||
type_ = fcArgsTypeList[0]
|
type_ = fcArgsTypeList[0]
|
||||||
struct = structDict[type_]
|
struct = structDict[type_]
|
||||||
|
|
||||||
ffunction.write(fcName + '\n')
|
ffunction.write('int TdApi::req' + fcName[3:] + '(dict req, int nRequestID)\n')
|
||||||
ffunction.write('{\n')
|
ffunction.write('{\n')
|
||||||
ffunction.write('\t' + type_ +' myreq = ' + type_ + '();\n')
|
ffunction.write('\t' + type_ +' myreq = ' + type_ + '();\n')
|
||||||
ffunction.write('\tmemset(&myreq, 0, sizeof(myreq));\n')
|
ffunction.write('\tmemset(&myreq, 0, sizeof(myreq));\n')
|
||||||
@ -190,6 +266,10 @@ fprocess = open('lts_td_process.cpp', 'w')
|
|||||||
ffunction = open('lts_td_function.cpp', 'w')
|
ffunction = open('lts_td_function.cpp', 'w')
|
||||||
fdefine = open('lts_td_define.cpp', 'w')
|
fdefine = open('lts_td_define.cpp', 'w')
|
||||||
fswitch = open('lts_td_switch.cpp', 'w')
|
fswitch = open('lts_td_switch.cpp', 'w')
|
||||||
|
fheaderprocess = open('lts_td_header_process.h', 'w')
|
||||||
|
fheaderon = open('lts_td_header_on.h', 'w')
|
||||||
|
fheaderfunction = open('lts_td_header_function.h', 'w')
|
||||||
|
fwrap = open('lts_td_wrap.cpp', 'w')
|
||||||
|
|
||||||
define_count = 1
|
define_count = 1
|
||||||
|
|
||||||
@ -205,3 +285,7 @@ fprocess.close()
|
|||||||
ffunction.close()
|
ffunction.close()
|
||||||
fswitch.close()
|
fswitch.close()
|
||||||
fdefine.close()
|
fdefine.close()
|
||||||
|
fheaderprocess.close()
|
||||||
|
fheaderon.close()
|
||||||
|
fheaderfunction.close()
|
||||||
|
fwrap.close()
|
@ -1,4 +1,4 @@
|
|||||||
ReqUserLogin
|
int TdApi::reqUserLogin(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcReqUserLoginField myreq = CSecurityFtdcReqUserLoginField();
|
CSecurityFtdcReqUserLoginField myreq = CSecurityFtdcReqUserLoginField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -17,7 +17,7 @@ ReqUserLogin
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqUserLogout
|
int TdApi::reqUserLogout(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcUserLogoutField myreq = CSecurityFtdcUserLogoutField();
|
CSecurityFtdcUserLogoutField myreq = CSecurityFtdcUserLogoutField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -27,7 +27,7 @@ ReqUserLogout
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqOrderInsert
|
int TdApi::reqOrderInsert(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcInputOrderField myreq = CSecurityFtdcInputOrderField();
|
CSecurityFtdcInputOrderField myreq = CSecurityFtdcInputOrderField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -58,7 +58,7 @@ ReqOrderInsert
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqOrderAction
|
int TdApi::reqOrderAction(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcInputOrderActionField myreq = CSecurityFtdcInputOrderActionField();
|
CSecurityFtdcInputOrderActionField myreq = CSecurityFtdcInputOrderActionField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -81,7 +81,7 @@ ReqOrderAction
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqUserPasswordUpdate
|
int TdApi::reqUserPasswordUpdate(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcUserPasswordUpdateField myreq = CSecurityFtdcUserPasswordUpdateField();
|
CSecurityFtdcUserPasswordUpdateField myreq = CSecurityFtdcUserPasswordUpdateField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -93,7 +93,7 @@ ReqUserPasswordUpdate
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqTradingAccountPasswordUpdate
|
int TdApi::reqTradingAccountPasswordUpdate(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcTradingAccountPasswordUpdateField myreq = CSecurityFtdcTradingAccountPasswordUpdateField();
|
CSecurityFtdcTradingAccountPasswordUpdateField myreq = CSecurityFtdcTradingAccountPasswordUpdateField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -105,7 +105,7 @@ ReqTradingAccountPasswordUpdate
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqQryExchange
|
int TdApi::reqQryExchange(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcQryExchangeField myreq = CSecurityFtdcQryExchangeField();
|
CSecurityFtdcQryExchangeField myreq = CSecurityFtdcQryExchangeField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -114,7 +114,7 @@ ReqQryExchange
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqQryInstrument
|
int TdApi::reqQryInstrument(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcQryInstrumentField myreq = CSecurityFtdcQryInstrumentField();
|
CSecurityFtdcQryInstrumentField myreq = CSecurityFtdcQryInstrumentField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -126,7 +126,7 @@ ReqQryInstrument
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqQryInvestor
|
int TdApi::reqQryInvestor(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcQryInvestorField myreq = CSecurityFtdcQryInvestorField();
|
CSecurityFtdcQryInvestorField myreq = CSecurityFtdcQryInvestorField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -136,7 +136,7 @@ ReqQryInvestor
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqQryTradingCode
|
int TdApi::reqQryTradingCode(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcQryTradingCodeField myreq = CSecurityFtdcQryTradingCodeField();
|
CSecurityFtdcQryTradingCodeField myreq = CSecurityFtdcQryTradingCodeField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -148,7 +148,7 @@ ReqQryTradingCode
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqQryTradingAccount
|
int TdApi::reqQryTradingAccount(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcQryTradingAccountField myreq = CSecurityFtdcQryTradingAccountField();
|
CSecurityFtdcQryTradingAccountField myreq = CSecurityFtdcQryTradingAccountField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -158,7 +158,7 @@ ReqQryTradingAccount
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqQryDepthMarketData
|
int TdApi::reqQryDepthMarketData(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcQryDepthMarketDataField myreq = CSecurityFtdcQryDepthMarketDataField();
|
CSecurityFtdcQryDepthMarketDataField myreq = CSecurityFtdcQryDepthMarketDataField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -167,7 +167,7 @@ ReqQryDepthMarketData
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqQryBondInterest
|
int TdApi::reqQryBondInterest(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcQryBondInterestField myreq = CSecurityFtdcQryBondInterestField();
|
CSecurityFtdcQryBondInterestField myreq = CSecurityFtdcQryBondInterestField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -177,7 +177,7 @@ ReqQryBondInterest
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqQryMarketRationInfo
|
int TdApi::reqQryMarketRationInfo(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcQryMarketRationInfoField myreq = CSecurityFtdcQryMarketRationInfoField();
|
CSecurityFtdcQryMarketRationInfoField myreq = CSecurityFtdcQryMarketRationInfoField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -188,7 +188,7 @@ ReqQryMarketRationInfo
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqQryInstrumentCommissionRate
|
int TdApi::reqQryInstrumentCommissionRate(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcQryInstrumentCommissionRateField myreq = CSecurityFtdcQryInstrumentCommissionRateField();
|
CSecurityFtdcQryInstrumentCommissionRateField myreq = CSecurityFtdcQryInstrumentCommissionRateField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -202,7 +202,7 @@ ReqQryInstrumentCommissionRate
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqQryETFInstrument
|
int TdApi::reqQryETFInstrument(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcQryETFInstrumentField myreq = CSecurityFtdcQryETFInstrumentField();
|
CSecurityFtdcQryETFInstrumentField myreq = CSecurityFtdcQryETFInstrumentField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -212,7 +212,7 @@ ReqQryETFInstrument
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqQryETFBasket
|
int TdApi::reqQryETFBasket(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcQryETFBasketField myreq = CSecurityFtdcQryETFBasketField();
|
CSecurityFtdcQryETFBasketField myreq = CSecurityFtdcQryETFBasketField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -222,7 +222,7 @@ ReqQryETFBasket
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqQryOFInstrument
|
int TdApi::reqQryOFInstrument(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcQryOFInstrumentField myreq = CSecurityFtdcQryOFInstrumentField();
|
CSecurityFtdcQryOFInstrumentField myreq = CSecurityFtdcQryOFInstrumentField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -232,7 +232,7 @@ ReqQryOFInstrument
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqQrySFInstrument
|
int TdApi::reqQrySFInstrument(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcQrySFInstrumentField myreq = CSecurityFtdcQrySFInstrumentField();
|
CSecurityFtdcQrySFInstrumentField myreq = CSecurityFtdcQrySFInstrumentField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -242,7 +242,7 @@ ReqQrySFInstrument
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqQryOrder
|
int TdApi::reqQryOrder(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcQryOrderField myreq = CSecurityFtdcQryOrderField();
|
CSecurityFtdcQryOrderField myreq = CSecurityFtdcQryOrderField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -257,7 +257,7 @@ ReqQryOrder
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqQryTrade
|
int TdApi::reqQryTrade(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcQryTradeField myreq = CSecurityFtdcQryTradeField();
|
CSecurityFtdcQryTradeField myreq = CSecurityFtdcQryTradeField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -272,7 +272,7 @@ ReqQryTrade
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqQryInvestorPosition
|
int TdApi::reqQryInvestorPosition(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcQryInvestorPositionField myreq = CSecurityFtdcQryInvestorPositionField();
|
CSecurityFtdcQryInvestorPositionField myreq = CSecurityFtdcQryInvestorPositionField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -283,7 +283,7 @@ ReqQryInvestorPosition
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqFundOutByLiber
|
int TdApi::reqFundOutByLiber(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcInputFundTransferField myreq = CSecurityFtdcInputFundTransferField();
|
CSecurityFtdcInputFundTransferField myreq = CSecurityFtdcInputFundTransferField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -299,7 +299,7 @@ ReqFundOutByLiber
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqQryFundTransferSerial
|
int TdApi::reqQryFundTransferSerial(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcQryFundTransferSerialField myreq = CSecurityFtdcQryFundTransferSerialField();
|
CSecurityFtdcQryFundTransferSerialField myreq = CSecurityFtdcQryFundTransferSerialField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -310,7 +310,7 @@ ReqQryFundTransferSerial
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqFundInterTransfer
|
int TdApi::reqFundInterTransfer(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcFundInterTransferField myreq = CSecurityFtdcFundInterTransferField();
|
CSecurityFtdcFundInterTransferField myreq = CSecurityFtdcFundInterTransferField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
@ -326,7 +326,7 @@ ReqFundInterTransfer
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
ReqQryFundInterTransferSerial
|
int TdApi::reqQryFundInterTransferSerial(dict req, int nRequestID)
|
||||||
{
|
{
|
||||||
CSecurityFtdcQryFundInterTransferSerialField myreq = CSecurityFtdcQryFundInterTransferSerialField();
|
CSecurityFtdcQryFundInterTransferSerialField myreq = CSecurityFtdcQryFundInterTransferSerialField();
|
||||||
memset(&myreq, 0, sizeof(myreq));
|
memset(&myreq, 0, sizeof(myreq));
|
||||||
|
52
vn.lts/pyscript/lts_td_header_function.h
Normal file
52
vn.lts/pyscript/lts_td_header_function.h
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
int reqUserLogin(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqUserLogout(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqOrderInsert(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqOrderAction(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqUserPasswordUpdate(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqTradingAccountPasswordUpdate(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqQryExchange(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqQryInstrument(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqQryInvestor(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqQryTradingCode(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqQryTradingAccount(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqQryDepthMarketData(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqQryBondInterest(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqQryMarketRationInfo(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqQryInstrumentCommissionRate(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqQryETFInstrument(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqQryETFBasket(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqQryOFInstrument(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqQrySFInstrument(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqQryOrder(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqQryTrade(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqQryInvestorPosition(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqFundOutByLiber(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqQryFundTransferSerial(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqFundInterTransfer(dict req, int nRequestID);
|
||||||
|
|
||||||
|
int reqQryFundInterTransferSerial(dict req, int nRequestID);
|
||||||
|
|
75
vn.lts/pyscript/lts_td_header_on.h
Normal file
75
vn.lts/pyscript/lts_td_header_on.h
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
virtual void onRspError(dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspUserLogin(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspUserLogout(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspOrderInsert(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspOrderAction(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspUserPasswordUpdate(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspTradingAccountPasswordUpdate(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspQryExchange(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspQryInstrument(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspQryInvestor(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspQryTradingCode(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspQryTradingAccount(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspQryDepthMarketData(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspQryBondInterest(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspQryMarketRationInfo(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspQryInstrumentCommissionRate(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspQryETFInstrument(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspQryETFBasket(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspQryOFInstrument(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspQrySFInstrument(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspQryOrder(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspQryTrade(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspQryInvestorPosition(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRtnOrder(dict data) {};
|
||||||
|
|
||||||
|
virtual void onRtnTrade(dict data) {};
|
||||||
|
|
||||||
|
virtual void onErrRtnOrderInsert(dict data, dict error) {};
|
||||||
|
|
||||||
|
virtual void onErrRtnOrderAction(dict data, dict error) {};
|
||||||
|
|
||||||
|
virtual void onRspFundOutByLiber(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRtnFundOutByLiber(dict data) {};
|
||||||
|
|
||||||
|
virtual void onErrRtnFundOutByLiber(dict data, dict error) {};
|
||||||
|
|
||||||
|
virtual void onRtnFundInByBank(dict data) {};
|
||||||
|
|
||||||
|
virtual void onRspQryFundTransferSerial(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspFundInterTransfer(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRspQryFundInterTransferSerial(dict data, dict error, int id, bool last) {};
|
||||||
|
|
||||||
|
virtual void onRtnFundInterTransferSerial(dict data) {};
|
||||||
|
|
||||||
|
virtual void onErrRtnFundInterTransfer(dict data, dict error) {};
|
||||||
|
|
78
vn.lts/pyscript/lts_td_header_process.h
Normal file
78
vn.lts/pyscript/lts_td_header_process.h
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
void processFrontConnected(Task task);
|
||||||
|
|
||||||
|
void processFrontDisconnected(Task task);
|
||||||
|
|
||||||
|
void processHeartBeatWarning(Task task);
|
||||||
|
|
||||||
|
void processRspError(Task task);
|
||||||
|
|
||||||
|
void processRspUserLogin(Task task);
|
||||||
|
|
||||||
|
void processRspUserLogout(Task task);
|
||||||
|
|
||||||
|
void processRspOrderInsert(Task task);
|
||||||
|
|
||||||
|
void processRspOrderAction(Task task);
|
||||||
|
|
||||||
|
void processRspUserPasswordUpdate(Task task);
|
||||||
|
|
||||||
|
void processRspTradingAccountPasswordUpdate(Task task);
|
||||||
|
|
||||||
|
void processRspQryExchange(Task task);
|
||||||
|
|
||||||
|
void processRspQryInstrument(Task task);
|
||||||
|
|
||||||
|
void processRspQryInvestor(Task task);
|
||||||
|
|
||||||
|
void processRspQryTradingCode(Task task);
|
||||||
|
|
||||||
|
void processRspQryTradingAccount(Task task);
|
||||||
|
|
||||||
|
void processRspQryDepthMarketData(Task task);
|
||||||
|
|
||||||
|
void processRspQryBondInterest(Task task);
|
||||||
|
|
||||||
|
void processRspQryMarketRationInfo(Task task);
|
||||||
|
|
||||||
|
void processRspQryInstrumentCommissionRate(Task task);
|
||||||
|
|
||||||
|
void processRspQryETFInstrument(Task task);
|
||||||
|
|
||||||
|
void processRspQryETFBasket(Task task);
|
||||||
|
|
||||||
|
void processRspQryOFInstrument(Task task);
|
||||||
|
|
||||||
|
void processRspQrySFInstrument(Task task);
|
||||||
|
|
||||||
|
void processRspQryOrder(Task task);
|
||||||
|
|
||||||
|
void processRspQryTrade(Task task);
|
||||||
|
|
||||||
|
void processRspQryInvestorPosition(Task task);
|
||||||
|
|
||||||
|
void processRtnOrder(Task task);
|
||||||
|
|
||||||
|
void processRtnTrade(Task task);
|
||||||
|
|
||||||
|
void processErrRtnOrderInsert(Task task);
|
||||||
|
|
||||||
|
void processErrRtnOrderAction(Task task);
|
||||||
|
|
||||||
|
void processRspFundOutByLiber(Task task);
|
||||||
|
|
||||||
|
void processRtnFundOutByLiber(Task task);
|
||||||
|
|
||||||
|
void processErrRtnFundOutByLiber(Task task);
|
||||||
|
|
||||||
|
void processRtnFundInByBank(Task task);
|
||||||
|
|
||||||
|
void processRspQryFundTransferSerial(Task task);
|
||||||
|
|
||||||
|
void processRspFundInterTransfer(Task task);
|
||||||
|
|
||||||
|
void processRspQryFundInterTransferSerial(Task task);
|
||||||
|
|
||||||
|
void processRtnFundInterTransferSerial(Task task);
|
||||||
|
|
||||||
|
void processErrRtnFundInterTransfer(Task task);
|
||||||
|
|
@ -26,6 +26,7 @@ void TdApi::OnRspError(CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPERROR;
|
task.task_name = ONRSPERROR;
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -45,7 +46,18 @@ void TdApi::OnRspUserLogin(CSecurityFtdcRspUserLoginField *pRspUserLogin, CSecur
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPUSERLOGIN;
|
task.task_name = ONRSPUSERLOGIN;
|
||||||
task.task_data = *pRspUserLogin;
|
|
||||||
|
if (pRspUserLogin)
|
||||||
|
{
|
||||||
|
task.task_data = *pRspUserLogin;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcRspUserLoginField empty_data = CSecurityFtdcRspUserLoginField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -65,7 +77,18 @@ void TdApi::OnRspUserLogout(CSecurityFtdcUserLogoutField *pUserLogout, CSecurity
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPUSERLOGOUT;
|
task.task_name = ONRSPUSERLOGOUT;
|
||||||
task.task_data = *pUserLogout;
|
|
||||||
|
if (pUserLogout)
|
||||||
|
{
|
||||||
|
task.task_data = *pUserLogout;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcUserLogoutField empty_data = CSecurityFtdcUserLogoutField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -85,7 +108,18 @@ void TdApi::OnRspOrderInsert(CSecurityFtdcInputOrderField *pInputOrder, CSecurit
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPORDERINSERT;
|
task.task_name = ONRSPORDERINSERT;
|
||||||
task.task_data = *pInputOrder;
|
|
||||||
|
if (pInputOrder)
|
||||||
|
{
|
||||||
|
task.task_data = *pInputOrder;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcInputOrderField empty_data = CSecurityFtdcInputOrderField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -105,7 +139,18 @@ void TdApi::OnRspOrderAction(CSecurityFtdcInputOrderActionField *pInputOrderActi
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPORDERACTION;
|
task.task_name = ONRSPORDERACTION;
|
||||||
task.task_data = *pInputOrderAction;
|
|
||||||
|
if (pInputOrderAction)
|
||||||
|
{
|
||||||
|
task.task_data = *pInputOrderAction;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcInputOrderActionField empty_data = CSecurityFtdcInputOrderActionField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -125,7 +170,18 @@ void TdApi::OnRspUserPasswordUpdate(CSecurityFtdcUserPasswordUpdateField *pUserP
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPUSERPASSWORDUPDATE;
|
task.task_name = ONRSPUSERPASSWORDUPDATE;
|
||||||
task.task_data = *pUserPasswordUpdate;
|
|
||||||
|
if (pUserPasswordUpdate)
|
||||||
|
{
|
||||||
|
task.task_data = *pUserPasswordUpdate;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcUserPasswordUpdateField empty_data = CSecurityFtdcUserPasswordUpdateField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -145,7 +201,18 @@ void TdApi::OnRspTradingAccountPasswordUpdate(CSecurityFtdcTradingAccountPasswor
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPTRADINGACCOUNTPASSWORDUPDATE;
|
task.task_name = ONRSPTRADINGACCOUNTPASSWORDUPDATE;
|
||||||
task.task_data = *pTradingAccountPasswordUpdate;
|
|
||||||
|
if (pTradingAccountPasswordUpdate)
|
||||||
|
{
|
||||||
|
task.task_data = *pTradingAccountPasswordUpdate;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcTradingAccountPasswordUpdateField empty_data = CSecurityFtdcTradingAccountPasswordUpdateField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -165,7 +232,18 @@ void TdApi::OnRspQryExchange(CSecurityFtdcExchangeField *pExchange, CSecurityFtd
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYEXCHANGE;
|
task.task_name = ONRSPQRYEXCHANGE;
|
||||||
task.task_data = *pExchange;
|
|
||||||
|
if (pExchange)
|
||||||
|
{
|
||||||
|
task.task_data = *pExchange;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcExchangeField empty_data = CSecurityFtdcExchangeField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -185,7 +263,18 @@ void TdApi::OnRspQryInstrument(CSecurityFtdcInstrumentField *pInstrument, CSecur
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYINSTRUMENT;
|
task.task_name = ONRSPQRYINSTRUMENT;
|
||||||
task.task_data = *pInstrument;
|
|
||||||
|
if (pInstrument)
|
||||||
|
{
|
||||||
|
task.task_data = *pInstrument;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcInstrumentField empty_data = CSecurityFtdcInstrumentField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -205,7 +294,18 @@ void TdApi::OnRspQryInvestor(CSecurityFtdcInvestorField *pInvestor, CSecurityFtd
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYINVESTOR;
|
task.task_name = ONRSPQRYINVESTOR;
|
||||||
task.task_data = *pInvestor;
|
|
||||||
|
if (pInvestor)
|
||||||
|
{
|
||||||
|
task.task_data = *pInvestor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcInvestorField empty_data = CSecurityFtdcInvestorField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -225,7 +325,18 @@ void TdApi::OnRspQryTradingCode(CSecurityFtdcTradingCodeField *pTradingCode, CSe
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYTRADINGCODE;
|
task.task_name = ONRSPQRYTRADINGCODE;
|
||||||
task.task_data = *pTradingCode;
|
|
||||||
|
if (pTradingCode)
|
||||||
|
{
|
||||||
|
task.task_data = *pTradingCode;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcTradingCodeField empty_data = CSecurityFtdcTradingCodeField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -245,7 +356,18 @@ void TdApi::OnRspQryTradingAccount(CSecurityFtdcTradingAccountField *pTradingAcc
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYTRADINGACCOUNT;
|
task.task_name = ONRSPQRYTRADINGACCOUNT;
|
||||||
task.task_data = *pTradingAccount;
|
|
||||||
|
if (pTradingAccount)
|
||||||
|
{
|
||||||
|
task.task_data = *pTradingAccount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcTradingAccountField empty_data = CSecurityFtdcTradingAccountField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -265,7 +387,18 @@ void TdApi::OnRspQryDepthMarketData(CSecurityFtdcDepthMarketDataField *pDepthMar
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYDEPTHMARKETDATA;
|
task.task_name = ONRSPQRYDEPTHMARKETDATA;
|
||||||
task.task_data = *pDepthMarketData;
|
|
||||||
|
if (pDepthMarketData)
|
||||||
|
{
|
||||||
|
task.task_data = *pDepthMarketData;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcDepthMarketDataField empty_data = CSecurityFtdcDepthMarketDataField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -285,7 +418,18 @@ void TdApi::OnRspQryBondInterest(CSecurityFtdcBondInterestField *pBondInterest,
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYBONDINTEREST;
|
task.task_name = ONRSPQRYBONDINTEREST;
|
||||||
task.task_data = *pBondInterest;
|
|
||||||
|
if (pBondInterest)
|
||||||
|
{
|
||||||
|
task.task_data = *pBondInterest;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcBondInterestField empty_data = CSecurityFtdcBondInterestField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -305,7 +449,18 @@ void TdApi::OnRspQryMarketRationInfo(CSecurityFtdcMarketRationInfoField *pMarket
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYMARKETRATIONINFO;
|
task.task_name = ONRSPQRYMARKETRATIONINFO;
|
||||||
task.task_data = *pMarketRationInfo;
|
|
||||||
|
if (pMarketRationInfo)
|
||||||
|
{
|
||||||
|
task.task_data = *pMarketRationInfo;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcMarketRationInfoField empty_data = CSecurityFtdcMarketRationInfoField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -325,7 +480,18 @@ void TdApi::OnRspQryInstrumentCommissionRate(CSecurityFtdcInstrumentCommissionRa
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYINSTRUMENTCOMMISSIONRATE;
|
task.task_name = ONRSPQRYINSTRUMENTCOMMISSIONRATE;
|
||||||
task.task_data = *pInstrumentCommissionRate;
|
|
||||||
|
if (pInstrumentCommissionRate)
|
||||||
|
{
|
||||||
|
task.task_data = *pInstrumentCommissionRate;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcInstrumentCommissionRateField empty_data = CSecurityFtdcInstrumentCommissionRateField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -345,7 +511,18 @@ void TdApi::OnRspQryETFInstrument(CSecurityFtdcETFInstrumentField *pETFInstrumen
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYETFINSTRUMENT;
|
task.task_name = ONRSPQRYETFINSTRUMENT;
|
||||||
task.task_data = *pETFInstrument;
|
|
||||||
|
if (pETFInstrument)
|
||||||
|
{
|
||||||
|
task.task_data = *pETFInstrument;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcETFInstrumentField empty_data = CSecurityFtdcETFInstrumentField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -365,7 +542,18 @@ void TdApi::OnRspQryETFBasket(CSecurityFtdcETFBasketField *pETFBasket, CSecurity
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYETFBASKET;
|
task.task_name = ONRSPQRYETFBASKET;
|
||||||
task.task_data = *pETFBasket;
|
|
||||||
|
if (pETFBasket)
|
||||||
|
{
|
||||||
|
task.task_data = *pETFBasket;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcETFBasketField empty_data = CSecurityFtdcETFBasketField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -385,7 +573,18 @@ void TdApi::OnRspQryOFInstrument(CSecurityFtdcOFInstrumentField *pOFInstrument,
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYOFINSTRUMENT;
|
task.task_name = ONRSPQRYOFINSTRUMENT;
|
||||||
task.task_data = *pOFInstrument;
|
|
||||||
|
if (pOFInstrument)
|
||||||
|
{
|
||||||
|
task.task_data = *pOFInstrument;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcOFInstrumentField empty_data = CSecurityFtdcOFInstrumentField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -405,7 +604,18 @@ void TdApi::OnRspQrySFInstrument(CSecurityFtdcSFInstrumentField *pSFInstrument,
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYSFINSTRUMENT;
|
task.task_name = ONRSPQRYSFINSTRUMENT;
|
||||||
task.task_data = *pSFInstrument;
|
|
||||||
|
if (pSFInstrument)
|
||||||
|
{
|
||||||
|
task.task_data = *pSFInstrument;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcSFInstrumentField empty_data = CSecurityFtdcSFInstrumentField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -425,7 +635,18 @@ void TdApi::OnRspQryOrder(CSecurityFtdcOrderField *pOrder, CSecurityFtdcRspInfoF
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYORDER;
|
task.task_name = ONRSPQRYORDER;
|
||||||
task.task_data = *pOrder;
|
|
||||||
|
if (pOrder)
|
||||||
|
{
|
||||||
|
task.task_data = *pOrder;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcOrderField empty_data = CSecurityFtdcOrderField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -445,7 +666,18 @@ void TdApi::OnRspQryTrade(CSecurityFtdcTradeField *pTrade, CSecurityFtdcRspInfoF
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYTRADE;
|
task.task_name = ONRSPQRYTRADE;
|
||||||
task.task_data = *pTrade;
|
|
||||||
|
if (pTrade)
|
||||||
|
{
|
||||||
|
task.task_data = *pTrade;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcTradeField empty_data = CSecurityFtdcTradeField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -465,7 +697,18 @@ void TdApi::OnRspQryInvestorPosition(CSecurityFtdcInvestorPositionField *pInvest
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYINVESTORPOSITION;
|
task.task_name = ONRSPQRYINVESTORPOSITION;
|
||||||
task.task_data = *pInvestorPosition;
|
|
||||||
|
if (pInvestorPosition)
|
||||||
|
{
|
||||||
|
task.task_data = *pInvestorPosition;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcInvestorPositionField empty_data = CSecurityFtdcInvestorPositionField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -485,7 +728,17 @@ void TdApi::OnRtnOrder(CSecurityFtdcOrderField *pOrder)
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRTNORDER;
|
task.task_name = ONRTNORDER;
|
||||||
task.task_data = *pOrder;
|
|
||||||
|
if (pOrder)
|
||||||
|
{
|
||||||
|
task.task_data = *pOrder;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcOrderField empty_data = CSecurityFtdcOrderField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
this->task_queue.push(task);
|
this->task_queue.push(task);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -493,7 +746,17 @@ void TdApi::OnRtnTrade(CSecurityFtdcTradeField *pTrade)
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRTNTRADE;
|
task.task_name = ONRTNTRADE;
|
||||||
task.task_data = *pTrade;
|
|
||||||
|
if (pTrade)
|
||||||
|
{
|
||||||
|
task.task_data = *pTrade;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcTradeField empty_data = CSecurityFtdcTradeField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
this->task_queue.push(task);
|
this->task_queue.push(task);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -501,7 +764,18 @@ void TdApi::OnErrRtnOrderInsert(CSecurityFtdcInputOrderField *pInputOrder, CSecu
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONERRRTNORDERINSERT;
|
task.task_name = ONERRRTNORDERINSERT;
|
||||||
task.task_data = *pInputOrder;
|
|
||||||
|
if (pInputOrder)
|
||||||
|
{
|
||||||
|
task.task_data = *pInputOrder;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcInputOrderField empty_data = CSecurityFtdcInputOrderField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -519,7 +793,18 @@ void TdApi::OnErrRtnOrderAction(CSecurityFtdcOrderActionField *pOrderAction, CSe
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONERRRTNORDERACTION;
|
task.task_name = ONERRRTNORDERACTION;
|
||||||
task.task_data = *pOrderAction;
|
|
||||||
|
if (pOrderAction)
|
||||||
|
{
|
||||||
|
task.task_data = *pOrderAction;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcOrderActionField empty_data = CSecurityFtdcOrderActionField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -537,7 +822,18 @@ void TdApi::OnRspFundOutByLiber(CSecurityFtdcInputFundTransferField *pInputFundT
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPFUNDOUTBYLIBER;
|
task.task_name = ONRSPFUNDOUTBYLIBER;
|
||||||
task.task_data = *pInputFundTransfer;
|
|
||||||
|
if (pInputFundTransfer)
|
||||||
|
{
|
||||||
|
task.task_data = *pInputFundTransfer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcInputFundTransferField empty_data = CSecurityFtdcInputFundTransferField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -557,7 +853,17 @@ void TdApi::OnRtnFundOutByLiber(CSecurityFtdcFundTransferField *pFundTransfer)
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRTNFUNDOUTBYLIBER;
|
task.task_name = ONRTNFUNDOUTBYLIBER;
|
||||||
task.task_data = *pFundTransfer;
|
|
||||||
|
if (pFundTransfer)
|
||||||
|
{
|
||||||
|
task.task_data = *pFundTransfer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcFundTransferField empty_data = CSecurityFtdcFundTransferField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
this->task_queue.push(task);
|
this->task_queue.push(task);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -565,7 +871,18 @@ void TdApi::OnErrRtnFundOutByLiber(CSecurityFtdcInputFundTransferField *pInputFu
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONERRRTNFUNDOUTBYLIBER;
|
task.task_name = ONERRRTNFUNDOUTBYLIBER;
|
||||||
task.task_data = *pInputFundTransfer;
|
|
||||||
|
if (pInputFundTransfer)
|
||||||
|
{
|
||||||
|
task.task_data = *pInputFundTransfer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcInputFundTransferField empty_data = CSecurityFtdcInputFundTransferField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -583,7 +900,17 @@ void TdApi::OnRtnFundInByBank(CSecurityFtdcFundTransferField *pFundTransfer)
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRTNFUNDINBYBANK;
|
task.task_name = ONRTNFUNDINBYBANK;
|
||||||
task.task_data = *pFundTransfer;
|
|
||||||
|
if (pFundTransfer)
|
||||||
|
{
|
||||||
|
task.task_data = *pFundTransfer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcFundTransferField empty_data = CSecurityFtdcFundTransferField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
this->task_queue.push(task);
|
this->task_queue.push(task);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -591,7 +918,18 @@ void TdApi::OnRspQryFundTransferSerial(CSecurityFtdcFundTransferField *pFundTran
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYFUNDTRANSFERSERIAL;
|
task.task_name = ONRSPQRYFUNDTRANSFERSERIAL;
|
||||||
task.task_data = *pFundTransfer;
|
|
||||||
|
if (pFundTransfer)
|
||||||
|
{
|
||||||
|
task.task_data = *pFundTransfer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcFundTransferField empty_data = CSecurityFtdcFundTransferField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -611,7 +949,18 @@ void TdApi::OnRspFundInterTransfer(CSecurityFtdcFundInterTransferField *pFundInt
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPFUNDINTERTRANSFER;
|
task.task_name = ONRSPFUNDINTERTRANSFER;
|
||||||
task.task_data = *pFundInterTransfer;
|
|
||||||
|
if (pFundInterTransfer)
|
||||||
|
{
|
||||||
|
task.task_data = *pFundInterTransfer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcFundInterTransferField empty_data = CSecurityFtdcFundInterTransferField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -631,7 +980,18 @@ void TdApi::OnRspQryFundInterTransferSerial(CSecurityFtdcFundInterTransferSerial
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYFUNDINTERTRANSFERSERIAL;
|
task.task_name = ONRSPQRYFUNDINTERTRANSFERSERIAL;
|
||||||
task.task_data = *pFundInterTransferSerial;
|
|
||||||
|
if (pFundInterTransferSerial)
|
||||||
|
{
|
||||||
|
task.task_data = *pFundInterTransferSerial;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcFundInterTransferSerialField empty_data = CSecurityFtdcFundInterTransferSerialField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -651,7 +1011,17 @@ void TdApi::OnRtnFundInterTransferSerial(CSecurityFtdcFundInterTransferSerialFie
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRTNFUNDINTERTRANSFERSERIAL;
|
task.task_name = ONRTNFUNDINTERTRANSFERSERIAL;
|
||||||
task.task_data = *pFundInterTransferSerial;
|
|
||||||
|
if (pFundInterTransferSerial)
|
||||||
|
{
|
||||||
|
task.task_data = *pFundInterTransferSerial;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcFundInterTransferSerialField empty_data = CSecurityFtdcFundInterTransferSerialField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
this->task_queue.push(task);
|
this->task_queue.push(task);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -659,7 +1029,18 @@ void TdApi::OnErrRtnFundInterTransfer(CSecurityFtdcFundInterTransferField *pFund
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONERRRTNFUNDINTERTRANSFER;
|
task.task_name = ONERRRTNFUNDINTERTRANSFER;
|
||||||
task.task_data = *pFundInterTransfer;
|
|
||||||
|
if (pFundInterTransfer)
|
||||||
|
{
|
||||||
|
task.task_data = *pFundInterTransfer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcFundInterTransferField empty_data = CSecurityFtdcFundInterTransferField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
|
504
vn.lts/pyscript/lts_td_wrap.cpp
Normal file
504
vn.lts/pyscript/lts_td_wrap.cpp
Normal file
@ -0,0 +1,504 @@
|
|||||||
|
virtual void onRspError(dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspError")(error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspUserLogin(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspUserLogin")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspUserLogout(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspUserLogout")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspOrderInsert(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspOrderInsert")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspOrderAction(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspOrderAction")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspUserPasswordUpdate(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspUserPasswordUpdate")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspTradingAccountPasswordUpdate(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspTradingAccountPasswordUpdate")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspQryExchange(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspQryExchange")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspQryInstrument(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspQryInstrument")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspQryInvestor(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspQryInvestor")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspQryTradingCode(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspQryTradingCode")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspQryTradingAccount(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspQryTradingAccount")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspQryDepthMarketData(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspQryDepthMarketData")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspQryBondInterest(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspQryBondInterest")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspQryMarketRationInfo(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspQryMarketRationInfo")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspQryInstrumentCommissionRate(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspQryInstrumentCommissionRate")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspQryETFInstrument(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspQryETFInstrument")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspQryETFBasket(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspQryETFBasket")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspQryOFInstrument(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspQryOFInstrument")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspQrySFInstrument(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspQrySFInstrument")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspQryOrder(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspQryOrder")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspQryTrade(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspQryTrade")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspQryInvestorPosition(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspQryInvestorPosition")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRtnOrder(dict data)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRtnOrder")(data);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRtnTrade(dict data)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRtnTrade")(data);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onErrRtnOrderInsert(dict data, dict error)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onErrRtnOrderInsert")(data, error);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onErrRtnOrderAction(dict data, dict error)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onErrRtnOrderAction")(data, error);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspFundOutByLiber(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspFundOutByLiber")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRtnFundOutByLiber(dict data)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRtnFundOutByLiber")(data);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onErrRtnFundOutByLiber(dict data, dict error)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onErrRtnFundOutByLiber")(data, error);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRtnFundInByBank(dict data)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRtnFundInByBank")(data);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspQryFundTransferSerial(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspQryFundTransferSerial")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspFundInterTransfer(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspFundInterTransfer")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRspQryFundInterTransferSerial(dict data, dict error, int id, bool last)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRspQryFundInterTransferSerial")(data, error, id, last);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onRtnFundInterTransferSerial(dict data)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onRtnFundInterTransferSerial")(data);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void onErrRtnFundInterTransfer(dict data, dict error)
|
||||||
|
{
|
||||||
|
PyLock lock;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->get_override("onErrRtnFundInterTransfer")(data, error);
|
||||||
|
}
|
||||||
|
catch (error_already_set const &)
|
||||||
|
{
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -86,6 +86,7 @@ void TdApi::OnRspError(CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPERROR;
|
task.task_name = ONRSPERROR;
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -105,7 +106,18 @@ void TdApi::OnRspUserLogin(CSecurityFtdcRspUserLoginField *pRspUserLogin, CSecur
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPUSERLOGIN;
|
task.task_name = ONRSPUSERLOGIN;
|
||||||
task.task_data = *pRspUserLogin;
|
|
||||||
|
if (pRspUserLogin)
|
||||||
|
{
|
||||||
|
task.task_data = *pRspUserLogin;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcRspUserLoginField empty_data = CSecurityFtdcRspUserLoginField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -125,7 +137,18 @@ void TdApi::OnRspUserLogout(CSecurityFtdcUserLogoutField *pUserLogout, CSecurity
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPUSERLOGOUT;
|
task.task_name = ONRSPUSERLOGOUT;
|
||||||
task.task_data = *pUserLogout;
|
|
||||||
|
if (pUserLogout)
|
||||||
|
{
|
||||||
|
task.task_data = *pUserLogout;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcUserLogoutField empty_data = CSecurityFtdcUserLogoutField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -145,7 +168,18 @@ void TdApi::OnRspOrderInsert(CSecurityFtdcInputOrderField *pInputOrder, CSecurit
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPORDERINSERT;
|
task.task_name = ONRSPORDERINSERT;
|
||||||
task.task_data = *pInputOrder;
|
|
||||||
|
if (pInputOrder)
|
||||||
|
{
|
||||||
|
task.task_data = *pInputOrder;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcInputOrderField empty_data = CSecurityFtdcInputOrderField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -165,7 +199,18 @@ void TdApi::OnRspOrderAction(CSecurityFtdcInputOrderActionField *pInputOrderActi
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPORDERACTION;
|
task.task_name = ONRSPORDERACTION;
|
||||||
task.task_data = *pInputOrderAction;
|
|
||||||
|
if (pInputOrderAction)
|
||||||
|
{
|
||||||
|
task.task_data = *pInputOrderAction;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcInputOrderActionField empty_data = CSecurityFtdcInputOrderActionField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -185,7 +230,18 @@ void TdApi::OnRspUserPasswordUpdate(CSecurityFtdcUserPasswordUpdateField *pUserP
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPUSERPASSWORDUPDATE;
|
task.task_name = ONRSPUSERPASSWORDUPDATE;
|
||||||
task.task_data = *pUserPasswordUpdate;
|
|
||||||
|
if (pUserPasswordUpdate)
|
||||||
|
{
|
||||||
|
task.task_data = *pUserPasswordUpdate;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcUserPasswordUpdateField empty_data = CSecurityFtdcUserPasswordUpdateField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -205,7 +261,18 @@ void TdApi::OnRspTradingAccountPasswordUpdate(CSecurityFtdcTradingAccountPasswor
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPTRADINGACCOUNTPASSWORDUPDATE;
|
task.task_name = ONRSPTRADINGACCOUNTPASSWORDUPDATE;
|
||||||
task.task_data = *pTradingAccountPasswordUpdate;
|
|
||||||
|
if (pTradingAccountPasswordUpdate)
|
||||||
|
{
|
||||||
|
task.task_data = *pTradingAccountPasswordUpdate;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcTradingAccountPasswordUpdateField empty_data = CSecurityFtdcTradingAccountPasswordUpdateField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -225,7 +292,18 @@ void TdApi::OnRspQryExchange(CSecurityFtdcExchangeField *pExchange, CSecurityFtd
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYEXCHANGE;
|
task.task_name = ONRSPQRYEXCHANGE;
|
||||||
task.task_data = *pExchange;
|
|
||||||
|
if (pExchange)
|
||||||
|
{
|
||||||
|
task.task_data = *pExchange;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcExchangeField empty_data = CSecurityFtdcExchangeField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -245,7 +323,18 @@ void TdApi::OnRspQryInstrument(CSecurityFtdcInstrumentField *pInstrument, CSecur
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYINSTRUMENT;
|
task.task_name = ONRSPQRYINSTRUMENT;
|
||||||
task.task_data = *pInstrument;
|
|
||||||
|
if (pInstrument)
|
||||||
|
{
|
||||||
|
task.task_data = *pInstrument;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcInstrumentField empty_data = CSecurityFtdcInstrumentField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -265,7 +354,18 @@ void TdApi::OnRspQryInvestor(CSecurityFtdcInvestorField *pInvestor, CSecurityFtd
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYINVESTOR;
|
task.task_name = ONRSPQRYINVESTOR;
|
||||||
task.task_data = *pInvestor;
|
|
||||||
|
if (pInvestor)
|
||||||
|
{
|
||||||
|
task.task_data = *pInvestor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcInvestorField empty_data = CSecurityFtdcInvestorField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -285,7 +385,18 @@ void TdApi::OnRspQryTradingCode(CSecurityFtdcTradingCodeField *pTradingCode, CSe
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYTRADINGCODE;
|
task.task_name = ONRSPQRYTRADINGCODE;
|
||||||
task.task_data = *pTradingCode;
|
|
||||||
|
if (pTradingCode)
|
||||||
|
{
|
||||||
|
task.task_data = *pTradingCode;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcTradingCodeField empty_data = CSecurityFtdcTradingCodeField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -305,7 +416,18 @@ void TdApi::OnRspQryTradingAccount(CSecurityFtdcTradingAccountField *pTradingAcc
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYTRADINGACCOUNT;
|
task.task_name = ONRSPQRYTRADINGACCOUNT;
|
||||||
task.task_data = *pTradingAccount;
|
|
||||||
|
if (pTradingAccount)
|
||||||
|
{
|
||||||
|
task.task_data = *pTradingAccount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcTradingAccountField empty_data = CSecurityFtdcTradingAccountField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -323,32 +445,51 @@ void TdApi::OnRspQryTradingAccount(CSecurityFtdcTradingAccountField *pTradingAcc
|
|||||||
|
|
||||||
void TdApi::OnRspQryDepthMarketData(CSecurityFtdcDepthMarketDataField *pDepthMarketData, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
void TdApi::OnRspQryDepthMarketData(CSecurityFtdcDepthMarketDataField *pDepthMarketData, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||||||
{
|
{
|
||||||
if (pDepthMarketData) //手动修改,因为有可能出现pDepthMarketData为空指针的情况
|
Task task = Task();
|
||||||
|
task.task_name = ONRSPQRYDEPTHMARKETDATA;
|
||||||
|
|
||||||
|
if (pDepthMarketData)
|
||||||
{
|
{
|
||||||
Task task = Task();
|
|
||||||
task.task_name = ONRSPQRYDEPTHMARKETDATA;
|
|
||||||
task.task_data = *pDepthMarketData;
|
task.task_data = *pDepthMarketData;
|
||||||
if (pRspInfo)
|
|
||||||
{
|
|
||||||
task.task_error = *pRspInfo;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CSecurityFtdcRspInfoField empty_error = CSecurityFtdcRspInfoField();
|
|
||||||
memset(&empty_error, 0, sizeof(empty_error));
|
|
||||||
task.task_error = empty_error;
|
|
||||||
}
|
|
||||||
task.task_id = nRequestID;
|
|
||||||
task.task_last = bIsLast;
|
|
||||||
this->task_queue.push(task);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcDepthMarketDataField empty_data = CSecurityFtdcDepthMarketDataField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pRspInfo)
|
||||||
|
{
|
||||||
|
task.task_error = *pRspInfo;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcRspInfoField empty_error = CSecurityFtdcRspInfoField();
|
||||||
|
memset(&empty_error, 0, sizeof(empty_error));
|
||||||
|
task.task_error = empty_error;
|
||||||
|
}
|
||||||
|
task.task_id = nRequestID;
|
||||||
|
task.task_last = bIsLast;
|
||||||
|
this->task_queue.push(task);
|
||||||
};
|
};
|
||||||
|
|
||||||
void TdApi::OnRspQryBondInterest(CSecurityFtdcBondInterestField *pBondInterest, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
void TdApi::OnRspQryBondInterest(CSecurityFtdcBondInterestField *pBondInterest, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYBONDINTEREST;
|
task.task_name = ONRSPQRYBONDINTEREST;
|
||||||
task.task_data = *pBondInterest;
|
|
||||||
|
if (pBondInterest)
|
||||||
|
{
|
||||||
|
task.task_data = *pBondInterest;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcBondInterestField empty_data = CSecurityFtdcBondInterestField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -368,7 +509,18 @@ void TdApi::OnRspQryMarketRationInfo(CSecurityFtdcMarketRationInfoField *pMarket
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYMARKETRATIONINFO;
|
task.task_name = ONRSPQRYMARKETRATIONINFO;
|
||||||
task.task_data = *pMarketRationInfo;
|
|
||||||
|
if (pMarketRationInfo)
|
||||||
|
{
|
||||||
|
task.task_data = *pMarketRationInfo;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcMarketRationInfoField empty_data = CSecurityFtdcMarketRationInfoField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -386,32 +538,51 @@ void TdApi::OnRspQryMarketRationInfo(CSecurityFtdcMarketRationInfoField *pMarket
|
|||||||
|
|
||||||
void TdApi::OnRspQryInstrumentCommissionRate(CSecurityFtdcInstrumentCommissionRateField *pInstrumentCommissionRate, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
void TdApi::OnRspQryInstrumentCommissionRate(CSecurityFtdcInstrumentCommissionRateField *pInstrumentCommissionRate, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||||||
{
|
{
|
||||||
if (pInstrumentCommissionRate) //手动修改,因为有可能出现空指针的情况
|
Task task = Task();
|
||||||
|
task.task_name = ONRSPQRYINSTRUMENTCOMMISSIONRATE;
|
||||||
|
|
||||||
|
if (pInstrumentCommissionRate)
|
||||||
{
|
{
|
||||||
Task task = Task();
|
|
||||||
task.task_name = ONRSPQRYINSTRUMENTCOMMISSIONRATE;
|
|
||||||
task.task_data = *pInstrumentCommissionRate;
|
task.task_data = *pInstrumentCommissionRate;
|
||||||
if (pRspInfo)
|
|
||||||
{
|
|
||||||
task.task_error = *pRspInfo;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CSecurityFtdcRspInfoField empty_error = CSecurityFtdcRspInfoField();
|
|
||||||
memset(&empty_error, 0, sizeof(empty_error));
|
|
||||||
task.task_error = empty_error;
|
|
||||||
}
|
|
||||||
task.task_id = nRequestID;
|
|
||||||
task.task_last = bIsLast;
|
|
||||||
this->task_queue.push(task);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcInstrumentCommissionRateField empty_data = CSecurityFtdcInstrumentCommissionRateField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pRspInfo)
|
||||||
|
{
|
||||||
|
task.task_error = *pRspInfo;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcRspInfoField empty_error = CSecurityFtdcRspInfoField();
|
||||||
|
memset(&empty_error, 0, sizeof(empty_error));
|
||||||
|
task.task_error = empty_error;
|
||||||
|
}
|
||||||
|
task.task_id = nRequestID;
|
||||||
|
task.task_last = bIsLast;
|
||||||
|
this->task_queue.push(task);
|
||||||
};
|
};
|
||||||
|
|
||||||
void TdApi::OnRspQryETFInstrument(CSecurityFtdcETFInstrumentField *pETFInstrument, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
void TdApi::OnRspQryETFInstrument(CSecurityFtdcETFInstrumentField *pETFInstrument, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYETFINSTRUMENT;
|
task.task_name = ONRSPQRYETFINSTRUMENT;
|
||||||
task.task_data = *pETFInstrument;
|
|
||||||
|
if (pETFInstrument)
|
||||||
|
{
|
||||||
|
task.task_data = *pETFInstrument;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcETFInstrumentField empty_data = CSecurityFtdcETFInstrumentField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -431,7 +602,18 @@ void TdApi::OnRspQryETFBasket(CSecurityFtdcETFBasketField *pETFBasket, CSecurity
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYETFBASKET;
|
task.task_name = ONRSPQRYETFBASKET;
|
||||||
task.task_data = *pETFBasket;
|
|
||||||
|
if (pETFBasket)
|
||||||
|
{
|
||||||
|
task.task_data = *pETFBasket;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcETFBasketField empty_data = CSecurityFtdcETFBasketField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -451,7 +633,18 @@ void TdApi::OnRspQryOFInstrument(CSecurityFtdcOFInstrumentField *pOFInstrument,
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYOFINSTRUMENT;
|
task.task_name = ONRSPQRYOFINSTRUMENT;
|
||||||
task.task_data = *pOFInstrument;
|
|
||||||
|
if (pOFInstrument)
|
||||||
|
{
|
||||||
|
task.task_data = *pOFInstrument;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcOFInstrumentField empty_data = CSecurityFtdcOFInstrumentField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -471,7 +664,18 @@ void TdApi::OnRspQrySFInstrument(CSecurityFtdcSFInstrumentField *pSFInstrument,
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPQRYSFINSTRUMENT;
|
task.task_name = ONRSPQRYSFINSTRUMENT;
|
||||||
task.task_data = *pSFInstrument;
|
|
||||||
|
if (pSFInstrument)
|
||||||
|
{
|
||||||
|
task.task_data = *pSFInstrument;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcSFInstrumentField empty_data = CSecurityFtdcSFInstrumentField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -489,78 +693,112 @@ void TdApi::OnRspQrySFInstrument(CSecurityFtdcSFInstrumentField *pSFInstrument,
|
|||||||
|
|
||||||
void TdApi::OnRspQryOrder(CSecurityFtdcOrderField *pOrder, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
void TdApi::OnRspQryOrder(CSecurityFtdcOrderField *pOrder, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||||||
{
|
{
|
||||||
if (pOrder) //手动修改,因为有可能出现pOrder为空指针的情况
|
Task task = Task();
|
||||||
|
task.task_name = ONRSPQRYORDER;
|
||||||
|
|
||||||
|
if (pOrder)
|
||||||
{
|
{
|
||||||
Task task = Task();
|
|
||||||
task.task_name = ONRSPQRYORDER;
|
|
||||||
task.task_data = *pOrder;
|
task.task_data = *pOrder;
|
||||||
if (pRspInfo)
|
|
||||||
{
|
|
||||||
task.task_error = *pRspInfo;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CSecurityFtdcRspInfoField empty_error = CSecurityFtdcRspInfoField();
|
|
||||||
memset(&empty_error, 0, sizeof(empty_error));
|
|
||||||
task.task_error = empty_error;
|
|
||||||
}
|
|
||||||
task.task_id = nRequestID;
|
|
||||||
task.task_last = bIsLast;
|
|
||||||
this->task_queue.push(task);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcOrderField empty_data = CSecurityFtdcOrderField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pRspInfo)
|
||||||
|
{
|
||||||
|
task.task_error = *pRspInfo;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcRspInfoField empty_error = CSecurityFtdcRspInfoField();
|
||||||
|
memset(&empty_error, 0, sizeof(empty_error));
|
||||||
|
task.task_error = empty_error;
|
||||||
|
}
|
||||||
|
task.task_id = nRequestID;
|
||||||
|
task.task_last = bIsLast;
|
||||||
|
this->task_queue.push(task);
|
||||||
};
|
};
|
||||||
|
|
||||||
void TdApi::OnRspQryTrade(CSecurityFtdcTradeField *pTrade, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
void TdApi::OnRspQryTrade(CSecurityFtdcTradeField *pTrade, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||||||
{
|
{
|
||||||
if (pTrade) //手动修改,因为有可能出现pTrade为空指针的情况
|
Task task = Task();
|
||||||
|
task.task_name = ONRSPQRYTRADE;
|
||||||
|
|
||||||
|
if (pTrade)
|
||||||
{
|
{
|
||||||
Task task = Task();
|
|
||||||
task.task_name = ONRSPQRYTRADE;
|
|
||||||
task.task_data = *pTrade;
|
task.task_data = *pTrade;
|
||||||
if (pRspInfo)
|
|
||||||
{
|
|
||||||
task.task_error = *pRspInfo;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CSecurityFtdcRspInfoField empty_error = CSecurityFtdcRspInfoField();
|
|
||||||
memset(&empty_error, 0, sizeof(empty_error));
|
|
||||||
task.task_error = empty_error;
|
|
||||||
}
|
|
||||||
task.task_id = nRequestID;
|
|
||||||
task.task_last = bIsLast;
|
|
||||||
this->task_queue.push(task);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcTradeField empty_data = CSecurityFtdcTradeField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pRspInfo)
|
||||||
|
{
|
||||||
|
task.task_error = *pRspInfo;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcRspInfoField empty_error = CSecurityFtdcRspInfoField();
|
||||||
|
memset(&empty_error, 0, sizeof(empty_error));
|
||||||
|
task.task_error = empty_error;
|
||||||
|
}
|
||||||
|
task.task_id = nRequestID;
|
||||||
|
task.task_last = bIsLast;
|
||||||
|
this->task_queue.push(task);
|
||||||
};
|
};
|
||||||
|
|
||||||
void TdApi::OnRspQryInvestorPosition(CSecurityFtdcInvestorPositionField *pInvestorPosition, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
void TdApi::OnRspQryInvestorPosition(CSecurityFtdcInvestorPositionField *pInvestorPosition, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||||||
{
|
{
|
||||||
if (pInvestorPosition) //手动修改,防止空指针
|
Task task = Task();
|
||||||
|
task.task_name = ONRSPQRYINVESTORPOSITION;
|
||||||
|
|
||||||
|
if (pInvestorPosition)
|
||||||
{
|
{
|
||||||
Task task = Task();
|
|
||||||
task.task_name = ONRSPQRYINVESTORPOSITION;
|
|
||||||
task.task_data = *pInvestorPosition;
|
task.task_data = *pInvestorPosition;
|
||||||
if (pRspInfo)
|
|
||||||
{
|
|
||||||
task.task_error = *pRspInfo;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CSecurityFtdcRspInfoField empty_error = CSecurityFtdcRspInfoField();
|
|
||||||
memset(&empty_error, 0, sizeof(empty_error));
|
|
||||||
task.task_error = empty_error;
|
|
||||||
}
|
|
||||||
task.task_id = nRequestID;
|
|
||||||
task.task_last = bIsLast;
|
|
||||||
this->task_queue.push(task);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcInvestorPositionField empty_data = CSecurityFtdcInvestorPositionField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pRspInfo)
|
||||||
|
{
|
||||||
|
task.task_error = *pRspInfo;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcRspInfoField empty_error = CSecurityFtdcRspInfoField();
|
||||||
|
memset(&empty_error, 0, sizeof(empty_error));
|
||||||
|
task.task_error = empty_error;
|
||||||
|
}
|
||||||
|
task.task_id = nRequestID;
|
||||||
|
task.task_last = bIsLast;
|
||||||
|
this->task_queue.push(task);
|
||||||
};
|
};
|
||||||
|
|
||||||
void TdApi::OnRtnOrder(CSecurityFtdcOrderField *pOrder)
|
void TdApi::OnRtnOrder(CSecurityFtdcOrderField *pOrder)
|
||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRTNORDER;
|
task.task_name = ONRTNORDER;
|
||||||
task.task_data = *pOrder;
|
|
||||||
|
if (pOrder)
|
||||||
|
{
|
||||||
|
task.task_data = *pOrder;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcOrderField empty_data = CSecurityFtdcOrderField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
this->task_queue.push(task);
|
this->task_queue.push(task);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -568,7 +806,17 @@ void TdApi::OnRtnTrade(CSecurityFtdcTradeField *pTrade)
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRTNTRADE;
|
task.task_name = ONRTNTRADE;
|
||||||
task.task_data = *pTrade;
|
|
||||||
|
if (pTrade)
|
||||||
|
{
|
||||||
|
task.task_data = *pTrade;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcTradeField empty_data = CSecurityFtdcTradeField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
this->task_queue.push(task);
|
this->task_queue.push(task);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -576,7 +824,18 @@ void TdApi::OnErrRtnOrderInsert(CSecurityFtdcInputOrderField *pInputOrder, CSecu
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONERRRTNORDERINSERT;
|
task.task_name = ONERRRTNORDERINSERT;
|
||||||
task.task_data = *pInputOrder;
|
|
||||||
|
if (pInputOrder)
|
||||||
|
{
|
||||||
|
task.task_data = *pInputOrder;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcInputOrderField empty_data = CSecurityFtdcInputOrderField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -594,7 +853,18 @@ void TdApi::OnErrRtnOrderAction(CSecurityFtdcOrderActionField *pOrderAction, CSe
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONERRRTNORDERACTION;
|
task.task_name = ONERRRTNORDERACTION;
|
||||||
task.task_data = *pOrderAction;
|
|
||||||
|
if (pOrderAction)
|
||||||
|
{
|
||||||
|
task.task_data = *pOrderAction;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcOrderActionField empty_data = CSecurityFtdcOrderActionField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -612,7 +882,18 @@ void TdApi::OnRspFundOutByLiber(CSecurityFtdcInputFundTransferField *pInputFundT
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPFUNDOUTBYLIBER;
|
task.task_name = ONRSPFUNDOUTBYLIBER;
|
||||||
task.task_data = *pInputFundTransfer;
|
|
||||||
|
if (pInputFundTransfer)
|
||||||
|
{
|
||||||
|
task.task_data = *pInputFundTransfer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcInputFundTransferField empty_data = CSecurityFtdcInputFundTransferField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -632,7 +913,17 @@ void TdApi::OnRtnFundOutByLiber(CSecurityFtdcFundTransferField *pFundTransfer)
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRTNFUNDOUTBYLIBER;
|
task.task_name = ONRTNFUNDOUTBYLIBER;
|
||||||
task.task_data = *pFundTransfer;
|
|
||||||
|
if (pFundTransfer)
|
||||||
|
{
|
||||||
|
task.task_data = *pFundTransfer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcFundTransferField empty_data = CSecurityFtdcFundTransferField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
this->task_queue.push(task);
|
this->task_queue.push(task);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -640,7 +931,18 @@ void TdApi::OnErrRtnFundOutByLiber(CSecurityFtdcInputFundTransferField *pInputFu
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONERRRTNFUNDOUTBYLIBER;
|
task.task_name = ONERRRTNFUNDOUTBYLIBER;
|
||||||
task.task_data = *pInputFundTransfer;
|
|
||||||
|
if (pInputFundTransfer)
|
||||||
|
{
|
||||||
|
task.task_data = *pInputFundTransfer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcInputFundTransferField empty_data = CSecurityFtdcInputFundTransferField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -658,38 +960,67 @@ void TdApi::OnRtnFundInByBank(CSecurityFtdcFundTransferField *pFundTransfer)
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRTNFUNDINBYBANK;
|
task.task_name = ONRTNFUNDINBYBANK;
|
||||||
task.task_data = *pFundTransfer;
|
|
||||||
|
if (pFundTransfer)
|
||||||
|
{
|
||||||
|
task.task_data = *pFundTransfer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcFundTransferField empty_data = CSecurityFtdcFundTransferField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
this->task_queue.push(task);
|
this->task_queue.push(task);
|
||||||
};
|
};
|
||||||
|
|
||||||
void TdApi::OnRspQryFundTransferSerial(CSecurityFtdcFundTransferField *pFundTransfer, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
void TdApi::OnRspQryFundTransferSerial(CSecurityFtdcFundTransferField *pFundTransfer, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||||||
{
|
{
|
||||||
if (pFundTransfer) //手动修改,防止空指针
|
Task task = Task();
|
||||||
|
task.task_name = ONRSPQRYFUNDTRANSFERSERIAL;
|
||||||
|
|
||||||
|
if (pFundTransfer)
|
||||||
{
|
{
|
||||||
Task task = Task();
|
|
||||||
task.task_name = ONRSPQRYFUNDTRANSFERSERIAL;
|
|
||||||
task.task_data = *pFundTransfer;
|
task.task_data = *pFundTransfer;
|
||||||
if (pRspInfo)
|
|
||||||
{
|
|
||||||
task.task_error = *pRspInfo;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CSecurityFtdcRspInfoField empty_error = CSecurityFtdcRspInfoField();
|
|
||||||
memset(&empty_error, 0, sizeof(empty_error));
|
|
||||||
task.task_error = empty_error;
|
|
||||||
}
|
|
||||||
task.task_id = nRequestID;
|
|
||||||
task.task_last = bIsLast;
|
|
||||||
this->task_queue.push(task);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcFundTransferField empty_data = CSecurityFtdcFundTransferField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pRspInfo)
|
||||||
|
{
|
||||||
|
task.task_error = *pRspInfo;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcRspInfoField empty_error = CSecurityFtdcRspInfoField();
|
||||||
|
memset(&empty_error, 0, sizeof(empty_error));
|
||||||
|
task.task_error = empty_error;
|
||||||
|
}
|
||||||
|
task.task_id = nRequestID;
|
||||||
|
task.task_last = bIsLast;
|
||||||
|
this->task_queue.push(task);
|
||||||
};
|
};
|
||||||
|
|
||||||
void TdApi::OnRspFundInterTransfer(CSecurityFtdcFundInterTransferField *pFundInterTransfer, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
void TdApi::OnRspFundInterTransfer(CSecurityFtdcFundInterTransferField *pFundInterTransfer, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRSPFUNDINTERTRANSFER;
|
task.task_name = ONRSPFUNDINTERTRANSFER;
|
||||||
task.task_data = *pFundInterTransfer;
|
|
||||||
|
if (pFundInterTransfer)
|
||||||
|
{
|
||||||
|
task.task_data = *pFundInterTransfer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcFundInterTransferField empty_data = CSecurityFtdcFundInterTransferField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -707,32 +1038,50 @@ void TdApi::OnRspFundInterTransfer(CSecurityFtdcFundInterTransferField *pFundInt
|
|||||||
|
|
||||||
void TdApi::OnRspQryFundInterTransferSerial(CSecurityFtdcFundInterTransferSerialField *pFundInterTransferSerial, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
void TdApi::OnRspQryFundInterTransferSerial(CSecurityFtdcFundInterTransferSerialField *pFundInterTransferSerial, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||||||
{
|
{
|
||||||
if (pFundInterTransferSerial) //手动修改,防止空指针
|
Task task = Task();
|
||||||
|
task.task_name = ONRSPQRYFUNDINTERTRANSFERSERIAL;
|
||||||
|
|
||||||
|
if (pFundInterTransferSerial)
|
||||||
{
|
{
|
||||||
Task task = Task();
|
|
||||||
task.task_name = ONRSPQRYFUNDINTERTRANSFERSERIAL;
|
|
||||||
task.task_data = *pFundInterTransferSerial;
|
task.task_data = *pFundInterTransferSerial;
|
||||||
if (pRspInfo)
|
|
||||||
{
|
|
||||||
task.task_error = *pRspInfo;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CSecurityFtdcRspInfoField empty_error = CSecurityFtdcRspInfoField();
|
|
||||||
memset(&empty_error, 0, sizeof(empty_error));
|
|
||||||
task.task_error = empty_error;
|
|
||||||
}
|
|
||||||
task.task_id = nRequestID;
|
|
||||||
task.task_last = bIsLast;
|
|
||||||
this->task_queue.push(task);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcFundInterTransferSerialField empty_data = CSecurityFtdcFundInterTransferSerialField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pRspInfo)
|
||||||
|
{
|
||||||
|
task.task_error = *pRspInfo;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcRspInfoField empty_error = CSecurityFtdcRspInfoField();
|
||||||
|
memset(&empty_error, 0, sizeof(empty_error));
|
||||||
|
task.task_error = empty_error;
|
||||||
|
}
|
||||||
|
task.task_id = nRequestID;
|
||||||
|
task.task_last = bIsLast;
|
||||||
|
this->task_queue.push(task);
|
||||||
};
|
};
|
||||||
|
|
||||||
void TdApi::OnRtnFundInterTransferSerial(CSecurityFtdcFundInterTransferSerialField *pFundInterTransferSerial)
|
void TdApi::OnRtnFundInterTransferSerial(CSecurityFtdcFundInterTransferSerialField *pFundInterTransferSerial)
|
||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONRTNFUNDINTERTRANSFERSERIAL;
|
task.task_name = ONRTNFUNDINTERTRANSFERSERIAL;
|
||||||
task.task_data = *pFundInterTransferSerial;
|
|
||||||
|
if (pFundInterTransferSerial)
|
||||||
|
{
|
||||||
|
task.task_data = *pFundInterTransferSerial;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcFundInterTransferSerialField empty_data = CSecurityFtdcFundInterTransferSerialField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
this->task_queue.push(task);
|
this->task_queue.push(task);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -740,7 +1089,18 @@ void TdApi::OnErrRtnFundInterTransfer(CSecurityFtdcFundInterTransferField *pFund
|
|||||||
{
|
{
|
||||||
Task task = Task();
|
Task task = Task();
|
||||||
task.task_name = ONERRRTNFUNDINTERTRANSFER;
|
task.task_name = ONERRRTNFUNDINTERTRANSFER;
|
||||||
task.task_data = *pFundInterTransfer;
|
|
||||||
|
if (pFundInterTransfer)
|
||||||
|
{
|
||||||
|
task.task_data = *pFundInterTransfer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CSecurityFtdcFundInterTransferField empty_data = CSecurityFtdcFundInterTransferField();
|
||||||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||||||
|
task.task_data = empty_data;
|
||||||
|
}
|
||||||
|
|
||||||
if (pRspInfo)
|
if (pRspInfo)
|
||||||
{
|
{
|
||||||
task.task_error = *pRspInfo;
|
task.task_error = *pRspInfo;
|
||||||
@ -756,9 +1116,6 @@ void TdApi::OnErrRtnFundInterTransfer(CSecurityFtdcFundInterTransferField *pFund
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///-------------------------------------------------------------------------------------
|
///-------------------------------------------------------------------------------------
|
||||||
///工作线程从队列中取出数据,转化为python对象后,进行推送
|
///工作线程从队列中取出数据,转化为python对象后,进行推送
|
||||||
///-------------------------------------------------------------------------------------
|
///-------------------------------------------------------------------------------------
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user