diff --git a/vn.qdp/vnqdpmd/Visual Studio 2013/settings/Windows Azure Subscriptions.xml b/vn.qdp/vnqdpmd/Visual Studio 2013/settings/Windows Azure Subscriptions.xml
index cacd03c2..49ea0043 100644
--- a/vn.qdp/vnqdpmd/Visual Studio 2013/settings/Windows Azure Subscriptions.xml
+++ b/vn.qdp/vnqdpmd/Visual Studio 2013/settings/Windows Azure Subscriptions.xml
@@ -1,5 +1,5 @@
- AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAyRIhRmRN8UK7w5RuPHePCQAAAAACAAAAAAAQZgAAAAEAACAAAACQk+guh+ywWR7iJKHx4q/rl8GJs1w1kHOBDxLxLwyRwQAAAAAOgAAAAAIAACAAAABPgLw+AuxePq11TX16PdB1NyHEqJD1OGjxXDrk6zI58BAAAABDp/NWkif0PpHu24ZiWNDpQAAAAD6czV67awJHJ1Lad1N571p8XaKpngFM3+M/dUiuA7rb48Ig57TRmOwHTcx9xbSoJ+NTqxs+B47Ro2YPRnS43xc=
+ AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAyRIhRmRN8UK7w5RuPHePCQAAAAACAAAAAAAQZgAAAAEAACAAAAChADhs2/yOAe5Vk4jrTcDim0CaDy9YY+o9lhRguoeP0wAAAAAOgAAAAAIAACAAAAAOB6PCBww/fcrV5HJqxMRvxrEecaNTZTGxqhs9412B4xAAAAB7qrpwNcKNMR4DD2O4atz6QAAAACwNgHEKJoRYjwYImBMY1oeq3bWFGTEUA5QJ+KK26sC2YlGfFqLb8g70FZnPfIGieZYSl8sYVTiFo4hAwyODdro=
\ No newline at end of file
diff --git a/vn.qdp/vnqdpmd/vnqdpmd/vnqdpmd.cpp b/vn.qdp/vnqdpmd/vnqdpmd/vnqdpmd.cpp
index 1c4a1514..7fcaa01b 100644
--- a/vn.qdp/vnqdpmd/vnqdpmd/vnqdpmd.cpp
+++ b/vn.qdp/vnqdpmd/vnqdpmd/vnqdpmd.cpp
@@ -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;
};
diff --git a/vn.qdp/vnqdpmd/vnqdpmd/vnqdpmd.vcxproj b/vn.qdp/vnqdpmd/vnqdpmd/vnqdpmd.vcxproj
index 8fa6c56c..a833f095 100644
--- a/vn.qdp/vnqdpmd/vnqdpmd/vnqdpmd.vcxproj
+++ b/vn.qdp/vnqdpmd/vnqdpmd/vnqdpmd.vcxproj
@@ -107,12 +107,12 @@
-
-
+
+
-
-
+
+
diff --git a/vn.qdp/vnqdpmd/vnqdpmd/vnqdpmd.vcxproj.filters b/vn.qdp/vnqdpmd/vnqdpmd/vnqdpmd.vcxproj.filters
index 3166208d..3c44bcbd 100644
--- a/vn.qdp/vnqdpmd/vnqdpmd/vnqdpmd.vcxproj.filters
+++ b/vn.qdp/vnqdpmd/vnqdpmd/vnqdpmd.vcxproj.filters
@@ -52,18 +52,18 @@
-
+
Resource Files
-
+
Resource Files
-
+
Resource Files
-
+
Resource Files
diff --git a/vn.qdp/vnqdptd/Visual Studio 2013/settings/Windows Azure Subscriptions.xml b/vn.qdp/vnqdptd/Visual Studio 2013/settings/Windows Azure Subscriptions.xml
index 7f67c580..eb0d97b3 100644
--- a/vn.qdp/vnqdptd/Visual Studio 2013/settings/Windows Azure Subscriptions.xml
+++ b/vn.qdp/vnqdptd/Visual Studio 2013/settings/Windows Azure Subscriptions.xml
@@ -1,5 +1,5 @@
- AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAyRIhRmRN8UK7w5RuPHePCQAAAAACAAAAAAAQZgAAAAEAACAAAAAAl4/w4VyqjUA3HilyerwjMwA8XWYuFqc0TymfwFacrgAAAAAOgAAAAAIAACAAAAA70M9sM2rW/I2svTmUIna/CghrIcaZufLj9Cra+3ylJRAAAABdxANXJfXRyoQazkSdgBYkQAAAAOmsd+eZrQTZXzPUzzcUIgIQDnT2hVaEGUrkkSKoTBipziykhRHEZOhlPWbHeZvg4aiJQcT7GeYyqyYKHBbl+aw=
+ AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAyRIhRmRN8UK7w5RuPHePCQAAAAACAAAAAAAQZgAAAAEAACAAAACxOAY/ulOgIdKvYR/ZQqTfqRah3JAQMxXe+X25cv2+JwAAAAAOgAAAAAIAACAAAABCto2lfkqcOVxEbw8DDKUJp07D/UYM7fyE7OKy8TTaPhAAAADmLpTeNvhPv+/WFM0Tz/gLQAAAABK/J1c7r+qPkhqb66sIkaBRRnG9xXxu4mDv7XDJzpbEL2Ovv4sW1Fc0nAtb+9TLNb0RcXcBPqgi0IAZVbWOzWg=
\ No newline at end of file
diff --git a/vn.qdp/vnqdptd/vnqdptd/vnqdptd.vcxproj b/vn.qdp/vnqdptd/vnqdptd/vnqdptd.vcxproj
index e4f49b84..34911d70 100644
--- a/vn.qdp/vnqdptd/vnqdptd/vnqdptd.vcxproj
+++ b/vn.qdp/vnqdptd/vnqdptd/vnqdptd.vcxproj
@@ -83,10 +83,10 @@
-
-
-
-
+
+
+
+
@@ -107,12 +107,12 @@
-
-
+
+
-
-
+
+
diff --git a/vn.qdp/vnqdptd/vnqdptd/vnqdptd.vcxproj.filters b/vn.qdp/vnqdptd/vnqdptd/vnqdptd.vcxproj.filters
index 2b482c11..7af1bdfc 100644
--- a/vn.qdp/vnqdptd/vnqdptd/vnqdptd.vcxproj.filters
+++ b/vn.qdp/vnqdptd/vnqdptd/vnqdptd.vcxproj.filters
@@ -27,16 +27,16 @@
Header Files
-
+
Header Files
-
+
Header Files
-
+
Header Files
-
+
Header Files
@@ -52,18 +52,18 @@
-
+
Resource Files
-
+
Resource Files
-
+
Resource Files
-
+
Resource Files
diff --git a/vn.trader/qdpGateway/qdpGateway.py b/vn.trader/qdpGateway/qdpGateway.py
index b3e3d3a6..2d3d189d 100644
--- a/vn.trader/qdpGateway/qdpGateway.py
+++ b/vn.trader/qdpGateway/qdpGateway.py
@@ -83,9 +83,9 @@ class QdpGateway(VtGateway):
def connect(self):
"""杩炴帴"""
# 杞藉叆json鏂囦欢
- fileName = self.gatewayName + '_connect.json'
- path = os.path.abspath(os.path.dirname(__file__))
- fileName = os.path.join(path, fileName)
+ fileName = self.gatewayName + '_connect.json'
+ path = os.path.abspath(os.path.dirname(__file__))
+ fileName = os.path.join(path, fileName)
try:
f = file(fileName)
@@ -114,7 +114,7 @@ class QdpGateway(VtGateway):
# 鍒涘缓琛屾儏鍜屼氦鏄撴帴鍙e璞
self.mdApi.connect(userID, password, brokerID, mdAddress)
self.tdApi.connect(userID, password, brokerID, tdAddress)
-
+
# 鍒濆鍖栧苟鍚姩鏌ヨ
self.initQuery()
@@ -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):
@@ -280,173 +277,173 @@ class QdpMdApi(MdApi):
#----------------------------------------------------------------------
def close(self):
"""鍏抽棴"""
- self.logout()
+ self.logout()
self.exit()
#----------------------------------------------------------------------
def onFrontConnected(self):
- """鏈嶅姟鍣ㄨ繛鎺"""
- self.connectionStatus = True
+ """鏈嶅姟鍣ㄨ繛鎺"""
+ self.connectionStatus = True
- log = VtLogData()
- log.gatewayName = self.gatewayName
- log.logContent = u'琛屾儏鏈嶅姟鍣ㄨ繛鎺ユ垚鍔'
- self.gateway.onLog(log)
- self.login()
+ log = VtLogData()
+ log.gatewayName = self.gatewayName
+ log.logContent = u'琛屾儏鏈嶅姟鍣ㄨ繛鎺ユ垚鍔'
+ self.gateway.onLog(log)
+ self.login()
#----------------------------------------------------------------------
def onFrontDisconnected(self, i):
- """鏈嶅姟鍣ㄦ柇寮"""
- self.connectionStatus = False
- self.loginStatus = False
- self.gateway.mdConnected = False
+ """鏈嶅姟鍣ㄦ柇寮"""
+ self.connectionStatus = False
+ self.loginStatus = False
+ self.gateway.mdConnected = False
- log = VtLogData()
- log.gatewayName = self.gatewayName
- log.logContent = u'琛屾儏鏈嶅姟鍣ㄨ繛鎺ユ柇寮'
- self.gateway.onLog(log)
+ log = VtLogData()
+ log.gatewayName = self.gatewayName
+ log.logContent = u'琛屾儏鏈嶅姟鍣ㄨ繛鎺ユ柇寮'
+ self.gateway.onLog(log)
#----------------------------------------------------------------------
def onHeartBeatWarning(self, i):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onPackageStart(self, topicID, sequenceNo):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onPackageEnd(self, topicID, sequenceNo):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onMultiHeartbeat(self, currTime, multiCastIP):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def udpMarketData(self, data):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspError(self, error, id, last):
- """閿欒鍥炴姤"""
- err = VtErrorData()
- err.gatewayName = self.gatewayName
- err.errorID = error['ErrorID']
- err.errorMsg = error['ErrorMsg'].decode('gbk')
- self.gateway.onError(err)
+ """閿欒鍥炴姤"""
+ err = VtErrorData()
+ err.gatewayName = self.gatewayName
+ err.errorID = error['ErrorID']
+ err.errorMsg = error['ErrorMsg'].decode('gbk')
+ self.gateway.onError(err)
#----------------------------------------------------------------------
def onRspUserLogin(self, data, error, id, last):
- """鐧婚檰鍥炴姤"""
- # 濡傛灉鐧诲綍鎴愬姛锛屾帹閫佹棩蹇椾俊鎭
- if error['ErrorID'] == 0:
- self.loginStatus = True
- self.gateway.mdConnected = True
+ """鐧婚檰鍥炴姤"""
+ # 濡傛灉鐧诲綍鎴愬姛锛屾帹閫佹棩蹇椾俊鎭
+ if error['ErrorID'] == 0:
+ self.loginStatus = True
+ self.gateway.mdConnected = True
- log = VtLogData()
- log.gatewayName = self.gatewayName
- log.logContent = u'琛屾儏鏈嶅姟鍣ㄧ櫥褰曞畬鎴'
- self.gateway.onLog(log)
+ log = VtLogData()
+ log.gatewayName = self.gatewayName
+ log.logContent = u'琛屾儏鏈嶅姟鍣ㄧ櫥褰曞畬鎴'
+ self.gateway.onLog(log)
- # 閲嶆柊璁㈤槄涔嬪墠璁㈤槄鐨勫悎绾
- for subscribeReq in self.subscribedSymbols:
- self.subscribe(subscribeReq)
+ # 閲嶆柊璁㈤槄涔嬪墠璁㈤槄鐨勫悎绾
+ for subscribeReq in self.subscribedSymbols:
+ self.subscribe(subscribeReq)
- # 鍚﹀垯锛屾帹閫侀敊璇俊鎭
- else:
- err = VtErrorData()
- err.gatewayName = self.gatewayName
- err.errorID = error['ErrorID']
- err.errorMsg = error['ErrorMsg'].decode('gbk')
- self.gateway.onError(err)
+ # 鍚﹀垯锛屾帹閫侀敊璇俊鎭
+ else:
+ err = VtErrorData()
+ err.gatewayName = self.gatewayName
+ err.errorID = error['ErrorID']
+ err.errorMsg = error['ErrorMsg'].decode('gbk')
+ self.gateway.onError(err)
#----------------------------------------------------------------------
def onRspUserLogout(self, data, error, id, last):
- """鐧诲嚭鍥炴姤"""
- # 濡傛灉鐧诲嚭鎴愬姛锛屾帹閫佹棩蹇椾俊鎭
- if error['ErrorID'] == 0:
- self.loginStatus = False
- self.gateway.mdConnected = False
+ """鐧诲嚭鍥炴姤"""
+ # 濡傛灉鐧诲嚭鎴愬姛锛屾帹閫佹棩蹇椾俊鎭
+ if error['ErrorID'] == 0:
+ self.loginStatus = False
+ self.gateway.mdConnected = False
- log = VtLogData()
- log.gatewayName = self.gatewayName
- log.logContent = u'琛屾儏鏈嶅姟鍣ㄧ櫥鍑哄畬鎴'
- self.gateway.onLog(log)
+ log = VtLogData()
+ log.gatewayName = self.gatewayName
+ log.logContent = u'琛屾儏鏈嶅姟鍣ㄧ櫥鍑哄畬鎴'
+ self.gateway.onLog(log)
- # 鍚﹀垯锛屾帹閫侀敊璇俊鎭
- else:
- err = VtErrorData()
- err.gatewayName = self.gatewayName
- err.errorID = error['ErrorID']
- err.errorMsg = error['ErrorMsg'].decode('gbk')
- self.gateway.onError(err)
+ # 鍚﹀垯锛屾帹閫侀敊璇俊鎭
+ else:
+ err = VtErrorData()
+ err.gatewayName = self.gatewayName
+ err.errorID = error['ErrorID']
+ err.errorMsg = error['ErrorMsg'].decode('gbk')
+ self.gateway.onError(err)
#----------------------------------------------------------------------
def onRtnQmdInstrumentStatu(self, data):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspSubscribeTopic(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspQryTopic(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRtnDepthMarketData(self, data):
- """琛屾儏鎺ㄩ"""
- tick = VtTickData()
- tick.gatewayName = self.gatewayName
+ """琛屾儏鎺ㄩ"""
+ tick = VtTickData()
+ tick.gatewayName = self.gatewayName
- tick.symbol = data['InstrumentID']
- tick.exchange = exchangeMapReverse.get(data['ExchangeID'], u'鏈煡')
- tick.vtSymbol = tick.symbol #'.'.join([tick.symbol, EXCHANGE_UNKNOWN])
+ tick.symbol = data['InstrumentID']
+ tick.exchange = exchangeMapReverse.get(data['ExchangeID'], u'鏈煡')
+ tick.vtSymbol = tick.symbol #'.'.join([tick.symbol, EXCHANGE_UNKNOWN])
- tick.lastPrice = data['LastPrice']
- tick.volume = data['Volume']
- tick.openInterest = data['OpenInterest']
- tick.time = '.'.join([data['UpdateTime'], str(data['UpdateMillisec']/100)])
- tick.date = data['TradingDay']
+ tick.lastPrice = data['LastPrice']
+ tick.volume = data['Volume']
+ tick.openInterest = data['OpenInterest']
+ tick.time = '.'.join([data['UpdateTime'], str(data['UpdateMillisec']/100)])
+ tick.date = data['TradingDay']
- tick.openPrice = data['OpenPrice']
- tick.highPrice = data['HighestPrice']
- tick.lowPrice = data['LowestPrice']
- tick.preClosePrice = data['PreClosePrice']
+ tick.openPrice = data['OpenPrice']
+ tick.highPrice = data['HighestPrice']
+ tick.lowPrice = data['LowestPrice']
+ tick.preClosePrice = data['PreClosePrice']
- tick.upperLimit = data['UpperLimitPrice']
- tick.lowerLimit = data['LowerLimitPrice']
+ tick.upperLimit = data['UpperLimitPrice']
+ tick.lowerLimit = data['LowerLimitPrice']
- # QDP鍙湁涓妗h鎯
- tick.bidPrice1 = data['BidPrice1']
- tick.bidVolume1 = data['BidVolume1']
- tick.askPrice1 = data['AskPrice1']
- tick.askVolume1 = data['AskVolume1']
+ # QDP鍙湁涓妗h鎯
+ tick.bidPrice1 = data['BidPrice1']
+ tick.bidVolume1 = data['BidVolume1']
+ tick.askPrice1 = data['AskPrice1']
+ tick.askVolume1 = data['AskVolume1']
- self.gateway.onTick(tick)
+ self.gateway.onTick(tick)
#----------------------------------------------------------------------
def onRspSubMarketData(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspUnSubMarketData(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspQryDepthMarketData(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
########################################################################
@@ -462,7 +459,7 @@ class QdpTdApi(TdApi):
self.gatewayName = gateway.gatewayName # gateway瀵硅薄鍚嶇О
self.reqID = EMPTY_INT # 鎿嶄綔璇锋眰缂栧彿
- self.orderRef = EMPTY_INT # 璁㈠崟缂栧彿
+ self.orderRef = EMPTY_INT # 璁㈠崟缂栧彿
self.connectionStatus = False # 杩炴帴鐘舵
self.loginStatus = False # 鐧诲綍鐘舵
@@ -494,8 +491,8 @@ class QdpTdApi(TdApi):
os.makedirs(path)
self.createFtdcTraderApi(path)
- self.subscribePrivateTopic(0)
- self.subscribePublicTopic(2)
+ self.subscribePrivateTopic(0)
+ self.subscribePublicTopic(0)
# 娉ㄥ唽鏈嶅姟鍣ㄥ湴鍧
self.registerFront(self.address)
@@ -535,11 +532,10 @@ class QdpTdApi(TdApi):
def qryAccount(self):
"""鏌ヨ璐︽埛"""
self.reqID += 1
- req = {}
- req['UserID'] = self.userID
- req['BrokerID'] = self.brokerID
- req['InvestorID'] = self.investorID
- self.reqQryInvestorAccount({}, self.reqID)
+ req = {}
+ req['BrokerID'] = self.brokerID
+ req['InvestorID'] = self.investorID
+ self.reqQryInvestorAccount(req, self.reqID)
#----------------------------------------------------------------------
def qryPosition(self):
@@ -573,12 +569,12 @@ class QdpTdApi(TdApi):
req['UserID'] = self.userID
req['InvestorID'] = self.investorID
req['BrokerID'] = self.brokerID
- req['HedgeFlag'] = defineDict['QDP_FTDC_CHF_Speculation'] # 鎶曟満鍗
- req['ForceCloseReason'] = defineDict['QDP_FTDC_FCR_NotForceClose'] # 闈炲己骞
- req['IsAutoSuspend'] = 0 # 闈炶嚜鍔ㄦ寕璧
- req['TimeCondition'] = defineDict['QDP_FTDC_TC_GFD'] # 浠婃棩鏈夋晥
- req['VolumeCondition'] = defineDict['QDP_FTDC_VC_AV'] # 浠绘剰鎴愪氦閲
- req['MinVolume'] = 1 # 鏈灏忔垚浜ら噺涓1
+ req['HedgeFlag'] = defineDict['QDP_FTDC_CHF_Speculation'] # 鎶曟満鍗
+ req['ForceCloseReason'] = defineDict['QDP_FTDC_FCR_NotForceClose'] # 闈炲己骞
+ req['IsAutoSuspend'] = 0 # 闈炶嚜鍔ㄦ寕璧
+ req['TimeCondition'] = defineDict['QDP_FTDC_TC_GFD'] # 浠婃棩鏈夋晥
+ req['VolumeCondition'] = defineDict['QDP_FTDC_VC_AV'] # 浠绘剰鎴愪氦閲
+ req['MinVolume'] = 1 # 鏈灏忔垚浜ら噺涓1
# 鍒ゆ柇FAK鍜孎OK
if orderReq.priceType == PRICETYPE_FAK:
@@ -600,7 +596,7 @@ class QdpTdApi(TdApi):
def cancelOrder(self, cancelOrderReq):
"""鎾ゅ崟"""
self.reqID += 1
- self.orderRef += 1
+ self.orderRef += 1
req = {}
@@ -621,491 +617,491 @@ class QdpTdApi(TdApi):
#----------------------------------------------------------------------
def close(self):
"""鍏抽棴"""
- self.logout()
+ self.logout()
self.exit()
#----------------------------------------------------------------------
def onFrontConnected(self):
- """鏈嶅姟鍣ㄨ繛鎺"""
- self.connectionStatus = True
+ """鏈嶅姟鍣ㄨ繛鎺"""
+ self.connectionStatus = True
- log = VtLogData()
- log.gatewayName = self.gatewayName
- log.logContent = u'浜ゆ槗鏈嶅姟鍣ㄨ繛鎺ユ垚鍔'
- self.gateway.onLog(log)
+ log = VtLogData()
+ log.gatewayName = self.gatewayName
+ log.logContent = u'浜ゆ槗鏈嶅姟鍣ㄨ繛鎺ユ垚鍔'
+ self.gateway.onLog(log)
- self.login()
+ self.login()
#----------------------------------------------------------------------
def onFrontDisconnected(self, i):
- """鏈嶅姟鍣ㄦ柇寮"""
- self.connectionStatus = False
- self.loginStatus = False
- self.gateway.tdConnected = False
+ """鏈嶅姟鍣ㄦ柇寮"""
+ self.connectionStatus = False
+ self.loginStatus = False
+ self.gateway.tdConnected = False
- log = VtLogData()
- log.gatewayName = self.gatewayName
- log.logContent = u'浜ゆ槗鏈嶅姟鍣ㄨ繛鎺ユ柇寮'
- self.gateway.onLog(log)
+ log = VtLogData()
+ log.gatewayName = self.gatewayName
+ log.logContent = u'浜ゆ槗鏈嶅姟鍣ㄨ繛鎺ユ柇寮'
+ self.gateway.onLog(log)
#----------------------------------------------------------------------
def onHeartBeatWarning(self, i):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onPackageStart(self, topicID, sequenceNo):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onPackageEnd(self, topicID, sequenceNo):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspError(self, error, id, last):
- """閿欒鍥炴姤"""
- err = VtErrorData()
- err.gatewayName = self.gatewayName
- err.errorID = error['ErrorID']
- err.errorMsg = error['ErrorMsg'].decode('gbk')
- self.gateway.onError(err)
+ """閿欒鍥炴姤"""
+ err = VtErrorData()
+ err.gatewayName = self.gatewayName
+ err.errorID = error['ErrorID']
+ err.errorMsg = error['ErrorMsg'].decode('gbk')
+ self.gateway.onError(err)
#----------------------------------------------------------------------
def onRspUserLogin(self, data, error, id, last):
- """鐧婚檰鍥炴姤"""
- # 濡傛灉鐧诲綍鎴愬姛锛屾帹閫佹棩蹇椾俊鎭
- if error['ErrorID'] == 0:
- self.frontID = str(data['FrontID'])
- self.sessionID = str(data['SessionID'])
- self.loginStatus = True
- self.gateway.tdConnected = True
+ """鐧婚檰鍥炴姤"""
+ # 濡傛灉鐧诲綍鎴愬姛锛屾帹閫佹棩蹇椾俊鎭
+ if error['ErrorID'] == 0:
+ self.frontID = str(data['FrontID'])
+ self.sessionID = str(data['SessionID'])
+ self.loginStatus = True
+ self.gateway.tdConnected = True
- log = VtLogData()
- log.gatewayName = self.gatewayName
- log.logContent = u'浜ゆ槗鏈嶅姟鍣ㄧ櫥褰曞畬鎴'
- self.gateway.onLog(log)
+ log = VtLogData()
+ log.gatewayName = self.gatewayName
+ log.logContent = u'浜ゆ槗鏈嶅姟鍣ㄧ櫥褰曞畬鎴'
+ self.gateway.onLog(log)
- # 鑾峰彇investorID
- self.reqID += 1
- req = {}
- req['UserID'] = self.userID
- req['Password'] = self.password
- req['BrokerID'] = self.brokerID
- self.reqQryUserInvestor(req,self.reqID)
+ # 鑾峰彇investorID
+ self.reqID += 1
+ req = {}
+ req['UserID'] = self.userID
+ req['Password'] = self.password
+ req['BrokerID'] = self.brokerID
+ self.reqQryUserInvestor(req,self.reqID)
- # 鍚﹀垯锛屾帹閫侀敊璇俊鎭
- else:
- err = VtErrorData()
- err.gatewayName = self.gatewayName
- err.errorID = error['ErrorID']
- err.errorMsg = error['ErrorMsg'].decode('gbk')
- self.gateway.onError(err)
+ # 鍚﹀垯锛屾帹閫侀敊璇俊鎭
+ else:
+ err = VtErrorData()
+ err.gatewayName = self.gatewayName
+ err.errorID = error['ErrorID']
+ err.errorMsg = error['ErrorMsg'].decode('gbk')
+ self.gateway.onError(err)
#----------------------------------------------------------------------
def onRspUserLogout(self, data, error, id, last):
- """鐧诲嚭鍥炴姤"""
- # 濡傛灉鐧诲嚭鎴愬姛锛屾帹閫佹棩蹇椾俊鎭
- if error['ErrorID'] == 0:
- self.loginStatus = False
- self.gateway.tdConnected = False
+ """鐧诲嚭鍥炴姤"""
+ # 濡傛灉鐧诲嚭鎴愬姛锛屾帹閫佹棩蹇椾俊鎭
+ if error['ErrorID'] == 0:
+ self.loginStatus = False
+ self.gateway.tdConnected = False
- log = VtLogData()
- log.gatewayName = self.gatewayName
- log.logContent = u'浜ゆ槗鏈嶅姟鍣ㄧ櫥鍑哄畬鎴'
- self.gateway.onLog(log)
+ log = VtLogData()
+ log.gatewayName = self.gatewayName
+ log.logContent = u'浜ゆ槗鏈嶅姟鍣ㄧ櫥鍑哄畬鎴'
+ self.gateway.onLog(log)
- # 鍚﹀垯锛屾帹閫侀敊璇俊鎭
- else:
- err = VtErrorData()
- err.gatewayName = self.gatewayName
- err.errorID = error['ErrorID']
- err.errorMsg = error['ErrorMsg'].decode('gbk')
- self.gateway.onError(err)
+ # 鍚﹀垯锛屾帹閫侀敊璇俊鎭
+ else:
+ err = VtErrorData()
+ err.gatewayName = self.gatewayName
+ err.errorID = error['ErrorID']
+ err.errorMsg = error['ErrorMsg'].decode('gbk')
+ self.gateway.onError(err)
#----------------------------------------------------------------------
def onRspUserPasswordUpdate(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspOrderInsert(self, data, error, id, last):
- """鍙戝崟鍥炴姤锛堟煖鍙帮級"""
- if error['ErrorID'] == 0:
- return
- # 鍚﹀垯锛屾帹閫侀敊璇俊鎭
- else:
- err = VtErrorData()
- err.gatewayName = self.gatewayName
- err.errorID = error['ErrorID']
- err.errorMsg = error['ErrorMsg'].decode('gbk')
- self.gateway.onError(err)
+ """鍙戝崟鍥炴姤锛堟煖鍙帮級"""
+ if error['ErrorID'] == 0:
+ return
+ # 鍚﹀垯锛屾帹閫侀敊璇俊鎭
+ else:
+ err = VtErrorData()
+ err.gatewayName = self.gatewayName
+ err.errorID = error['ErrorID']
+ err.errorMsg = error['ErrorMsg'].decode('gbk')
+ self.gateway.onError(err)
#----------------------------------------------------------------------
def onRspOrderAction(self, data, error, id, last):
- """鎾ゅ崟鍥炴姤锛堟煖鍙帮級"""
- if error['ErrorID'] == 0:
- return
- # 鍚﹀垯锛屾帹閫侀敊璇俊鎭
- else:
- err = VtErrorData()
- err.gatewayName = self.gatewayName
- err.errorID = error['ErrorID']
- err.errorMsg = error['ErrorMsg'].decode('gbk')
- self.gateway.onError(err)
+ """鎾ゅ崟鍥炴姤锛堟煖鍙帮級"""
+ if error['ErrorID'] == 0:
+ return
+ # 鍚﹀垯锛屾帹閫侀敊璇俊鎭
+ else:
+ err = VtErrorData()
+ err.gatewayName = self.gatewayName
+ err.errorID = error['ErrorID']
+ err.errorMsg = error['ErrorMsg'].decode('gbk')
+ self.gateway.onError(err)
#----------------------------------------------------------------------
def onRspFromBankToFutureByFuture(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspFromFutureToBankByFuture(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRtnFlowMessageCancel(self, data):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRtnTrade(self, data):
- """鎴愪氦鍥炴姤"""
- # 鍒涘缓鎶ュ崟鏁版嵁瀵硅薄
- trade = VtTradeData()
- trade.gatewayName = self.gatewayName
+ """鎴愪氦鍥炴姤"""
+ # 鍒涘缓鎶ュ崟鏁版嵁瀵硅薄
+ trade = VtTradeData()
+ trade.gatewayName = self.gatewayName
- # 淇濆瓨浠g爜鍜屾姤鍗曞彿
- trade.symbol = data['InstrumentID']
- trade.exchange = exchangeMapReverse[data['ExchangeID']]
- trade.vtSymbol = trade.symbol #'.'.join([trade.symbol, trade.exchange])
+ # 淇濆瓨浠g爜鍜屾姤鍗曞彿
+ trade.symbol = data['InstrumentID']
+ trade.exchange = exchangeMapReverse[data['ExchangeID']]
+ trade.vtSymbol = trade.symbol #'.'.join([trade.symbol, trade.exchange])
- trade.tradeID = data['TradeID']
- trade.vtTradeID = '.'.join([self.gatewayName, trade.tradeID])
+ trade.tradeID = data['TradeID']
+ trade.vtTradeID = '.'.join([self.gatewayName, trade.tradeID])
- trade.orderID = data['UserOrderLocalID']
- trade.vtOrderID = '.'.join([self.gatewayName, trade.orderID])
+ trade.orderID = data['UserOrderLocalID']
+ trade.vtOrderID = '.'.join([self.gatewayName, trade.orderID])
- # 鏂瑰悜
- trade.direction = directionMapReverse.get(data['Direction'], '')
+ # 鏂瑰悜
+ trade.direction = directionMapReverse.get(data['Direction'], '')
- # 寮骞
- trade.offset = offsetMapReverse.get(data['OffsetFlag'], '')
+ # 寮骞
+ trade.offset = offsetMapReverse.get(data['OffsetFlag'], '')
- # 浠锋牸銆佹姤鍗曢噺绛夋暟鍊
- trade.price = data['TradePrice']
- trade.volume = data['TradeVolume']
- trade.tradeTime = data['TradeTime']
+ # 浠锋牸銆佹姤鍗曢噺绛夋暟鍊
+ trade.price = data['TradePrice']
+ trade.volume = data['TradeVolume']
+ trade.tradeTime = data['TradeTime']
- # 鎺ㄩ
- self.gateway.onTrade(trade)
+ # 鎺ㄩ
+ self.gateway.onTrade(trade)
#----------------------------------------------------------------------
def onRtnOrder(self, data):
- """鎶ュ崟鍥炴姤"""
- # 鏇存柊鏈澶ф姤鍗曠紪鍙
- newref = data['UserOrderLocalID']
- if not newref == '':
- self.orderRef = max(self.orderRef, int(newref))
+ """鎶ュ崟鍥炴姤"""
+ # 鏇存柊鏈澶ф姤鍗曠紪鍙
+ newref = data['UserOrderLocalID']
+ if not newref == '':
+ self.orderRef = max(self.orderRef, int(newref))
- # 鍒涘缓鎶ュ崟鏁版嵁瀵硅薄
- order = VtOrderData()
- order.gatewayName = self.gatewayName
+ # 鍒涘缓鎶ュ崟鏁版嵁瀵硅薄
+ order = VtOrderData()
+ order.gatewayName = self.gatewayName
- # 淇濆瓨浠g爜鍜屾姤鍗曞彿
- order.symbol = data['InstrumentID']
- order.exchange = exchangeMapReverse[data['ExchangeID']]
- order.vtSymbol = order.symbol #'.'.join([order.symbol, order.exchange])
+ # 淇濆瓨浠g爜鍜屾姤鍗曞彿
+ order.symbol = data['InstrumentID']
+ order.exchange = exchangeMapReverse[data['ExchangeID']]
+ order.vtSymbol = order.symbol #'.'.join([order.symbol, order.exchange])
- order.orderID = data['UserOrderLocalID']
+ order.orderID = data['UserOrderLocalID']
- # 鏂瑰悜
- if data['Direction'] == '0':
- order.direction = DIRECTION_LONG
- elif data['Direction'] == '1':
- order.direction = DIRECTION_SHORT
- else:
- order.direction = DIRECTION_UNKNOWN
+ # 鏂瑰悜
+ if data['Direction'] == '0':
+ order.direction = DIRECTION_LONG
+ elif data['Direction'] == '1':
+ order.direction = DIRECTION_SHORT
+ else:
+ order.direction = DIRECTION_UNKNOWN
- # 寮骞
- if data['OffsetFlag'] == '0':
- order.offset = OFFSET_OPEN
- elif data['OffsetFlag'] == '1':
- order.offset = OFFSET_CLOSE
- elif data['OffsetFlag'] == '3':
- order.offset = OFFSET_CLOSETODAY
- else:
- order.offset = OFFSET_UNKNOWN
+ # 寮骞
+ if data['OffsetFlag'] == '0':
+ order.offset = OFFSET_OPEN
+ elif data['OffsetFlag'] == '1':
+ order.offset = OFFSET_CLOSE
+ elif data['OffsetFlag'] == '3':
+ order.offset = OFFSET_CLOSETODAY
+ else:
+ order.offset = OFFSET_UNKNOWN
- # 鐘舵
- if data['OrderStatus'] == '0':
- order.status = STATUS_ALLTRADED
- elif data['OrderStatus'] == '1':
- order.status = STATUS_PARTTRADED
- elif data['OrderStatus'] == '2':
- order.status = STATUS_PARTTRADED_PARTCANCELED
- elif data['OrderStatus'] == '3':
- order.status = STATUS_NOTTRADED
- elif data['OrderStatus'] == '5':
- order.status = STATUS_CANCELLED
- else:
- order.status = STATUS_UNKNOWN
+ # 鐘舵
+ if data['OrderStatus'] == '0':
+ order.status = STATUS_ALLTRADED
+ elif data['OrderStatus'] == '1':
+ order.status = STATUS_PARTTRADED
+ elif data['OrderStatus'] == '2':
+ order.status = STATUS_PARTTRADED_PARTCANCELED
+ elif data['OrderStatus'] == '3':
+ order.status = STATUS_NOTTRADED
+ elif data['OrderStatus'] == '5':
+ order.status = STATUS_CANCELLED
+ else:
+ order.status = STATUS_UNKNOWN
- # 浠锋牸銆佹姤鍗曢噺绛夋暟鍊
- order.price = data['LimitPrice']
- order.totalVolume = data['Volume']
- order.tradedVolume = data['VolumeTraded']
- order.orderTime = data['InsertTime']
- order.cancelTime = data['CancelTime']
- order.frontID = data['FrontID']
- order.sessionID = data['SessionID']
+ # 浠锋牸銆佹姤鍗曢噺绛夋暟鍊
+ order.price = data['LimitPrice']
+ order.totalVolume = data['Volume']
+ order.tradedVolume = data['VolumeTraded']
+ order.orderTime = data['InsertTime']
+ order.cancelTime = data['CancelTime']
+ order.frontID = data['FrontID']
+ order.sessionID = data['SessionID']
- # QDP鐨勬姤鍗曞彿涓鑷存х淮鎶ら渶瑕佸熀浜巉rontID, sessionID, orderID涓変釜瀛楁
- # 浣嗗湪鏈帴鍙h璁′腑锛屽凡缁忚冭檻浜哘DP鐨凮rderRef鐨勮嚜澧炴э紝閬垮厤閲嶅
- # 鍞竴鍙兘鍑虹幇OrderRef閲嶅鐨勬儏鍐垫槸澶氬鐧诲綍骞跺湪闈炲父鎺ヨ繎鐨勬椂闂村唴锛堝嚑涔庡悓鏃跺彂鍗曪級
- # 鑰冭檻鍒癡tTrader鐨勫簲鐢ㄥ満鏅紝璁や负浠ヤ笂鎯呭喌涓嶄細鏋勬垚闂
- order.vtOrderID = '.'.join([self.gatewayName, order.orderID])
+ # QDP鐨勬姤鍗曞彿涓鑷存х淮鎶ら渶瑕佸熀浜巉rontID, sessionID, orderID涓変釜瀛楁
+ # 浣嗗湪鏈帴鍙h璁′腑锛屽凡缁忚冭檻浜哘DP鐨凮rderRef鐨勮嚜澧炴э紝閬垮厤閲嶅
+ # 鍞竴鍙兘鍑虹幇OrderRef閲嶅鐨勬儏鍐垫槸澶氬鐧诲綍骞跺湪闈炲父鎺ヨ繎鐨勬椂闂村唴锛堝嚑涔庡悓鏃跺彂鍗曪級
+ # 鑰冭檻鍒癡tTrader鐨勫簲鐢ㄥ満鏅紝璁や负浠ヤ笂鎯呭喌涓嶄細鏋勬垚闂
+ order.vtOrderID = '.'.join([self.gatewayName, order.orderID])
- # 鎺ㄩ
- self.gateway.onOrder(order)
+ # 鎺ㄩ
+ self.gateway.onOrder(order)
#----------------------------------------------------------------------
def onErrRtnOrderInsert(self, data, error):
- """鍙戝崟閿欒鍥炴姤锛堜氦鏄撴墍锛"""
- if error['ErrorID'] == 0:
- return
- else:
- err = VtErrorData()
- err.gatewayName = self.gatewayName
- err.errorID = error['ErrorID']
- err.errorMsg = error['ErrorMsg'].decode('gbk')
- self.gateway.onError(err)
+ """鍙戝崟閿欒鍥炴姤锛堜氦鏄撴墍锛"""
+ if error['ErrorID'] == 0:
+ return
+ else:
+ err = VtErrorData()
+ err.gatewayName = self.gatewayName
+ err.errorID = error['ErrorID']
+ err.errorMsg = error['ErrorMsg'].decode('gbk')
+ self.gateway.onError(err)
#----------------------------------------------------------------------
def onErrRtnOrderAction(self, data, error):
- """鎾ゅ崟閿欒鍥炴姤锛堜氦鏄撴墍锛"""
- if error['ErrorID'] == 0:
- return
- else:
- err = VtErrorData()
- err.gatewayName = self.gatewayName
- err.errorID = error['ErrorID']
- err.errorMsg = error['ErrorMsg'].decode('gbk')
- self.gateway.onError(err)
+ """鎾ゅ崟閿欒鍥炴姤锛堜氦鏄撴墍锛"""
+ if error['ErrorID'] == 0:
+ return
+ else:
+ err = VtErrorData()
+ err.gatewayName = self.gatewayName
+ err.errorID = error['ErrorID']
+ err.errorMsg = error['ErrorMsg'].decode('gbk')
+ self.gateway.onError(err)
#----------------------------------------------------------------------
def onRtnInstrumentStatus(self, data):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRtnInvestorAccountDeposit(self, data):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRtnMessageNotify(self, data):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onErrRtnQueryBankBalanceByFuture(self, data, error):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onErrRtnBankToFutureByFuture(self, data, error):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onErrRtnFutureToBankByFuture(self, data, error):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRtnQueryBankBalanceByFuture(self, data):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRtnFromBankToFutureByFuture(self, data):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRtnFromFutureToBankByFuture(self, data):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRtnSGEDeferRate(self, data):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspQryOrder(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspQryTrade(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspQryUserInvestor(self, data, error, id, last):
- """鏌ヨ鎶曡祫璐︽埛鍥炴姤"""
- # 濡傛灉鏌ヨ鎴愬姛锛屾帹閫佹棩蹇椾俊鎭
- if error['ErrorID'] == 0:
- self.investorID = data['InvestorID']
+ """鏌ヨ鎶曡祫璐︽埛鍥炴姤"""
+ # 濡傛灉鏌ヨ鎴愬姛锛屾帹閫佹棩蹇椾俊鎭
+ if error['ErrorID'] == 0:
+ self.investorID = data['InvestorID']
- log = VtLogData()
- log.gatewayName = self.gatewayName
- log.logContent = u'鎶曡祫鑰呮煡璇㈠畬鎴'
- self.gateway.onLog(log)
-
- # 鏌ヨ鍚堢害浠g爜
- self.reqID += 1
- self.reqQryInstrument({}, self.reqID)
- # 鍚﹀垯锛屾帹閫侀敊璇俊鎭
- else:
- err = VtErrorData()
- err.gatewayName = self.gatewayName
- err.errorID = error['ErrorID']
- err.errorMsg = error['ErrorMsg'].decode('gbk')
- self.gateway.onError(err)
+ log = VtLogData()
+ log.gatewayName = self.gatewayName
+ log.logContent = u'鎶曡祫鑰呮煡璇㈠畬鎴'
+ self.gateway.onLog(log)
+
+ # 鏌ヨ鍚堢害浠g爜
+ self.reqID += 1
+ self.reqQryInstrument({}, self.reqID)
+ # 鍚﹀垯锛屾帹閫侀敊璇俊鎭
+ else:
+ err = VtErrorData()
+ err.gatewayName = self.gatewayName
+ err.errorID = error['ErrorID']
+ err.errorMsg = error['ErrorMsg'].decode('gbk')
+ self.gateway.onError(err)
#----------------------------------------------------------------------
def onRspQryInvestorAccount(self, data, error, id, last):
- """璧勯噾璐︽埛鏌ヨ鍥炴姤"""
- account = VtAccountData()
- account.gatewayName = self.gatewayName
+ """璧勯噾璐︽埛鏌ヨ鍥炴姤"""
+ account = VtAccountData()
+ account.gatewayName = self.gatewayName
- # 璐︽埛浠g爜
- account.accountID = data['AccountID']
- account.vtAccountID = '.'.join([self.gatewayName, account.accountID])
+ # 璐︽埛浠g爜
+ account.accountID = data['AccountID']
+ account.vtAccountID = '.'.join([self.gatewayName, account.accountID])
- # 鏁板肩浉鍏
- account.preBalance = data['PreBalance']
- account.available = data['Available']
- account.commission = data['Fee']
- account.margin = data['Margin']
- account.closeProfit = data['CloseProfit']
- account.positionProfit = data['PositionProfit']
- account.balance = data['DynamicRights']
+ # 鏁板肩浉鍏
+ account.preBalance = data['PreBalance']
+ account.available = data['Available']
+ account.commission = data['Fee']
+ account.margin = data['Margin']
+ account.closeProfit = data['CloseProfit']
+ account.positionProfit = data['PositionProfit']
+ account.balance = data['DynamicRights']
- # 鎺ㄩ
- self.gateway.onAccount(account)
+ # 鎺ㄩ
+ self.gateway.onAccount(account)
#----------------------------------------------------------------------
def onRspQryInstrument(self, data, error, id, last):
- """鍚堢害鏌ヨ鍥炴姤"""
- contract = VtContractData()
- contract.gatewayName = self.gatewayName
+ """鍚堢害鏌ヨ鍥炴姤"""
+ contract = VtContractData()
+ contract.gatewayName = self.gatewayName
- contract.symbol = data['InstrumentID']
- contract.exchange = exchangeMapReverse[data['ExchangeID']]
- contract.vtSymbol = contract.symbol #'.'.join([contract.symbol, contract.exchange])
- contract.name = data['InstrumentName'].decode('GBK')
+ contract.symbol = data['InstrumentID']
+ contract.exchange = exchangeMapReverse[data['ExchangeID']]
+ contract.vtSymbol = contract.symbol #'.'.join([contract.symbol, contract.exchange])
+ contract.name = data['InstrumentName'].decode('GBK')
- # 鍚堢害鏁板
- contract.size = data['VolumeMultiple']
- contract.priceTick = data['PriceTick']
- contract.strikePrice = data['StrikePrice']
- contract.underlyingSymbol = data['UnderlyingInstrID']
+ # 鍚堢害鏁板
+ contract.size = data['VolumeMultiple']
+ contract.priceTick = data['PriceTick']
+ contract.strikePrice = data['StrikePrice']
+ contract.underlyingSymbol = data['UnderlyingInstrID']
- # 鍚堢害绫诲瀷
- contract.productClass = productClassMapReverse.get(data['ProductClass'],
- PRODUCT_UNKNOWN)
+ # 鍚堢害绫诲瀷
+ contract.productClass = productClassMapReverse.get(data['ProductClass'],
+ PRODUCT_UNKNOWN)
- # 鏈熸潈绫诲瀷
- if data['OptionsType'] == '1':
- contract.optionType = OPTION_CALL
- elif data['OptionsType'] == '2':
- contract.optionType = OPTION_PUT
+ # 鏈熸潈绫诲瀷
+ if data['OptionsType'] == '1':
+ contract.optionType = OPTION_CALL
+ elif data['OptionsType'] == '2':
+ contract.optionType = OPTION_PUT
- # 鎺ㄩ
- self.gateway.onContract(contract)
+ # 鎺ㄩ
+ self.gateway.onContract(contract)
- if last:
- log = VtLogData()
- log.gatewayName = self.gatewayName
- log.logContent = u'浜ゆ槗鍚堢害淇℃伅鑾峰彇瀹屾垚'
- self.gateway.onLog(log)
+ if last:
+ log = VtLogData()
+ log.gatewayName = self.gatewayName
+ log.logContent = u'浜ゆ槗鍚堢害淇℃伅鑾峰彇瀹屾垚'
+ self.gateway.onLog(log)
#----------------------------------------------------------------------
def onRspQryExchange(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspQryInvestorPosition(self, data, error, id, last):
- """鎸佷粨鏌ヨ鍥炴姤"""
- pos = VtPositionData()
- pos.gatewayName = self.gatewayName
-
- pos.symbol = data['InstrumentID']
- pos.vtSymbol = pos.symbol
- pos.direction = directionMapReverse.get(data['Direction'], DIRECTION_UNKNOWN)
- pos.vtPositionName = '.'.join([pos.vtSymbol, pos.direction])
-
- pos.position = data['Position']
- pos.ydPosition = data['YdPosition']
- pos.frozen = data['FrozenClosing']
- if pos.position:
- pos.price = data['PositionCost'] / pos.position
-
- self.gateway.onPosition(pos)
+ """鎸佷粨鏌ヨ鍥炴姤"""
+ pos = VtPositionData()
+ pos.gatewayName = self.gatewayName
+
+ pos.symbol = data['InstrumentID']
+ pos.vtSymbol = pos.symbol
+ pos.direction = directionMapReverse.get(data['Direction'], DIRECTION_UNKNOWN)
+ pos.vtPositionName = '.'.join([pos.vtSymbol, pos.direction])
+
+ pos.position = data['Position']
+ pos.ydPosition = data['YdPosition']
+ pos.frozen = data['FrozenClosing']
+ if pos.position:
+ pos.price = data['PositionCost'] / pos.position
+
+ self.gateway.onPosition(pos)
#----------------------------------------------------------------------
def onRspSubscribeTopic(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspQryTopic(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspQryInvestorFee(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspQryInvestorMargin(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspQryExchangeDiffTime(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspQryContractBank(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspQueryBankAccountMoneyByFuture(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspQryTransferSerial(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspQrySGEDeferRate(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
#----------------------------------------------------------------------
def onRspQryMarketData(self, data, error, id, last):
- """"""
- pass
+ """"""
+ pass
diff --git a/vn.trader/qdpGateway/vnqdpmd.pyd b/vn.trader/qdpGateway/vnqdpmd.pyd
index 4f966e70..e403a3a4 100644
Binary files a/vn.trader/qdpGateway/vnqdpmd.pyd and b/vn.trader/qdpGateway/vnqdpmd.pyd differ
diff --git a/vn.trader/qdpGateway/vnqdptd.pyd b/vn.trader/qdpGateway/vnqdptd.pyd
index ebe64706..9435a553 100644
Binary files a/vn.trader/qdpGateway/vnqdptd.pyd and b/vn.trader/qdpGateway/vnqdptd.pyd differ
diff --git a/vn.trader/shzdGateway/shzdGateway.py b/vn.trader/shzdGateway/shzdGateway.py
index 4f2ab32b..6c977b22 100644
--- a/vn.trader/shzdGateway/shzdGateway.py
+++ b/vn.trader/shzdGateway/shzdGateway.py
@@ -57,7 +57,6 @@ orderStatusMapReverse['4'] = STATUS_ALLTRADED
orderStatusMapReverse['5'] = STATUS_CANCELLED
orderStatusMapReverse['6'] = STATUS_CANCELLED
-s = set()
########################################################################
class ShzdGateway(VtGateway):