1111
1212from tigeropen .common .consts import Market , Language , QuoteRight , BarPeriod , OPEN_API_SERVICE_VERSION_V3
1313from tigeropen .common .consts import THREAD_LOCAL , SecurityType , CorporateActionType , IndustryLevel
14- from tigeropen .common .consts .service_types import GRAB_QUOTE_PERMISSION , QUOTE_DELAY
14+ from tigeropen .common .consts .service_types import GRAB_QUOTE_PERMISSION , QUOTE_DELAY , GET_QUOTE_PERMISSION
1515from tigeropen .common .consts .service_types import MARKET_STATE , ALL_SYMBOLS , ALL_SYMBOL_NAMES , BRIEF , \
1616 TIMELINE , KLINE , TRADE_TICK , OPTION_EXPIRATION , OPTION_CHAIN , FUTURE_EXCHANGE , OPTION_BRIEF , \
1717 OPTION_KLINE , OPTION_TRADE_TICK , FUTURE_KLINE , FUTURE_TICK , FUTURE_CONTRACT_BY_EXCHANGE_CODE , \
@@ -1172,11 +1172,11 @@ def get_stock_industry(self, symbol, market=Market.US):
11721172 def grab_quote_permission (self ):
11731173 """
11741174 抢占行情权限
1175- :return: 权限列表
1176- 示例: [{'name': 'usQuoteBasic', 'expireAt ': 1621931026000},
1177- {'name': 'usStockQuoteLv2Totalview', 'expireAt ': 1621931026000},
1178- {'name': 'usOptionQuote', 'expireAt ': 1621931026000},
1179- {'name': 'hkStockQuoteLv2', 'expireAt ': 1621931026000 }]
1175+ :return: 权限列表。expire_at 为-1时表示长期有效
1176+ 示例: [{'name': 'usQuoteBasic', 'expire_at ': 1621931026000},
1177+ {'name': 'usStockQuoteLv2Totalview', 'expire_at ': 1621931026000},
1178+ {'name': 'usOptionQuote', 'expire_at ': 1621931026000},
1179+ {'name': 'hkStockQuoteLv2', 'expire_at ': -1 }]
11801180 """
11811181 request = OpenApiRequest (GRAB_QUOTE_PERMISSION )
11821182 response_content = self .__fetch_data (request )
@@ -1188,3 +1188,23 @@ def grab_quote_permission(self):
11881188 else :
11891189 raise ApiException (response .code , response .message )
11901190 return False
1191+
1192+ def get_quote_permission (self ):
1193+ """
1194+ 查询行情权限。query quote permissions
1195+ :return: 权限列表。expire_at 为-1时表示长期有效
1196+ 示例: [{'name': 'usQuoteBasic', 'expire_at': 1621931026000},
1197+ {'name': 'usStockQuoteLv2Totalview', 'expire_at': 1621931026000},
1198+ {'name': 'usOptionQuote', 'expire_at': 1621931026000},
1199+ {'name': 'hkStockQuoteLv2', 'expire_at': -1}]
1200+ """
1201+ request = OpenApiRequest (GET_QUOTE_PERMISSION )
1202+ response_content = self .__fetch_data (request )
1203+ if response_content :
1204+ response = QuoteGrabPermissionResponse ()
1205+ response .parse_response_content (response_content )
1206+ if response .is_success ():
1207+ return response .permissions
1208+ else :
1209+ raise ApiException (response .code , response .message )
1210+ return False
0 commit comments