44
55@author: gaoan
66"""
7- import sys
87import json
8+ import logging
9+ import sys
910from collections import defaultdict
1011
1112import stomp
12- import six
13- import logging
1413from stomp .exception import ConnectFailedException
1514
15+ from tigeropen .common .consts import OrderStatus
1616from tigeropen .common .consts .push_destinations import QUOTE , QUOTE_DEPTH , QUOTE_FUTURE , QUOTE_OPTION , TRADE_ASSET , \
1717 TRADE_ORDER , TRADE_POSITION
18- from tigeropen .common .util .signature_utils import sign_with_rsa
19- from tigeropen .common .util .order_utils import get_order_status
2018from tigeropen .common .consts .push_types import RequestType , ResponseType
2119from tigeropen .common .consts .quote_keys import QuoteChangeKey , QuoteKeyType
22- from tigeropen .common .consts import OrderStatus
20+ from tigeropen .common .util .order_utils import get_order_status
21+ from tigeropen .common .util .signature_utils import sign_with_rsa
2322
2423HOUR_TRADING_QUOTE_KEYS_MAPPINGS = {'hourTradingLatestPrice' : 'latest_price' , 'hourTradingPreClose' : 'pre_close' ,
2524 'hourTradingLatestTime' : 'latest_time' , 'hourTradingVolume' : 'volume' ,
@@ -166,8 +165,7 @@ def on_message(self, headers, body):
166165 # 期货行情推送的价格都乘了 10 的 offset 次方变成了整数, 需要除回去变为正常单位的价格
167166 if offset :
168167 for key , value in data .items ():
169- if (key == 'latestTime' or key == 'hourTradingLatestTime' ) and \
170- isinstance (value , six .string_types ):
168+ if key == 'latestTime' or key == 'hourTradingLatestTime' :
171169 continue
172170 if key in QUOTE_KEYS_MAPPINGS :
173171 key = QUOTE_KEYS_MAPPINGS .get (key )
@@ -183,8 +181,7 @@ def on_message(self, headers, body):
183181 items .append ((key , value ))
184182 else :
185183 for key , value in data .items ():
186- if (key == 'latestTime' or key == 'hourTradingLatestTime' ) and \
187- isinstance (value , six .string_types ):
184+ if key == 'latestTime' or key == 'hourTradingLatestTime' :
188185 continue
189186 if key in QUOTE_KEYS_MAPPINGS :
190187 key = QUOTE_KEYS_MAPPINGS .get (key )
@@ -305,7 +302,7 @@ def subscribe_quote(self, symbols, quote_key_type=QuoteKeyType.TRADE, focus_keys
305302 if focus_keys :
306303 keys = list ()
307304 for key in focus_keys :
308- if isinstance (key , six . string_types ):
305+ if isinstance (key , str ):
309306 keys .append (key )
310307 else :
311308 keys .append (key .value )
0 commit comments