From 4acc31597ee025262dd2d9c9423495768c4b6eb6 Mon Sep 17 00:00:00 2001 From: msincenselee Date: Mon, 19 Aug 2019 09:09:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0ctp=E6=8E=A5=E5=8F=A3api?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E7=9A=84=E8=A7=A3=E5=86=B3=E6=96=B9=E6=A1=88?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96=E6=8C=81=E4=BB=93?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/api/ctp/vnctpmd/vnctpmd/vnctpmd.sln | 31 ++++++++++++++++++++ vnpy/api/ctp/vnctptd/vnctptd/vnctptd.sln | 31 ++++++++++++++++++++ vnpy/trader/gateway/ctpGateway/ctpGateway.py | 4 +-- 3 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 vnpy/api/ctp/vnctpmd/vnctpmd/vnctpmd.sln create mode 100644 vnpy/api/ctp/vnctptd/vnctptd/vnctptd.sln diff --git a/vnpy/api/ctp/vnctpmd/vnctpmd/vnctpmd.sln b/vnpy/api/ctp/vnctpmd/vnctpmd/vnctpmd.sln new file mode 100644 index 00000000..13e7a30b --- /dev/null +++ b/vnpy/api/ctp/vnctpmd/vnctpmd/vnctpmd.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.489 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vnctpmd", "vnctpmd.vcxproj", "{2F0C046E-B41E-40E7-BB36-26249FA40DC1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2F0C046E-B41E-40E7-BB36-26249FA40DC1}.Debug|x64.ActiveCfg = Debug|x64 + {2F0C046E-B41E-40E7-BB36-26249FA40DC1}.Debug|x64.Build.0 = Debug|x64 + {2F0C046E-B41E-40E7-BB36-26249FA40DC1}.Debug|x86.ActiveCfg = Debug|Win32 + {2F0C046E-B41E-40E7-BB36-26249FA40DC1}.Debug|x86.Build.0 = Debug|Win32 + {2F0C046E-B41E-40E7-BB36-26249FA40DC1}.Release|x64.ActiveCfg = Release|x64 + {2F0C046E-B41E-40E7-BB36-26249FA40DC1}.Release|x64.Build.0 = Release|x64 + {2F0C046E-B41E-40E7-BB36-26249FA40DC1}.Release|x86.ActiveCfg = Release|Win32 + {2F0C046E-B41E-40E7-BB36-26249FA40DC1}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EAF93A09-031B-4CE4-8304-31CD7C88637C} + EndGlobalSection +EndGlobal diff --git a/vnpy/api/ctp/vnctptd/vnctptd/vnctptd.sln b/vnpy/api/ctp/vnctptd/vnctptd/vnctptd.sln new file mode 100644 index 00000000..daf6fbc3 --- /dev/null +++ b/vnpy/api/ctp/vnctptd/vnctptd/vnctptd.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.489 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vnctptd", "vnctptd.vcxproj", "{69635369-B64A-44F5-88E9-82CBD72EBE2E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {69635369-B64A-44F5-88E9-82CBD72EBE2E}.Debug|x64.ActiveCfg = Debug|x64 + {69635369-B64A-44F5-88E9-82CBD72EBE2E}.Debug|x64.Build.0 = Debug|x64 + {69635369-B64A-44F5-88E9-82CBD72EBE2E}.Debug|x86.ActiveCfg = Debug|Win32 + {69635369-B64A-44F5-88E9-82CBD72EBE2E}.Debug|x86.Build.0 = Debug|Win32 + {69635369-B64A-44F5-88E9-82CBD72EBE2E}.Release|x64.ActiveCfg = Release|x64 + {69635369-B64A-44F5-88E9-82CBD72EBE2E}.Release|x64.Build.0 = Release|x64 + {69635369-B64A-44F5-88E9-82CBD72EBE2E}.Release|x86.ActiveCfg = Release|Win32 + {69635369-B64A-44F5-88E9-82CBD72EBE2E}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4C05450B-547E-4B43-A88E-152593CCF6B3} + EndGlobalSection +EndGlobal diff --git a/vnpy/trader/gateway/ctpGateway/ctpGateway.py b/vnpy/trader/gateway/ctpGateway/ctpGateway.py index 9b7a83b0..755888e4 100644 --- a/vnpy/trader/gateway/ctpGateway/ctpGateway.py +++ b/vnpy/trader/gateway/ctpGateway/ctpGateway.py @@ -1062,9 +1062,7 @@ class CtpTdApi(TdApi): exchange = self.symbolExchangeDict.get(pos.symbol, EXCHANGE_UNKNOWN) # 获取size - if pos.symbol not in self.symbolSizeDict: - return - size = self.symbolSizeDict[pos.symbol] + size = self.symbolSizeDict.get(pos.symbol,10) # 针对上期所持仓的今昨分条返回(有昨仓、无今仓),读取昨仓数据 if exchange in [EXCHANGE_SHFE, EXCHANGE_INE]: