修复CTP封装中的bug

This commit is contained in:
chenxy123 2016-03-05 16:29:51 +08:00
parent bc1ce0372a
commit f540a66d15
7 changed files with 50 additions and 38 deletions

View File

@ -90,6 +90,7 @@
4. 基于VirtualBox的vn.py开发环境镜像解决部分用户反映项目初期不知该如何搭建开发环境的问题这个镜像会由官方长期维护下去
文章方面:
1.作者自己作为交易员的成长经历这一年来收到好多人关于如何成为Quant、建议看什么书、怎么选学校等类似的问题与其零散的回答不如介绍下自己的一些经历给大家参考可能更有帮助
2. vn.trader的使用教程目前基本除了代码里的注释什么都没有...

View File

@ -70,7 +70,7 @@ int TdApi::reqOrderInsert(dict req, int nRequestID)
getChar(req, "ContingentCondition", &myreq.ContingentCondition);
getStr(req, "CombOffsetFlag", myreq.CombOffsetFlag);
getStr(req, "UserID", myreq.UserID);
getStr(req, "UserID", myreq.UserID);
getDouble(req, "LimitPrice", &myreq.LimitPrice);
getInt(req, "UserForceClose", &myreq.UserForceClose);
getChar(req, "Direction", &myreq.Direction);
getInt(req, "IsSwapOrder", &myreq.IsSwapOrder);
@ -78,7 +78,7 @@ int TdApi::reqOrderInsert(dict req, int nRequestID)
getChar(req, "OrderPriceType", &myreq.OrderPriceType);
getChar(req, "TimeCondition", &myreq.TimeCondition);
getInt(req, "IsAutoSuspend", &myreq.IsAutoSuspend);
getInt(req, "IsAutoSuspend", &myreq.IsAutoSuspend);
getDouble(req, "StopPrice", &myreq.StopPrice);
getStr(req, "InstrumentID", myreq.InstrumentID);
getStr(req, "ExchangeID", myreq.ExchangeID);
getInt(req, "MinVolume", &myreq.MinVolume);
@ -102,7 +102,7 @@ int TdApi::reqParkedOrderInsert(dict req, int nRequestID)
getChar(req, "ContingentCondition", &myreq.ContingentCondition);
getStr(req, "CombOffsetFlag", myreq.CombOffsetFlag);
getStr(req, "UserID", myreq.UserID);
getStr(req, "UserID", myreq.UserID);
getDouble(req, "LimitPrice", &myreq.LimitPrice);
getInt(req, "UserForceClose", &myreq.UserForceClose);
getChar(req, "Status", &myreq.Status);
getChar(req, "Direction", &myreq.Direction);
@ -112,7 +112,7 @@ int TdApi::reqParkedOrderInsert(dict req, int nRequestID)
getChar(req, "OrderPriceType", &myreq.OrderPriceType);
getChar(req, "TimeCondition", &myreq.TimeCondition);
getInt(req, "IsAutoSuspend", &myreq.IsAutoSuspend);
getInt(req, "IsAutoSuspend", &myreq.IsAutoSuspend);
getDouble(req, "StopPrice", &myreq.StopPrice);
getStr(req, "InstrumentID", myreq.InstrumentID);
getStr(req, "ExchangeID", myreq.ExchangeID);
getInt(req, "MinVolume", &myreq.MinVolume);
@ -144,7 +144,7 @@ int TdApi::reqParkedOrderAction(dict req, int nRequestID)
getChar(req, "UserType", &myreq.UserType);
getStr(req, "ErrorMsg", myreq.ErrorMsg);
getStr(req, "UserID", myreq.UserID);
getStr(req, "UserID", myreq.UserID);
getDouble(req, "LimitPrice", &myreq.LimitPrice);
getStr(req, "OrderRef", myreq.OrderRef);
getStr(req, "InvestorID", myreq.InvestorID);
getInt(req, "SessionID", &myreq.SessionID);
@ -168,7 +168,7 @@ int TdApi::reqOrderAction(dict req, int nRequestID)
getChar(req, "ActionFlag", &myreq.ActionFlag);
getInt(req, "OrderActionRef", &myreq.OrderActionRef);
getStr(req, "UserID", myreq.UserID);
getStr(req, "UserID", myreq.UserID);
getDouble(req, "LimitPrice", &myreq.LimitPrice);
getStr(req, "OrderRef", myreq.OrderRef);
getStr(req, "InvestorID", myreq.InvestorID);
getInt(req, "SessionID", &myreq.SessionID);
@ -296,7 +296,7 @@ int TdApi::reqQuoteInsert(dict req, int nRequestID)
getStr(req, "ExchangeID", myreq.ExchangeID);
getChar(req, "AskHedgeFlag", &myreq.AskHedgeFlag);
getStr(req, "BusinessUnit", myreq.BusinessUnit);
getStr(req, "BusinessUnit", myreq.BusinessUnit);
getDouble(req, "AskPrice", &myreq.AskPrice);
getStr(req, "UserID", myreq.UserID);
getChar(req, "AskOffsetFlag", &myreq.AskOffsetFlag);
getInt(req, "BidVolume", &myreq.BidVolume);
@ -307,7 +307,7 @@ int TdApi::reqQuoteInsert(dict req, int nRequestID)
getStr(req, "BrokerID", myreq.BrokerID);
getInt(req, "RequestID", &myreq.RequestID);
getStr(req, "ForQuoteSysID", myreq.ForQuoteSysID);
getStr(req, "ForQuoteSysID", myreq.ForQuoteSysID);
getDouble(req, "BidPrice", &myreq.BidPrice);
getChar(req, "BidHedgeFlag", &myreq.BidHedgeFlag);
getStr(req, "QuoteRef", myreq.QuoteRef);
getStr(req, "BidOrderRef", myreq.BidOrderRef);
@ -680,9 +680,9 @@ int TdApi::reqQryOptionInstrTradeCost(dict req, int nRequestID)
CThostFtdcQryOptionInstrTradeCostField myreq = CThostFtdcQryOptionInstrTradeCostField();
memset(&myreq, 0, sizeof(myreq));
getStr(req, "InstrumentID", myreq.InstrumentID);
getStr(req, "InstrumentID", myreq.InstrumentID);
getStr(req, "ExchangeID", myreq.ExchangeID);
getDouble(req, "InputPrice", &myreq.InputPrice);
getStr(req, "ExchangeID", myreq.ExchangeID);
getDouble(req, "UnderlyingPrice", &myreq.UnderlyingPrice);
getChar(req, "HedgeFlag", &myreq.HedgeFlag);
getStr(req, "InvestorID", myreq.InvestorID);
getStr(req, "BrokerID", myreq.BrokerID);
@ -953,10 +953,10 @@ int TdApi::reqFromBankToFutureByFuture(dict req, int nRequestID)
getChar(req, "TransferStatus", &myreq.TransferStatus);
getChar(req, "IdCardType", &myreq.IdCardType);
getInt(req, "PlateSerial", &myreq.PlateSerial);
getInt(req, "PlateSerial", &myreq.PlateSerial);
getDouble(req, "FutureFetchAmount", &myreq.FutureFetchAmount);
getStr(req, "TradeDate", myreq.TradeDate);
getStr(req, "CurrencyID", myreq.CurrencyID);
getStr(req, "CurrencyID", myreq.CurrencyID);
getDouble(req, "BrokerFee", &myreq.BrokerFee);
getChar(req, "BankAccType", &myreq.BankAccType);
getChar(req, "LastFragment", &myreq.LastFragment);
getInt(req, "FutureSerial", &myreq.FutureSerial);
@ -964,8 +964,8 @@ int TdApi::reqFromBankToFutureByFuture(dict req, int nRequestID)
getStr(req, "BrokerIDByBank", myreq.BrokerIDByBank);
getChar(req, "SecuPwdFlag", &myreq.SecuPwdFlag);
getStr(req, "Message", myreq.Message);
getStr(req, "Message", myreq.Message);
getStr(req, "Message", myreq.Message);
getDouble(req, "CustFee", &myreq.CustFee);
getDouble(req, "TradeAmount", &myreq.TradeAmount);
getStr(req, "Digest", myreq.Digest);
int i = this->api->ReqFromBankToFutureByFuture(&myreq, nRequestID);
return i;
@ -1004,10 +1004,10 @@ int TdApi::reqFromFutureToBankByFuture(dict req, int nRequestID)
getChar(req, "TransferStatus", &myreq.TransferStatus);
getChar(req, "IdCardType", &myreq.IdCardType);
getInt(req, "PlateSerial", &myreq.PlateSerial);
getInt(req, "PlateSerial", &myreq.PlateSerial);
getDouble(req, "FutureFetchAmount", &myreq.FutureFetchAmount);
getStr(req, "TradeDate", myreq.TradeDate);
getStr(req, "CurrencyID", myreq.CurrencyID);
getStr(req, "CurrencyID", myreq.CurrencyID);
getDouble(req, "BrokerFee", &myreq.BrokerFee);
getChar(req, "BankAccType", &myreq.BankAccType);
getChar(req, "LastFragment", &myreq.LastFragment);
getInt(req, "FutureSerial", &myreq.FutureSerial);
@ -1015,8 +1015,8 @@ int TdApi::reqFromFutureToBankByFuture(dict req, int nRequestID)
getStr(req, "BrokerIDByBank", myreq.BrokerIDByBank);
getChar(req, "SecuPwdFlag", &myreq.SecuPwdFlag);
getStr(req, "Message", myreq.Message);
getStr(req, "Message", myreq.Message);
getStr(req, "Message", myreq.Message);
getDouble(req, "CustFee", &myreq.CustFee);
getDouble(req, "TradeAmount", &myreq.TradeAmount);
getStr(req, "Digest", myreq.Digest);
int i = this->api->ReqFromFutureToBankByFuture(&myreq, nRequestID);
return i;

