diff --git a/README.md b/README.md index cdb53a34..9867a375 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,7 @@ 4. 基于VirtualBox的vn.py开发环境镜像,解决部分用户反映项目初期不知该如何搭建开发环境的问题,这个镜像会由官方长期维护下去 文章方面: + 1.作者自己作为交易员的成长经历(这一年来收到好多人关于如何成为Quant、建议看什么书、怎么选学校等类似的问题,与其零散的回答不如介绍下自己的一些经历给大家参考可能更有帮助) 2. vn.trader的使用教程(目前基本除了代码里的注释什么都没有...) diff --git a/vn.ctp/pyscript/ctp_td_function.cpp b/vn.ctp/pyscript/ctp_td_function.cpp index 0b9378ad..b3d4cf29 100644 --- a/vn.ctp/pyscript/ctp_td_function.cpp +++ b/vn.ctp/pyscript/ctp_td_function.cpp @@ -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; diff --git a/vn.ctp/pyscript/generate_td_functions.py b/vn.ctp/pyscript/generate_td_functions.py index 11efbab7..48af5fb2 100644 --- a/vn.ctp/pyscript/generate_td_functions.py +++ b/vn.ctp/pyscript/generate_td_functions.py @@ -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() \ No newline at end of file +fwrap.close() + +input() \ No newline at end of file diff --git a/vn.ctp/vnctptd/Visual Studio 2013/settings/Windows Azure Subscriptions.xml b/vn.ctp/vnctptd/Visual Studio 2013/settings/Windows Azure Subscriptions.xml new file mode 100644 index 00000000..5866a6cd --- /dev/null +++ b/vn.ctp/vnctptd/Visual Studio 2013/settings/Windows Azure Subscriptions.xml @@ -0,0 +1,5 @@ + + + + AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAhE4p+D02F0WYPy8qCmMXxAAAAAACAAAAAAAQZgAAAAEAACAAAABqqZf7eO/8AqQFqurp2lQDI7ZnZtjWpYLxdEZZGWoeTgAAAAAOgAAAAAIAACAAAACO1demA+YL03Dkjrvv0fYv1k0mGB4XD5t7YYCfD7RdCBAAAACmf9hwg57+FQ2Y5W5BmkdtQAAAAO2Nz3wpQbXLHeGtVRYjAqDcPS8ZJZJVEQ17yhmhHxf12PU4Ru3qr5bEI9j6zaanFd0dF00D4aUwUNKJ5o5raII= + \ No newline at end of file diff --git a/vn.ctp/vnctptd/test/vnctptd.pyd b/vn.ctp/vnctptd/test/vnctptd.pyd index 0d377b84..7c6b86d9 100644 Binary files a/vn.ctp/vnctptd/test/vnctptd.pyd and b/vn.ctp/vnctptd/test/vnctptd.pyd differ diff --git a/vn.ctp/vnctptd/vnctptd/vnctptd.cpp b/vn.ctp/vnctptd/vnctptd/vnctptd.cpp index a691b226..24e42f7d 100644 --- a/vn.ctp/vnctptd/vnctptd/vnctptd.cpp +++ b/vn.ctp/vnctptd/vnctptd/vnctptd.cpp @@ -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; diff --git a/vn.trader/ctpGateway/vnctptd.pyd b/vn.trader/ctpGateway/vnctptd.pyd index 0d377b84..7c6b86d9 100644 Binary files a/vn.trader/ctpGateway/vnctptd.pyd and b/vn.trader/ctpGateway/vnctptd.pyd differ