完成QDP测试

This commit is contained in:
chenxy123 2016-12-12 22:52:39 +08:00
parent cf752b4128
commit d1f196a4aa
11 changed files with 465 additions and 471 deletions

View File

@ -1,5 +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+sBAAAAyRIhRmRN8UK7w5RuPHePCQAAAAACAAAAAAAQZgAAAAEAACAAAACQk+guh+ywWR7iJKHx4q/rl8GJs1w1kHOBDxLxLwyRwQAAAAAOgAAAAAIAACAAAABPgLw+AuxePq11TX16PdB1NyHEqJD1OGjxXDrk6zI58BAAAABDp/NWkif0PpHu24ZiWNDpQAAAAD6czV67awJHJ1Lad1N571p8XaKpngFM3+M/dUiuA7rb48Ig57TRmOwHTcx9xbSoJ+NTqxs+B47Ro2YPRnS43xc=</TokenCache>
<TokenCache>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAyRIhRmRN8UK7w5RuPHePCQAAAAACAAAAAAAQZgAAAAEAACAAAAChADhs2/yOAe5Vk4jrTcDim0CaDy9YY+o9lhRguoeP0wAAAAAOgAAAAAIAACAAAAAOB6PCBww/fcrV5HJqxMRvxrEecaNTZTGxqhs9412B4xAAAAB7qrpwNcKNMR4DD2O4atz6QAAAACwNgHEKJoRYjwYImBMY1oeq3bWFGTEUA5QJ+KK26sC2YlGfFqLb8g70FZnPfIGieZYSl8sYVTiFo4hAwyODdro=</TokenCache>
</SubscriptionDataContainer>

View File

@ -904,7 +904,6 @@ int MdApi::exit()
//该函数在原生API里没有用于安全退出API用原生的join似乎不太稳定
this->api->RegisterSpi(NULL);
this->api->Release();
// this->api->Join();
this->api = NULL;
return 1;
};

View File

@ -107,12 +107,12 @@
<ClCompile Include="vnqdpmd.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\qdpapi\qdpmdapi.dll" />
<None Include="..\..\..\qdpapi\qdptraderapi.dll" />
<None Include="..\..\qdpapi\qdpmdapi.dll" />
<None Include="..\..\qdpapi\qdptraderapi.dll" />
</ItemGroup>
<ItemGroup>
<Library Include="..\..\..\qdpapi\qdpmdapi.lib" />
<Library Include="..\..\..\qdpapi\qdptraderapi.lib" />
<Library Include="..\..\qdpapi\qdpmdapi.lib" />
<Library Include="..\..\qdpapi\qdptraderapi.lib" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -52,18 +52,18 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\qdpapi\qdpmdapi.dll">
<None Include="..\..\qdpapi\qdpmdapi.dll">
<Filter>Resource Files</Filter>
</None>
<None Include="..\..\..\qdpapi\qdptraderapi.dll">
<None Include="..\..\qdpapi\qdptraderapi.dll">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Library Include="..\..\..\qdpapi\qdpmdapi.lib">
<Library Include="..\..\qdpapi\qdpmdapi.lib">
<Filter>Resource Files</Filter>
</Library>
<Library Include="..\..\..\qdpapi\qdptraderapi.lib">
<Library Include="..\..\qdpapi\qdptraderapi.lib">
<Filter>Resource Files</Filter>
</Library>
</ItemGroup>

View File

@ -1,5 +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+sBAAAAyRIhRmRN8UK7w5RuPHePCQAAAAACAAAAAAAQZgAAAAEAACAAAAAAl4/w4VyqjUA3HilyerwjMwA8XWYuFqc0TymfwFacrgAAAAAOgAAAAAIAACAAAAA70M9sM2rW/I2svTmUIna/CghrIcaZufLj9Cra+3ylJRAAAABdxANXJfXRyoQazkSdgBYkQAAAAOmsd+eZrQTZXzPUzzcUIgIQDnT2hVaEGUrkkSKoTBipziykhRHEZOhlPWbHeZvg4aiJQcT7GeYyqyYKHBbl+aw=</TokenCache>
<TokenCache>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAyRIhRmRN8UK7w5RuPHePCQAAAAACAAAAAAAQZgAAAAEAACAAAACxOAY/ulOgIdKvYR/ZQqTfqRah3JAQMxXe+X25cv2+JwAAAAAOgAAAAAIAACAAAABCto2lfkqcOVxEbw8DDKUJp07D/UYM7fyE7OKy8TTaPhAAAADmLpTeNvhPv+/WFM0Tz/gLQAAAABK/J1c7r+qPkhqb66sIkaBRRnG9xXxu4mDv7XDJzpbEL2Ovv4sW1Fc0nAtb+9TLNb0RcXcBPqgi0IAZVbWOzWg=</TokenCache>
</SubscriptionDataContainer>