View File

@ -245,10 +245,14 @@ def createFunction(fcName, fcArgsTypeList, fcArgsValueList):
line = '\tgetChar(req, "' + key + '", &myreq.' + key + ');\n'
elif value == 'int':
line = '\tgetInt(req, "' + key + '", &myreq.' + key + ');\n'
elif value == 'double':
elif value == 'float':
line = '\tgetDouble(req, "' + key + '", &myreq.' + key + ');\n'
ffunction.write(line)
if type_ == 'CThostFtdcInputOrderField':
print key, value
print line
ffunction.write('\tint i = this->api->' + fcName + '(&myreq, nRequestID);\n')
ffunction.write('\treturn i;\n')
@ -289,4 +293,6 @@ fdefine.close()
fheaderprocess.close()
fheaderon.close()
fheaderfunction.close()
fwrap.close()
fwrap.close()
input()

View File

@ -0,0 +1,5 @@
<?xml version="1.0"?>
<SubscriptionDataContainer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:Microsoft.VisualStudio.WindowsAzure.CommonAzureTools.Authentication.CacheManagement">
<Items />
<TokenCache>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAhE4p+D02F0WYPy8qCmMXxAAAAAACAAAAAAAQZgAAAAEAACAAAABqqZf7eO/8AqQFqurp2lQDI7ZnZtjWpYLxdEZZGWoeTgAAAAAOgAAAAAIAACAAAACO1demA+YL03Dkjrvv0fYv1k0mGB4XD5t7YYCfD7RdCBAAAACmf9hwg57+FQ2Y5W5BmkdtQAAAAO2Nz3wpQbXLHeGtVRYjAqDcPS8ZJZJVEQ17yhmhHxf12PU4Ru3qr5bEI9j6zaanFd0dF00D4aUwUNKJ5o5raII=</TokenCache>
</SubscriptionDataContainer>

