vnpy/vn.qdp/pyscript/qdp_md_function.cpp
chenxy123 b91f0dba61 增加vn.qdp模块,感谢国富期货的贡献!
QDP相关的代码尚未测试完成
2016-12-07 21:11:34 +08:00

79 lines
2.6 KiB
C++

int MdApi::reqUserLogin(dict req, int nRequestID)
{
CQdpFtdcReqUserLoginField myreq = CQdpFtdcReqUserLoginField();
memset(&myreq, 0, sizeof(myreq));
getStr(req, "MacAddress", myreq.MacAddress);
getStr(req, "UserProductInfo", myreq.UserProductInfo);
getStr(req, "UserID", myreq.UserID);
getInt(req, "DataCenterID", &myreq.DataCenterID);
getStr(req, "TradingDay", myreq.TradingDay);
getStr(req, "InterfaceProductInfo", myreq.InterfaceProductInfo);
getStr(req, "BrokerID", myreq.BrokerID);
getStr(req, "ClientIPAddress", myreq.ClientIPAddress);
getStr(req, "OneTimePassword", myreq.OneTimePassword);
getStr(req, "ProtocolInfo", myreq.ProtocolInfo);
getStr(req, "Password", myreq.Password);
getStr(req, "IPAddress", myreq.IPAddress);
int i = this->api->ReqUserLogin(&myreq, nRequestID);
return i;
};
int MdApi::reqUserLogout(dict req, int nRequestID)
{
CQdpFtdcReqUserLogoutField myreq = CQdpFtdcReqUserLogoutField();
memset(&myreq, 0, sizeof(myreq));
getStr(req, "UserID", myreq.UserID);
getStr(req, "BrokerID", myreq.BrokerID);
int i = this->api->ReqUserLogout(&myreq, nRequestID);
return i;
};
int MdApi::reqSubscribeTopic(dict req, int nRequestID)
{
CQdpFtdcDisseminationField myreq = CQdpFtdcDisseminationField();
memset(&myreq, 0, sizeof(myreq));
getInt(req, "SequenceNo", &myreq.SequenceNo);
getInt(req, "SequenceSeries", &myreq.SequenceSeries);
int i = this->api->ReqSubscribeTopic(&myreq, nRequestID);
return i;
};
int MdApi::reqQryTopic(dict req, int nRequestID)
{
CQdpFtdcDisseminationField myreq = CQdpFtdcDisseminationField();
memset(&myreq, 0, sizeof(myreq));
getInt(req, "SequenceNo", &myreq.SequenceNo);
getInt(req, "SequenceSeries", &myreq.SequenceSeries);
int i = this->api->ReqQryTopic(&myreq, nRequestID);
return i;
};
int MdApi::reqSubMarketData(dict req, int nRequestID)
{
CQdpFtdcSpecificInstrumentField myreq = CQdpFtdcSpecificInstrumentField();
memset(&myreq, 0, sizeof(myreq));
getStr(req, "InstrumentID", myreq.InstrumentID);
int i = this->api->ReqSubMarketData(&myreq, nRequestID);
return i;
};
int MdApi::reqUnSubMarketData(dict req, int nRequestID)
{
CQdpFtdcSpecificInstrumentField myreq = CQdpFtdcSpecificInstrumentField();
memset(&myreq, 0, sizeof(myreq));
getStr(req, "InstrumentID", myreq.InstrumentID);
int i = this->api->ReqUnSubMarketData(&myreq, nRequestID);
return i;
};
int MdApi::reqQryDepthMarketData(dict req, int nRequestID)
{
CQdpFtdcQryMarketDataField myreq = CQdpFtdcQryMarketDataField();
memset(&myreq, 0, sizeof(myreq));
getStr(req, "InstrumentID", myreq.InstrumentID);
getStr(req, "ExchangeID", myreq.ExchangeID);
int i = this->api->ReqQryDepthMarketData(&myreq, nRequestID);
return i;
};