1131 lines
25 KiB
C++
1131 lines
25 KiB
C++
|
void TdApi::OnFrontConnected()
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONFRONTCONNECTED;
|
||
|
this->task_queue.push(task);
|
||
|
};
|
||
|
|
||
|
void TdApi::OnFrontDisconnected(int nReason)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONFRONTDISCONNECTED;
|
||
|
task.task_id = nReason;
|
||
|
this->task_queue.push(task);
|
||
|
};
|
||
|
|
||
|
void TdApi::OnHeartBeatWarning(int nTimeLapse)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONHEARTBEATWARNING;
|
||
|
task.task_id = nTimeLapse;
|
||
|
this->task_queue.push(task);
|
||
|
};
|
||
|
|
||
|
void TdApi::OnPackageStart(int nTopicID, int nSequenceNo)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONPACKAGESTART;
|
||
|
task.task_id = nTopicID;
|
||
|
task.task_id = nSequenceNo;
|
||
|
this->task_queue.push(task);
|
||
|
};
|
||
|
|
||
|
void TdApi::OnPackageEnd(int nTopicID, int nSequenceNo)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONPACKAGEEND;
|
||
|
task.task_id = nTopicID;
|
||
|
task.task_id = nSequenceNo;
|
||
|
this->task_queue.push(task);
|
||
|
};
|
||
|
|
||
|
void TdApi::OnRspError(CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPERROR;
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspUserLogin(CQdpFtdcRspUserLoginField *pRspUserLogin, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPUSERLOGIN;
|
||
|
|
||
|
if (pRspUserLogin)
|
||
|
{
|
||
|
task.task_data = *pRspUserLogin;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspUserLoginField empty_data = CQdpFtdcRspUserLoginField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspUserLogout(CQdpFtdcRspUserLogoutField *pRspUserLogout, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPUSERLOGOUT;
|
||
|
|
||
|
if (pRspUserLogout)
|
||
|
{
|
||
|
task.task_data = *pRspUserLogout;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspUserLogoutField empty_data = CQdpFtdcRspUserLogoutField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspUserPasswordUpdate(CQdpFtdcUserPasswordUpdateField *pUserPasswordUpdate, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPUSERPASSWORDUPDATE;
|
||
|
|
||
|
if (pUserPasswordUpdate)
|
||
|
{
|
||
|
task.task_data = *pUserPasswordUpdate;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcUserPasswordUpdateField empty_data = CQdpFtdcUserPasswordUpdateField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspOrderInsert(CQdpFtdcInputOrderField *pInputOrder, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPORDERINSERT;
|
||
|
|
||
|
if (pInputOrder)
|
||
|
{
|
||
|
task.task_data = *pInputOrder;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcInputOrderField empty_data = CQdpFtdcInputOrderField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspOrderAction(CQdpFtdcOrderActionField *pOrderAction, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPORDERACTION;
|
||
|
|
||
|
if (pOrderAction)
|
||
|
{
|
||
|
task.task_data = *pOrderAction;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcOrderActionField empty_data = CQdpFtdcOrderActionField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspFromBankToFutureByFuture(CQdpFtdcReqTransferField *pReqTransfer, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPFROMBANKTOFUTUREBYFUTURE;
|
||
|
|
||
|
if (pReqTransfer)
|
||
|
{
|
||
|
task.task_data = *pReqTransfer;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcReqTransferField empty_data = CQdpFtdcReqTransferField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspFromFutureToBankByFuture(CQdpFtdcReqTransferField *pReqTransfer, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPFROMFUTURETOBANKBYFUTURE;
|
||
|
|
||
|
if (pReqTransfer)
|
||
|
{
|
||
|
task.task_data = *pReqTransfer;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcReqTransferField empty_data = CQdpFtdcReqTransferField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRtnFlowMessageCancel(CQdpFtdcFlowMessageCancelField *pFlowMessageCancel)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRTNFLOWMESSAGECANCEL;
|
||
|
|
||
|
if (pFlowMessageCancel)
|
||
|
{
|
||
|
task.task_data = *pFlowMessageCancel;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcFlowMessageCancelField empty_data = CQdpFtdcFlowMessageCancelField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
this->task_queue.push(task);
|
||
|
};
|
||
|
|
||
|
void TdApi::OnRtnTrade(CQdpFtdcTradeField *pTrade)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRTNTRADE;
|
||
|
|
||
|
if (pTrade)
|
||
|
{
|
||
|
task.task_data = *pTrade;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcTradeField empty_data = CQdpFtdcTradeField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
this->task_queue.push(task);
|
||
|
};
|
||
|
|
||
|
void TdApi::OnRtnOrder(CQdpFtdcOrderField *pOrder)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRTNORDER;
|
||
|
|
||
|
if (pOrder)
|
||
|
{
|
||
|
task.task_data = *pOrder;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcOrderField empty_data = CQdpFtdcOrderField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
this->task_queue.push(task);
|
||
|
};
|
||
|
|
||
|
void TdApi::OnErrRtnOrderInsert(CQdpFtdcInputOrderField *pInputOrder, CQdpFtdcRspInfoField *pRspInfo)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONERRRTNORDERINSERT;
|
||
|
|
||
|
if (pInputOrder)
|
||
|
{
|
||
|
task.task_data = *pInputOrder;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcInputOrderField empty_data = CQdpFtdcInputOrderField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
memset(&empty_error, 0, sizeof(empty_error));
|
||
|
task.task_error = empty_error;
|
||
|
}
|
||
|
this->task_queue.push(task);
|
||
|
};
|
||
|
|
||
|
void TdApi::OnErrRtnOrderAction(CQdpFtdcOrderActionField *pOrderAction, CQdpFtdcRspInfoField *pRspInfo)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONERRRTNORDERACTION;
|
||
|
|
||
|
if (pOrderAction)
|
||
|
{
|
||
|
task.task_data = *pOrderAction;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcOrderActionField empty_data = CQdpFtdcOrderActionField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
memset(&empty_error, 0, sizeof(empty_error));
|
||
|
task.task_error = empty_error;
|
||
|
}
|
||
|
this->task_queue.push(task);
|
||
|
};
|
||
|
|
||
|
void TdApi::OnRtnInstrumentStatus(CQdpFtdcInstrumentStatusField *pInstrumentStatus)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRTNINSTRUMENTSTATUS;
|
||
|
|
||
|
if (pInstrumentStatus)
|
||
|
{
|
||
|
task.task_data = *pInstrumentStatus;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcInstrumentStatusField empty_data = CQdpFtdcInstrumentStatusField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
this->task_queue.push(task);
|
||
|
};
|
||
|
|
||
|
void TdApi::OnRtnInvestorAccountDeposit(CQdpFtdcInvestorAccountDepositResField *pInvestorAccountDepositRes)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRTNINVESTORACCOUNTDEPOSIT;
|
||
|
|
||
|
if (pInvestorAccountDepositRes)
|
||
|
{
|
||
|
task.task_data = *pInvestorAccountDepositRes;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcInvestorAccountDepositResField empty_data = CQdpFtdcInvestorAccountDepositResField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
this->task_queue.push(task);
|
||
|
};
|
||
|
|
||
|
void TdApi::OnRtnMessageNotify(CQdpFtdcMessageNotifyInfoField *pMessageNotifyInfo)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRTNMESSAGENOTIFY;
|
||
|
|
||
|
if (pMessageNotifyInfo)
|
||
|
{
|
||
|
task.task_data = *pMessageNotifyInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcMessageNotifyInfoField empty_data = CQdpFtdcMessageNotifyInfoField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
this->task_queue.push(task);
|
||
|
};
|
||
|
|
||
|
void TdApi::OnErrRtnQueryBankBalanceByFuture(CQdpFtdcReqQueryAccountField *pReqQueryAccount, CQdpFtdcRspInfoField *pRspInfo)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONERRRTNQUERYBANKBALANCEBYFUTURE;
|
||
|
|
||
|
if (pReqQueryAccount)
|
||
|
{
|
||
|
task.task_data = *pReqQueryAccount;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcReqQueryAccountField empty_data = CQdpFtdcReqQueryAccountField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
memset(&empty_error, 0, sizeof(empty_error));
|
||
|
task.task_error = empty_error;
|
||
|
}
|
||
|
this->task_queue.push(task);
|
||
|
};
|
||
|
|
||
|
void TdApi::OnErrRtnBankToFutureByFuture(CQdpFtdcReqTransferField *pReqTransfer, CQdpFtdcRspInfoField *pRspInfo)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONERRRTNBANKTOFUTUREBYFUTURE;
|
||
|
|
||
|
if (pReqTransfer)
|
||
|
{
|
||
|
task.task_data = *pReqTransfer;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcReqTransferField empty_data = CQdpFtdcReqTransferField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
memset(&empty_error, 0, sizeof(empty_error));
|
||
|
task.task_error = empty_error;
|
||
|
}
|
||
|
this->task_queue.push(task);
|
||
|
};
|
||
|
|
||
|
void TdApi::OnErrRtnFutureToBankByFuture(CQdpFtdcReqTransferField *pReqTransfer, CQdpFtdcRspInfoField *pRspInfo)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONERRRTNFUTURETOBANKBYFUTURE;
|
||
|
|
||
|
if (pReqTransfer)
|
||
|
{
|
||
|
task.task_data = *pReqTransfer;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcReqTransferField empty_data = CQdpFtdcReqTransferField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
memset(&empty_error, 0, sizeof(empty_error));
|
||
|
task.task_error = empty_error;
|
||
|
}
|
||
|
this->task_queue.push(task);
|
||
|
};
|
||
|
|
||
|
void TdApi::OnRtnQueryBankBalanceByFuture(CQdpFtdcNotifyQueryAccountField *pNotifyQueryAccount)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRTNQUERYBANKBALANCEBYFUTURE;
|
||
|
|
||
|
if (pNotifyQueryAccount)
|
||
|
{
|
||
|
task.task_data = *pNotifyQueryAccount;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcNotifyQueryAccountField empty_data = CQdpFtdcNotifyQueryAccountField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
this->task_queue.push(task);
|
||
|
};
|
||
|
|
||
|
void TdApi::OnRtnFromBankToFutureByFuture(CQdpFtdcRspTransferField *pRspTransfer)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRTNFROMBANKTOFUTUREBYFUTURE;
|
||
|
|
||
|
if (pRspTransfer)
|
||
|
{
|
||
|
task.task_data = *pRspTransfer;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspTransferField empty_data = CQdpFtdcRspTransferField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
this->task_queue.push(task);
|
||
|
};
|
||
|
|
||
|
void TdApi::OnRtnFromFutureToBankByFuture(CQdpFtdcRspTransferField *pRspTransfer)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRTNFROMFUTURETOBANKBYFUTURE;
|
||
|
|
||
|
if (pRspTransfer)
|
||
|
{
|
||
|
task.task_data = *pRspTransfer;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspTransferField empty_data = CQdpFtdcRspTransferField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
this->task_queue.push(task);
|
||
|
};
|
||
|
|
||
|
void TdApi::OnRtnSGEDeferRate(CQdpFtdcSGEDeferRateField *pSGEDeferRate)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRTNSGEDEFERRATE;
|
||
|
|
||
|
if (pSGEDeferRate)
|
||
|
{
|
||
|
task.task_data = *pSGEDeferRate;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcSGEDeferRateField empty_data = CQdpFtdcSGEDeferRateField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
this->task_queue.push(task);
|
||
|
};
|
||
|
|
||
|
void TdApi::OnRspQryOrder(CQdpFtdcOrderField *pOrder, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPQRYORDER;
|
||
|
|
||
|
if (pOrder)
|
||
|
{
|
||
|
task.task_data = *pOrder;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcOrderField empty_data = CQdpFtdcOrderField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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(CQdpFtdcTradeField *pTrade, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPQRYTRADE;
|
||
|
|
||
|
if (pTrade)
|
||
|
{
|
||
|
task.task_data = *pTrade;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcTradeField empty_data = CQdpFtdcTradeField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspQryUserInvestor(CQdpFtdcRspUserInvestorField *pRspUserInvestor, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPQRYUSERINVESTOR;
|
||
|
|
||
|
if (pRspUserInvestor)
|
||
|
{
|
||
|
task.task_data = *pRspUserInvestor;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspUserInvestorField empty_data = CQdpFtdcRspUserInvestorField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspQryInvestorAccount(CQdpFtdcRspInvestorAccountField *pRspInvestorAccount, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPQRYINVESTORACCOUNT;
|
||
|
|
||
|
if (pRspInvestorAccount)
|
||
|
{
|
||
|
task.task_data = *pRspInvestorAccount;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInvestorAccountField empty_data = CQdpFtdcRspInvestorAccountField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspQryInstrument(CQdpFtdcRspInstrumentField *pRspInstrument, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPQRYINSTRUMENT;
|
||
|
|
||
|
if (pRspInstrument)
|
||
|
{
|
||
|
task.task_data = *pRspInstrument;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInstrumentField empty_data = CQdpFtdcRspInstrumentField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspQryExchange(CQdpFtdcRspExchangeField *pRspExchange, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPQRYEXCHANGE;
|
||
|
|
||
|
if (pRspExchange)
|
||
|
{
|
||
|
task.task_data = *pRspExchange;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspExchangeField empty_data = CQdpFtdcRspExchangeField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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(CQdpFtdcRspInvestorPositionField *pRspInvestorPosition, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPQRYINVESTORPOSITION;
|
||
|
|
||
|
if (pRspInvestorPosition)
|
||
|
{
|
||
|
task.task_data = *pRspInvestorPosition;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInvestorPositionField empty_data = CQdpFtdcRspInvestorPositionField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspSubscribeTopic(CQdpFtdcDisseminationField *pDissemination, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPSUBSCRIBETOPIC;
|
||
|
|
||
|
if (pDissemination)
|
||
|
{
|
||
|
task.task_data = *pDissemination;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcDisseminationField empty_data = CQdpFtdcDisseminationField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspQryTopic(CQdpFtdcDisseminationField *pDissemination, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPQRYTOPIC;
|
||
|
|
||
|
if (pDissemination)
|
||
|
{
|
||
|
task.task_data = *pDissemination;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcDisseminationField empty_data = CQdpFtdcDisseminationField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspQryInvestorFee(CQdpFtdcInvestorFeeField *pInvestorFee, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPQRYINVESTORFEE;
|
||
|
|
||
|
if (pInvestorFee)
|
||
|
{
|
||
|
task.task_data = *pInvestorFee;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcInvestorFeeField empty_data = CQdpFtdcInvestorFeeField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspQryInvestorMargin(CQdpFtdcInvestorMarginField *pInvestorMargin, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPQRYINVESTORMARGIN;
|
||
|
|
||
|
if (pInvestorMargin)
|
||
|
{
|
||
|
task.task_data = *pInvestorMargin;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcInvestorMarginField empty_data = CQdpFtdcInvestorMarginField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspQryExchangeDiffTime(CQdpFtdcRspExchangeDiffTimeField *pRspExchangeDiffTime, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPQRYEXCHANGEDIFFTIME;
|
||
|
|
||
|
if (pRspExchangeDiffTime)
|
||
|
{
|
||
|
task.task_data = *pRspExchangeDiffTime;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspExchangeDiffTimeField empty_data = CQdpFtdcRspExchangeDiffTimeField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspQryContractBank(CQdpFtdcContractBankField *pContractBank, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPQRYCONTRACTBANK;
|
||
|
|
||
|
if (pContractBank)
|
||
|
{
|
||
|
task.task_data = *pContractBank;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcContractBankField empty_data = CQdpFtdcContractBankField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspQueryBankAccountMoneyByFuture(CQdpFtdcReqQueryAccountField *pReqQueryAccount, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPQUERYBANKACCOUNTMONEYBYFUTURE;
|
||
|
|
||
|
if (pReqQueryAccount)
|
||
|
{
|
||
|
task.task_data = *pReqQueryAccount;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcReqQueryAccountField empty_data = CQdpFtdcReqQueryAccountField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspQryTransferSerial(CQdpFtdcTransferSerialField *pTransferSerial, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPQRYTRANSFERSERIAL;
|
||
|
|
||
|
if (pTransferSerial)
|
||
|
{
|
||
|
task.task_data = *pTransferSerial;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcTransferSerialField empty_data = CQdpFtdcTransferSerialField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspQrySGEDeferRate(CQdpFtdcSGEDeferRateField *pSGEDeferRate, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPQRYSGEDEFERRATE;
|
||
|
|
||
|
if (pSGEDeferRate)
|
||
|
{
|
||
|
task.task_data = *pSGEDeferRate;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcSGEDeferRateField empty_data = CQdpFtdcSGEDeferRateField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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::OnRspQryMarketData(CQdpFtdcMarketDataField *pMarketData, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
|
||
|
{
|
||
|
Task task = Task();
|
||
|
task.task_name = ONRSPQRYMARKETDATA;
|
||
|
|
||
|
if (pMarketData)
|
||
|
{
|
||
|
task.task_data = *pMarketData;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcMarketDataField empty_data = CQdpFtdcMarketDataField();
|
||
|
memset(&empty_data, 0, sizeof(empty_data));
|
||
|
task.task_data = empty_data;
|
||
|
}
|
||
|
|
||
|
if (pRspInfo)
|
||
|
{
|
||
|
task.task_error = *pRspInfo;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CQdpFtdcRspInfoField empty_error = CQdpFtdcRspInfoField();
|
||
|
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);
|
||
|
};
|
||
|
|