From 44170f6a04dce8b6aae3fbafee13a4181c85caae Mon Sep 17 00:00:00 2001 From: shuo_at_work Date: Tue, 13 Mar 2018 10:30:55 +0800 Subject: [PATCH] exchangeID received from gateway is 'SH',should use exchangeMapReverse to get vnpy exchangeID. --- vnpy/trader/gateway/secGateway/secGateway.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vnpy/trader/gateway/secGateway/secGateway.py b/vnpy/trader/gateway/secGateway/secGateway.py index 2adec2bc..095341b8 100644 --- a/vnpy/trader/gateway/secGateway/secGateway.py +++ b/vnpy/trader/gateway/secGateway/secGateway.py @@ -804,7 +804,7 @@ class SecTdApi(TdApi): # 保存代码 pos.symbol = data['securityID'] - pos.exchange = exchangeMap.get(data['exchangeID'], EXCHANGE_UNKNOWN) + pos.exchange = exchangeMapReverse.get(data['exchangeID'], EXCHANGE_UNKNOWN) pos.vtSymbol = '.'.join([pos.symbol, pos.exchange]) pos.direction = DIRECTION_LONG pos.vtPositionName = '.'.join([pos.vtSymbol, pos.direction]) @@ -1152,7 +1152,7 @@ class SecTdApi(TdApi): # 保存代码 pos.symbol = data['securityOptionID'] - pos.exchange = exchangeMap.get(data['exchangeID'], EXCHANGE_UNKNOWN) + pos.exchange = exchangeMapReverse.get(data['exchangeID'], EXCHANGE_UNKNOWN) pos.vtSymbol = '.'.join([pos.symbol, pos.exchange]) pos.direction = directionMapReverse.get(data['entrustDirection'], DIRECTION_UNKNOWN) pos.vtPositionName = '.'.join([pos.vtSymbol, pos.direction])