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::OnRspError(CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { Task task = Task(); task.task_name = ONRSPERROR; 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::OnRspUserLogin(CSecurityFtdcUserLoginField *pUserLogin, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { Task task = Task(); task.task_name = ONRSPUSERLOGIN; if (pUserLogin) { task.task_data = *pUserLogin; } else { CSecurityFtdcUserLoginField empty_data = CSecurityFtdcUserLoginField(); 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::OnRspUserLogout(CSecurityFtdcUserLogoutField *pUserLogout, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { Task task = Task(); task.task_name = ONRSPUSERLOGOUT; 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) { 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::OnRspSubL2MarketData(CSecurityFtdcSpecificInstrumentField *pSpecificInstrument, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { Task task = Task(); task.task_name = ONRSPSUBL2MARKETDATA; if (pSpecificInstrument) { task.task_data = *pSpecificInstrument; } else { CSecurityFtdcSpecificInstrumentField empty_data = CSecurityFtdcSpecificInstrumentField(); 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::OnRspUnSubL2MarketData(CSecurityFtdcSpecificInstrumentField *pSpecificInstrument, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { Task task = Task(); task.task_name = ONRSPUNSUBL2MARKETDATA; if (pSpecificInstrument) { task.task_data = *pSpecificInstrument; } else { CSecurityFtdcSpecificInstrumentField empty_data = CSecurityFtdcSpecificInstrumentField(); 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::OnRspSubL2Index(CSecurityFtdcSpecificInstrumentField *pSpecificInstrument, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { Task task = Task(); task.task_name = ONRSPSUBL2INDEX; if (pSpecificInstrument) { task.task_data = *pSpecificInstrument; } else { CSecurityFtdcSpecificInstrumentField empty_data = CSecurityFtdcSpecificInstrumentField(); 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::OnRspUnSubL2Index(CSecurityFtdcSpecificInstrumentField *pSpecificInstrument, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { Task task = Task(); task.task_name = ONRSPUNSUBL2INDEX; if (pSpecificInstrument) { task.task_data = *pSpecificInstrument; } else { CSecurityFtdcSpecificInstrumentField empty_data = CSecurityFtdcSpecificInstrumentField(); 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::OnRtnL2MarketData(CSecurityFtdcL2MarketDataField *pL2MarketData) { Task task = Task(); task.task_name = ONRTNL2MARKETDATA; if (pL2MarketData) { task.task_data = *pL2MarketData; } else { CSecurityFtdcL2MarketDataField empty_data = CSecurityFtdcL2MarketDataField(); memset(&empty_data, 0, sizeof(empty_data)); task.task_data = empty_data; } this->task_queue.push(task); }; void TdApi::OnRtnL2Index(CSecurityFtdcL2IndexField *pL2Index) { Task task = Task(); task.task_name = ONRTNL2INDEX; if (pL2Index) { task.task_data = *pL2Index; } else { CSecurityFtdcL2IndexField empty_data = CSecurityFtdcL2IndexField(); memset(&empty_data, 0, sizeof(empty_data)); task.task_data = empty_data; } this->task_queue.push(task); }; void TdApi::OnRspSubL2OrderAndTrade(CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { Task task = Task(); task.task_name = ONRSPSUBL2ORDERANDTRADE; 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::OnRspUnSubL2OrderAndTrade(CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { Task task = Task(); task.task_name = ONRSPUNSUBL2ORDERANDTRADE; 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::OnRtnL2Order(CSecurityFtdcL2OrderField *pL2Order) { Task task = Task(); task.task_name = ONRTNL2ORDER; if (pL2Order) { task.task_data = *pL2Order; } else { CSecurityFtdcL2OrderField empty_data = CSecurityFtdcL2OrderField(); memset(&empty_data, 0, sizeof(empty_data)); task.task_data = empty_data; } this->task_queue.push(task); }; void TdApi::OnRtnL2Trade(CSecurityFtdcL2TradeField *pL2Trade) { Task task = Task(); task.task_name = ONRTNL2TRADE; if (pL2Trade) { task.task_data = *pL2Trade; } else { CSecurityFtdcL2TradeField empty_data = CSecurityFtdcL2TradeField(); memset(&empty_data, 0, sizeof(empty_data)); task.task_data = empty_data; } this->task_queue.push(task); }; void TdApi::OnNtfCheckOrderList(TSecurityFtdcInstrumentIDType InstrumentID, TSecurityFtdcFunctionCodeType FunctionCode) { Task task = Task(); task.task_name = ONNTFCHECKORDERLIST; if (nstrumentID) { task.task_data = InstrumentID; } else { TSecurityFtdcInstrumentIDType empty_data = TSecurityFtdcInstrumentIDType(); memset(&empty_data, 0, sizeof(empty_data)); task.task_data = empty_data; } if (unctionCode) { task.task_data = FunctionCode; } else { TSecurityFtdcFunctionCodeType empty_data = TSecurityFtdcFunctionCodeType(); memset(&empty_data, 0, sizeof(empty_data)); task.task_data = empty_data; } this->task_queue.push(task); };