Binary file not shown.

View File

@ -7936,7 +7936,7 @@ int TdApi::reqOrderInsert(dict req, int nRequestID)
getChar(req, "ContingentCondition", &myreq.ContingentCondition);
getStr(req, "CombOffsetFlag", myreq.CombOffsetFlag);
getStr(req, "UserID", myreq.UserID);
getStr(req, "UserID", myreq.UserID);
getDouble(req, "LimitPrice", &myreq.LimitPrice);
getInt(req, "UserForceClose", &myreq.UserForceClose);
getChar(req, "Direction", &myreq.Direction);
getInt(req, "IsSwapOrder", &myreq.IsSwapOrder);
@ -7944,7 +7944,7 @@ int TdApi::reqOrderInsert(dict req, int nRequestID)
getChar(req, "OrderPriceType", &myreq.OrderPriceType);
getChar(req, "TimeCondition", &myreq.TimeCondition);
getInt(req, "IsAutoSuspend", &myreq.IsAutoSuspend);
getInt(req, "IsAutoSuspend", &myreq.IsAutoSuspend);
getDouble(req, "StopPrice", &myreq.StopPrice);
getStr(req, "InstrumentID", myreq.InstrumentID);
getStr(req, "ExchangeID", myreq.ExchangeID);
getInt(req, "MinVolume", &myreq.MinVolume);
@ -7968,7 +7968,7 @@ int TdApi::reqParkedOrderInsert(dict req, int nRequestID)
getChar(req, "ContingentCondition", &myreq.ContingentCondition);
getStr(req, "CombOffsetFlag", myreq.CombOffsetFlag);
getStr(req, "UserID", myreq.UserID);
getStr(req, "UserID", myreq.UserID);
getDouble(req, "LimitPrice", &myreq.LimitPrice);
getInt(req, "UserForceClose", &myreq.UserForceClose);
getChar(req, "Status", &myreq.Status);
getChar(req, "Direction", &myreq.Direction);
@ -7978,7 +7978,7 @@ int TdApi::reqParkedOrderInsert(dict req, int nRequestID)
getChar(req, "OrderPriceType", &myreq.OrderPriceType);
getChar(req, "TimeCondition", &myreq.TimeCondition);
getInt(req, "IsAutoSuspend", &myreq.IsAutoSuspend);
getInt(req, "IsAutoSuspend", &myreq.IsAutoSuspend);
getDouble(req, "StopPrice", &myreq.StopPrice);
getStr(req, "InstrumentID", myreq.InstrumentID);
getStr(req, "ExchangeID", myreq.ExchangeID);
getInt(req, "MinVolume", &myreq.MinVolume);
@ -8010,7 +8010,7 @@ int TdApi::reqParkedOrderAction(dict req, int nRequestID)
getChar(req, "UserType", &myreq.UserType);
getStr(req, "ErrorMsg", myreq.ErrorMsg);
getStr(req, "UserID", myreq.UserID);
getStr(req, "UserID", myreq.UserID);
getDouble(req, "LimitPrice", &myreq.LimitPrice);
getStr(req, "OrderRef", myreq.OrderRef);
getStr(req, "InvestorID", myreq.InvestorID);
getInt(req, "SessionID", &myreq.SessionID);
@ -8034,7 +8034,7 @@ int TdApi::reqOrderAction(dict req, int nRequestID)
getChar(req, "ActionFlag", &myreq.ActionFlag);
getInt(req, "OrderActionRef", &myreq.OrderActionRef);
getStr(req, "UserID", myreq.UserID);
getStr(req, "UserID", myreq.UserID);
getDouble(req, "LimitPrice", &myreq.LimitPrice);
getStr(req, "OrderRef", myreq.OrderRef);
getStr(req, "InvestorID", myreq.InvestorID);
getInt(req, "SessionID", &myreq.SessionID);
@ -8162,7 +8162,7 @@ int TdApi::reqQuoteInsert(dict req, int nRequestID)
getStr(req, "ExchangeID", myreq.ExchangeID);
getChar(req, "AskHedgeFlag", &myreq.AskHedgeFlag);
getStr(req, "BusinessUnit", myreq.BusinessUnit);
getStr(req, "BusinessUnit", myreq.BusinessUnit);
getDouble(req, "AskPrice", &myreq.AskPrice);
getStr(req, "UserID", myreq.UserID);
getChar(req, "AskOffsetFlag", &myreq.AskOffsetFlag);
getInt(req, "BidVolume", &myreq.BidVolume);
@ -8173,7 +8173,7 @@ int TdApi::reqQuoteInsert(dict req, int nRequestID)
getStr(req, "BrokerID", myreq.BrokerID);
getInt(req, "RequestID", &myreq.RequestID);
getStr(req, "ForQuoteSysID", myreq.ForQuoteSysID);
getStr(req, "ForQuoteSysID", myreq.ForQuoteSysID);
getDouble(req, "BidPrice", &myreq.BidPrice);
getChar(req, "BidHedgeFlag", &myreq.BidHedgeFlag);
getStr(req, "QuoteRef", myreq.QuoteRef);
getStr(req, "BidOrderRef", myreq.BidOrderRef);
@ -8546,9 +8546,9 @@ int TdApi::reqQryOptionInstrTradeCost(dict req, int nRequestID)
CThostFtdcQryOptionInstrTradeCostField myreq = CThostFtdcQryOptionInstrTradeCostField();
memset(&myreq, 0, sizeof(myreq));
getStr(req, "InstrumentID", myreq.InstrumentID);
getStr(req, "InstrumentID", myreq.InstrumentID);
getStr(req, "ExchangeID", myreq.ExchangeID);
getDouble(req, "InputPrice", &myreq.InputPrice);
getStr(req, "ExchangeID", myreq.ExchangeID);
getDouble(req, "UnderlyingPrice", &myreq.UnderlyingPrice);
getChar(req, "HedgeFlag", &myreq.HedgeFlag);
getStr(req, "InvestorID", myreq.InvestorID);
getStr(req, "BrokerID", myreq.BrokerID);
@ -8819,10 +8819,10 @@ int TdApi::reqFromBankToFutureByFuture(dict req, int nRequestID)
getChar(req, "TransferStatus", &myreq.TransferStatus);
getChar(req, "IdCardType", &myreq.IdCardType);
getInt(req, "PlateSerial", &myreq.PlateSerial);
getInt(req, "PlateSerial", &myreq.PlateSerial);
getDouble(req, "FutureFetchAmount", &myreq.FutureFetchAmount);
getStr(req, "TradeDate", myreq.TradeDate);
getStr(req, "CurrencyID", myreq.CurrencyID);
getStr(req, "CurrencyID", myreq.CurrencyID);
getDouble(req, "BrokerFee", &myreq.BrokerFee);
getChar(req, "BankAccType", &myreq.BankAccType);
getChar(req, "LastFragment", &myreq.LastFragment);
getInt(req, "FutureSerial", &myreq.FutureSerial);
@ -8830,8 +8830,8 @@ int TdApi::reqFromBankToFutureByFuture(dict req, int nRequestID)
getStr(req, "BrokerIDByBank", myreq.BrokerIDByBank);
getChar(req, "SecuPwdFlag", &myreq.SecuPwdFlag);
getStr(req, "Message", myreq.Message);
getStr(req, "Message", myreq.Message);
getStr(req, "Message", myreq.Message);
getDouble(req, "CustFee", &myreq.CustFee);
getDouble(req, "TradeAmount", &myreq.TradeAmount);
getStr(req, "Digest", myreq.Digest);
int i = this->api->ReqFromBankToFutureByFuture(&myreq, nRequestID);
return i;
@ -8870,10 +8870,10 @@ int TdApi::reqFromFutureToBankByFuture(dict req, int nRequestID)
getChar(req, "TransferStatus", &myreq.TransferStatus);
getChar(req, "IdCardType", &myreq.IdCardType);
getInt(req, "PlateSerial", &myreq.PlateSerial);
getInt(req, "PlateSerial", &myreq.PlateSerial);
getDouble(req, "FutureFetchAmount", &myreq.FutureFetchAmount);
getStr(req, "TradeDate", myreq.TradeDate);
getStr(req, "CurrencyID", myreq.CurrencyID);
getStr(req, "CurrencyID", myreq.CurrencyID);
getDouble(req, "BrokerFee", &myreq.BrokerFee);
getChar(req, "BankAccType", &myreq.BankAccType);
getChar(req, "LastFragment", &myreq.LastFragment);
getInt(req, "FutureSerial", &myreq.FutureSerial);
@ -8881,8 +8881,8 @@ int TdApi::reqFromFutureToBankByFuture(dict req, int nRequestID)
getStr(req, "BrokerIDByBank", myreq.BrokerIDByBank);
getChar(req, "SecuPwdFlag", &myreq.SecuPwdFlag);
getStr(req, "Message", myreq.Message);
getStr(req, "Message", myreq.Message);
getStr(req, "Message", myreq.Message);
getDouble(req, "CustFee", &myreq.CustFee);
getDouble(req, "TradeAmount", &myreq.TradeAmount);
getStr(req, "Digest", myreq.Digest);
int i = this->api->ReqFromFutureToBankByFuture(&myreq, nRequestID);
return i;

Binary file not shown.