vnpy/vn.lts/pyscript/lts_td_function.cpp
2016-07-02 11:12:56 +08:00

151 lines
5.8 KiB
C++

int TdApi::reqUserLogin(dict req, int nRequestID)
{
CSecurityFtdcReqUserLoginField myreq = CSecurityFtdcReqUserLoginField();
memset(&myreq, 0, sizeof(myreq));
getChar(req, "MacAddress", myreq.MacAddress);
getChar(req, "RandCode", myreq.RandCode);
getChar(req, "UserProductInfo", myreq.UserProductInfo);
getChar(req, "UserID", myreq.UserID);
getChar(req, "AuthCode", myreq.AuthCode);
getChar(req, "TradingDay", myreq.TradingDay);
getChar(req, "InterfaceProductInfo", myreq.InterfaceProductInfo);
getChar(req, "BrokerID", myreq.BrokerID);
getChar(req, "ClientIPAddress", myreq.ClientIPAddress);
getChar(req, "OneTimePassword", myreq.OneTimePassword);
getChar(req, "ProtocolInfo", myreq.ProtocolInfo);
getChar(req, "Password", myreq.Password);
getChar(req, "HDSerialNumber", myreq.HDSerialNumber);
int i = this->api->ReqUserLogin(&myreq, nRequestID);
return i;
};
int TdApi::reqUserLogout(dict req, int nRequestID)
{
CSecurityFtdcUserLogoutField myreq = CSecurityFtdcUserLogoutField();
memset(&myreq, 0, sizeof(myreq));
getChar(req, "UserID", myreq.UserID);
getChar(req, "BrokerID", myreq.BrokerID);
int i = this->api->ReqUserLogout(&myreq, nRequestID);
return i;
};
int TdApi::reqFetchAuthRandCode(dict req, int nRequestID)
{
CSecurityFtdcAuthRandCodeField myreq = CSecurityFtdcAuthRandCodeField();
memset(&myreq, 0, sizeof(myreq));
getChar(req, "RandCode", myreq.RandCode);
int i = this->api->ReqFetchAuthRandCode(&myreq, nRequestID);
return i;
};
int TdApi::reqOrderInsert(dict req, int nRequestID)
{
CSecurityFtdcInputOrderField myreq = CSecurityFtdcInputOrderField();
memset(&myreq, 0, sizeof(myreq));
getChar(req, "ContingentCondition", myreq.ContingentCondition);
getChar(req, "CombOffsetFlag", myreq.CombOffsetFlag);
getChar(req, "UserID", myreq.UserID);
getChar(req, "LimitPrice", myreq.LimitPrice);
getInt(req, "UserForceClose", &myreq.UserForceClose);
getChar(req, "Direction", myreq.Direction);
getInt(req, "VolumeTotalOriginal", &myreq.VolumeTotalOriginal);
getChar(req, "OrderPriceType", myreq.OrderPriceType);
getChar(req, "TimeCondition", myreq.TimeCondition);
getInt(req, "IsAutoSuspend", &myreq.IsAutoSuspend);
getInt(req, "IsAutoSuspend", &myreq.IsAutoSuspend);
getChar(req, "InstrumentID", myreq.InstrumentID);
getChar(req, "ExchangeID", myreq.ExchangeID);
getInt(req, "MinVolume", &myreq.MinVolume);
getChar(req, "ForceCloseReason", myreq.ForceCloseReason);
getChar(req, "BrokerID", myreq.BrokerID);
getChar(req, "CombHedgeFlag", myreq.CombHedgeFlag);
getChar(req, "GTDDate", myreq.GTDDate);
getChar(req, "BusinessUnit", myreq.BusinessUnit);
getChar(req, "OrderRef", myreq.OrderRef);
getChar(req, "InvestorID", myreq.InvestorID);
getChar(req, "VolumeCondition", myreq.VolumeCondition);
getInt(req, "RequestID", &myreq.RequestID);
int i = this->api->ReqOrderInsert(&myreq, nRequestID);
return i;
};
int TdApi::reqOrderAction(dict req, int nRequestID)
{
CSecurityFtdcInputOrderActionField myreq = CSecurityFtdcInputOrderActionField();
memset(&myreq, 0, sizeof(myreq));
getChar(req, "InstrumentID", myreq.InstrumentID);
getChar(req, "ExchangeID", myreq.ExchangeID);
getChar(req, "OrderLocalID", myreq.OrderLocalID);
getInt(req, "OrderActionRef", &myreq.OrderActionRef);
getChar(req, "UserID", myreq.UserID);
getChar(req, "UserID", myreq.UserID);
getChar(req, "OrderRef", myreq.OrderRef);
getChar(req, "InvestorID", myreq.InvestorID);
getInt(req, "SessionID", &myreq.SessionID);
getInt(req, "VolumeChange", &myreq.VolumeChange);
getChar(req, "BrokerID", myreq.BrokerID);
getInt(req, "RequestID", &myreq.RequestID);
getChar(req, "ActionFlag", myreq.ActionFlag);
getInt(req, "FrontID", &myreq.FrontID);
getChar(req, "BranchPBU", myreq.BranchPBU);
int i = this->api->ReqOrderAction(&myreq, nRequestID);
return i;
};
int TdApi::reqUserPasswordUpdate(dict req, int nRequestID)
{
CSecurityFtdcUserPasswordUpdateField myreq = CSecurityFtdcUserPasswordUpdateField();
memset(&myreq, 0, sizeof(myreq));
getChar(req, "UserID", myreq.UserID);
getChar(req, "NewPassword", myreq.NewPassword);
getChar(req, "OldPassword", myreq.OldPassword);
getChar(req, "BrokerID", myreq.BrokerID);
int i = this->api->ReqUserPasswordUpdate(&myreq, nRequestID);
return i;
};
int TdApi::reqTradingAccountPasswordUpdate(dict req, int nRequestID)
{
CSecurityFtdcTradingAccountPasswordUpdateField myreq = CSecurityFtdcTradingAccountPasswordUpdateField();
memset(&myreq, 0, sizeof(myreq));
getChar(req, "NewPassword", myreq.NewPassword);
getChar(req, "OldPassword", myreq.OldPassword);
getChar(req, "BrokerID", myreq.BrokerID);
getChar(req, "AccountID", myreq.AccountID);
int i = this->api->ReqTradingAccountPasswordUpdate(&myreq, nRequestID);
return i;
};
int TdApi::reqFundOutByLiber(dict req, int nRequestID)
{
CSecurityFtdcInputFundTransferField myreq = CSecurityFtdcInputFundTransferField();
memset(&myreq, 0, sizeof(myreq));
getChar(req, "UserID", myreq.UserID);
getChar(req, "InvestorID", myreq.InvestorID);
getChar(req, "BrokerID", myreq.BrokerID);
getChar(req, "AccountType", myreq.AccountType);
getChar(req, "Password", myreq.Password);
getChar(req, "Password", myreq.Password);
getChar(req, "Digest", myreq.Digest);
getChar(req, "AccountID", myreq.AccountID);
int i = this->api->ReqFundOutByLiber(&myreq, nRequestID);
return i;
};
int TdApi::reqFundInterTransfer(dict req, int nRequestID)
{
CSecurityFtdcFundInterTransferField myreq = CSecurityFtdcFundInterTransferField();
memset(&myreq, 0, sizeof(myreq));
getInt(req, "SerialID", &myreq.SerialID);
getChar(req, "TransferType", myreq.TransferType);
getChar(req, "UserID", myreq.UserID);
getChar(req, "InvestorID", myreq.InvestorID);
getChar(req, "BrokerID", myreq.BrokerID);
getChar(req, "Password", myreq.Password);
getChar(req, "Password", myreq.Password);
getChar(req, "AccountID", myreq.AccountID);
int i = this->api->ReqFundInterTransfer(&myreq, nRequestID);
return i;
};