vnpy/vn.lts/pyscript/lts_td_task.cpp

676 lines
18 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::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(CSecurityFtdcRspUserLoginField *pRspUserLogin, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPUSERLOGIN;
task.task_data = *pRspUserLogin;
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;
task.task_data = *pUserLogout;
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::OnRspOrderInsert(CSecurityFtdcInputOrderField *pInputOrder, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPORDERINSERT;
task.task_data = *pInputOrder;
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::OnRspOrderAction(CSecurityFtdcInputOrderActionField *pInputOrderAction, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPORDERACTION;
task.task_data = *pInputOrderAction;
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::OnRspUserPasswordUpdate(CSecurityFtdcUserPasswordUpdateField *pUserPasswordUpdate, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPUSERPASSWORDUPDATE;
task.task_data = *pUserPasswordUpdate;
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::OnRspTradingAccountPasswordUpdate(CSecurityFtdcTradingAccountPasswordUpdateField *pTradingAccountPasswordUpdate, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPTRADINGACCOUNTPASSWORDUPDATE;
task.task_data = *pTradingAccountPasswordUpdate;
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::OnRspQryExchange(CSecurityFtdcExchangeField *pExchange, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPQRYEXCHANGE;
task.task_data = *pExchange;
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::OnRspQryInstrument(CSecurityFtdcInstrumentField *pInstrument, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPQRYINSTRUMENT;
task.task_data = *pInstrument;
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::OnRspQryInvestor(CSecurityFtdcInvestorField *pInvestor, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPQRYINVESTOR;
task.task_data = *pInvestor;
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::OnRspQryTradingCode(CSecurityFtdcTradingCodeField *pTradingCode, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPQRYTRADINGCODE;
task.task_data = *pTradingCode;
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::OnRspQryTradingAccount(CSecurityFtdcTradingAccountField *pTradingAccount, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPQRYTRADINGACCOUNT;
task.task_data = *pTradingAccount;
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::OnRspQryDepthMarketData(CSecurityFtdcDepthMarketDataField *pDepthMarketData, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPQRYDEPTHMARKETDATA;
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);
};
void TdApi::OnRspQryBondInterest(CSecurityFtdcBondInterestField *pBondInterest, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPQRYBONDINTEREST;
task.task_data = *pBondInterest;
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::OnRspQryMarketRationInfo(CSecurityFtdcMarketRationInfoField *pMarketRationInfo, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPQRYMARKETRATIONINFO;
task.task_data = *pMarketRationInfo;
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::OnRspQryInstrumentCommissionRate(CSecurityFtdcInstrumentCommissionRateField *pInstrumentCommissionRate, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPQRYINSTRUMENTCOMMISSIONRATE;
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);
};
void TdApi::OnRspQryETFInstrument(CSecurityFtdcETFInstrumentField *pETFInstrument, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPQRYETFINSTRUMENT;
task.task_data = *pETFInstrument;
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::OnRspQryETFBasket(CSecurityFtdcETFBasketField *pETFBasket, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPQRYETFBASKET;
task.task_data = *pETFBasket;
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::OnRspQryOFInstrument(CSecurityFtdcOFInstrumentField *pOFInstrument, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPQRYOFINSTRUMENT;
task.task_data = *pOFInstrument;
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::OnRspQrySFInstrument(CSecurityFtdcSFInstrumentField *pSFInstrument, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPQRYSFINSTRUMENT;
task.task_data = *pSFInstrument;
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::OnRspQryOrder(CSecurityFtdcOrderField *pOrder, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPQRYORDER;
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);
};
void TdApi::OnRspQryTrade(CSecurityFtdcTradeField *pTrade, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPQRYTRADE;
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);
};
void TdApi::OnRspQryInvestorPosition(CSecurityFtdcInvestorPositionField *pInvestorPosition, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPQRYINVESTORPOSITION;
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);
};
void TdApi::OnRtnOrder(CSecurityFtdcOrderField *pOrder)
{
Task task = Task();
task.task_name = ONRTNORDER;
task.task_data = *pOrder;
this->task_queue.push(task);
};
void TdApi::OnRtnTrade(CSecurityFtdcTradeField *pTrade)
{
Task task = Task();
task.task_name = ONRTNTRADE;
task.task_data = *pTrade;
this->task_queue.push(task);
};
void TdApi::OnErrRtnOrderInsert(CSecurityFtdcInputOrderField *pInputOrder, CSecurityFtdcRspInfoField *pRspInfo)
{
Task task = Task();
task.task_name = ONERRRTNORDERINSERT;
task.task_data = *pInputOrder;
if (pRspInfo)
{
task.task_error = *pRspInfo;
}
else
{
CSecurityFtdcRspInfoField empty_error = CSecurityFtdcRspInfoField();
memset(&empty_error, 0, sizeof(empty_error));
task.task_error = empty_error;
}
this->task_queue.push(task);
};
void TdApi::OnErrRtnOrderAction(CSecurityFtdcOrderActionField *pOrderAction, CSecurityFtdcRspInfoField *pRspInfo)
{
Task task = Task();
task.task_name = ONERRRTNORDERACTION;
task.task_data = *pOrderAction;
if (pRspInfo)
{
task.task_error = *pRspInfo;
}
else
{
CSecurityFtdcRspInfoField empty_error = CSecurityFtdcRspInfoField();
memset(&empty_error, 0, sizeof(empty_error));
task.task_error = empty_error;
}
this->task_queue.push(task);
};
void TdApi::OnRspFundOutByLiber(CSecurityFtdcInputFundTransferField *pInputFundTransfer, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPFUNDOUTBYLIBER;
task.task_data = *pInputFundTransfer;
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::OnRtnFundOutByLiber(CSecurityFtdcFundTransferField *pFundTransfer)
{
Task task = Task();
task.task_name = ONRTNFUNDOUTBYLIBER;
task.task_data = *pFundTransfer;
this->task_queue.push(task);
};
void TdApi::OnErrRtnFundOutByLiber(CSecurityFtdcInputFundTransferField *pInputFundTransfer, CSecurityFtdcRspInfoField *pRspInfo)
{
Task task = Task();
task.task_name = ONERRRTNFUNDOUTBYLIBER;
task.task_data = *pInputFundTransfer;
if (pRspInfo)
{
task.task_error = *pRspInfo;
}
else
{
CSecurityFtdcRspInfoField empty_error = CSecurityFtdcRspInfoField();
memset(&empty_error, 0, sizeof(empty_error));
task.task_error = empty_error;
}
this->task_queue.push(task);
};
void TdApi::OnRtnFundInByBank(CSecurityFtdcFundTransferField *pFundTransfer)
{
Task task = Task();
task.task_name = ONRTNFUNDINBYBANK;
task.task_data = *pFundTransfer;
this->task_queue.push(task);
};
void TdApi::OnRspQryFundTransferSerial(CSecurityFtdcFundTransferField *pFundTransfer, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPQRYFUNDTRANSFERSERIAL;
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);
};
void TdApi::OnRspFundInterTransfer(CSecurityFtdcFundInterTransferField *pFundInterTransfer, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPFUNDINTERTRANSFER;
task.task_data = *pFundInterTransfer;
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::OnRspQryFundInterTransferSerial(CSecurityFtdcFundInterTransferSerialField *pFundInterTransferSerial, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPQRYFUNDINTERTRANSFERSERIAL;
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);
};
void TdApi::OnRtnFundInterTransferSerial(CSecurityFtdcFundInterTransferSerialField *pFundInterTransferSerial)
{
Task task = Task();
task.task_name = ONRTNFUNDINTERTRANSFERSERIAL;
task.task_data = *pFundInterTransferSerial;
this->task_queue.push(task);
};
void TdApi::OnErrRtnFundInterTransfer(CSecurityFtdcFundInterTransferField *pFundInterTransfer, CSecurityFtdcRspInfoField *pRspInfo)
{
Task task = Task();
task.task_name = ONERRRTNFUNDINTERTRANSFER;
task.task_data = *pFundInterTransfer;
if (pRspInfo)
{
task.task_error = *pRspInfo;
}
else
{
CSecurityFtdcRspInfoField empty_error = CSecurityFtdcRspInfoField();
memset(&empty_error, 0, sizeof(empty_error));
task.task_error = empty_error;
}
this->task_queue.push(task);
};