Skip to content

Commit 24f68a3

Browse files
committed
modify quote grab api
1 parent c46d910 commit 24f68a3

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

tigeropen/examples/quote_client_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424

2525
def get_quote():
2626
# 抢占行情权限
27-
is_grab_quote_success = openapi_client.grab_quote_permission()
28-
print(is_grab_quote_success)
27+
quote_permissions = openapi_client.grab_quote_permission()
28+
print(quote_permissions)
2929

3030
market_status_list = openapi_client.get_market_status(Market.US)
3131
print(market_status_list)

tigeropen/quote/quote_client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,15 +1085,19 @@ def get_stock_industry(self, symbol, market=Market.US):
10851085
def grab_quote_permission(self):
10861086
"""
10871087
抢占行情权限
1088-
:return: 是否抢占成功, bool 类型
1088+
:return: 权限列表
1089+
示例: [{'name': 'usQuoteBasic', 'expireAt': 1621931026000},
1090+
{'name': 'usStockQuoteLv2Totalview', 'expireAt': 1621931026000},
1091+
{'name': 'usOptionQuote', 'expireAt': 1621931026000},
1092+
{'name': 'hkStockQuoteLv2', 'expireAt': 1621931026000}]
10891093
"""
10901094
request = OpenApiRequest(GRAB_QUOTE_PERMISSION)
10911095
response_content = self.__fetch_data(request)
10921096
if response_content:
10931097
response = QuoteGrabPermissionResponse()
10941098
response.parse_response_content(response_content)
10951099
if response.is_success():
1096-
return response.is_master
1100+
return response.permissions
10971101
else:
10981102
raise ApiException(response.code, response.message)
10991103
return False

tigeropen/quote/response/quote_grab_permission_response.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class QuoteGrabPermissionResponse(TigerResponse):
1010
def __init__(self):
1111
super(QuoteGrabPermissionResponse, self).__init__()
12-
self.is_master = False
12+
self.permissions = None
1313
self._is_success = None
1414

1515
def parse_response_content(self, response_content):
@@ -18,5 +18,4 @@ def parse_response_content(self, response_content):
1818
self._is_success = response['is_success']
1919

2020
if self.data:
21-
data_json = json.loads(self.data)
22-
self.is_master = data_json.get('is_master')
21+
self.permissions = json.loads(self.data)

0 commit comments

Comments
 (0)