View File

@ -83,10 +83,10 @@
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\qdpapi\QdpFtdcMdApi.h" />
<ClInclude Include="..\..\..\qdpapi\QdpFtdcTraderApi.h" />
<ClInclude Include="..\..\..\qdpapi\QdpFtdcUserApiDataType.h" />
<ClInclude Include="..\..\..\qdpapi\QdpFtdcUserApiStruct.h" />
<ClInclude Include="..\..\qdpapi\QdpFtdcMdApi.h" />
<ClInclude Include="..\..\qdpapi\QdpFtdcTraderApi.h" />
<ClInclude Include="..\..\qdpapi\QdpFtdcUserApiDataType.h" />
<ClInclude Include="..\..\qdpapi\QdpFtdcUserApiStruct.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="vnqdptd.h" />
@ -107,12 +107,12 @@
<ClCompile Include="vnqdptd.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\qdpapi\qdpmdapi.dll" />
<None Include="..\..\..\qdpapi\qdptraderapi.dll" />
<None Include="..\..\qdpapi\qdpmdapi.dll" />
<None Include="..\..\qdpapi\qdptraderapi.dll" />
</ItemGroup>
<ItemGroup>
<Library Include="..\..\..\qdpapi\qdpmdapi.lib" />
<Library Include="..\..\..\qdpapi\qdptraderapi.lib" />
<Library Include="..\..\qdpapi\qdpmdapi.lib" />
<Library Include="..\..\qdpapi\qdptraderapi.lib" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -27,16 +27,16 @@
<ClInclude Include="vnqdptd.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\qdpapi\QdpFtdcMdApi.h">
<ClInclude Include="..\..\qdpapi\QdpFtdcMdApi.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\qdpapi\QdpFtdcTraderApi.h">
<ClInclude Include="..\..\qdpapi\QdpFtdcTraderApi.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\qdpapi\QdpFtdcUserApiDataType.h">
<ClInclude Include="..\..\qdpapi\QdpFtdcUserApiDataType.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\qdpapi\QdpFtdcUserApiStruct.h">
<ClInclude Include="..\..\qdpapi\QdpFtdcUserApiStruct.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
@ -52,18 +52,18 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\qdpapi\qdpmdapi.dll">
<None Include="..\..\qdpapi\qdpmdapi.dll">
<Filter>Resource Files</Filter>
</None>
<None Include="..\..\..\qdpapi\qdptraderapi.dll">
<None Include="..\..\qdpapi\qdptraderapi.dll">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Library Include="..\..\..\qdpapi\qdpmdapi.lib">
<Library Include="..\..\qdpapi\qdpmdapi.lib">
<Filter>Resource Files</Filter>
</Library>
<Library Include="..\..\..\qdpapi\qdptraderapi.lib">
<Library Include="..\..\qdpapi\qdptraderapi.lib">
<Filter>Resource Files</Filter>
</Library>
</ItemGroup>

View File

@ -146,10 +146,7 @@ class QdpGateway(VtGateway):
#----------------------------------------------------------------------
def close(self):
"""关闭"""
if self.mdConnected:
self.mdApi.close()
if self.tdConnected:
self.tdApi.close()
pass
#----------------------------------------------------------------------
def initQuery(self):
@ -495,7 +492,7 @@ class QdpTdApi(TdApi):
self.createFtdcTraderApi(path)
self.subscribePrivateTopic(0)
self.subscribePublicTopic(2)
self.subscribePublicTopic(0)
# 注册服务器地址
self.registerFront(self.address)
@ -536,10 +533,9 @@ class QdpTdApi(TdApi):
"""查询账户"""
self.reqID += 1
req = {}
req['UserID'] = self.userID
req['BrokerID'] = self.brokerID
req['InvestorID'] = self.investorID
self.reqQryInvestorAccount({}, self.reqID)
self.reqQryInvestorAccount(req, self.reqID)
#----------------------------------------------------------------------
def qryPosition(self):

Binary file not shown.

Binary file not shown.

View File

@ -57,7 +57,6 @@ orderStatusMapReverse['4'] = STATUS_ALLTRADED
orderStatusMapReverse['5'] = STATUS_CANCELLED
orderStatusMapReverse['6'] = STATUS_CANCELLED
s = set()
########################################################################
class ShzdGateway(VtGateway):