Skip to content

Commit db5477a

Browse files
committed
Merge branch 'feature_market_status' into 'dev'
new market status See merge request !49
2 parents b5316af + b1cd55d commit db5477a

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

tigeropen/examples/client_config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ def get_client_config():
1818
client_config = TigerOpenClientConfig(sandbox_debug=is_sandbox)
1919
client_config.private_key = read_private_key('your private key file path')
2020
client_config.tiger_id = 'your tiger id'
21-
client_config.account = 'your account' # 环球账户
21+
client_config.account = 'your account' # 环球账户.
22+
# 只使用一个账户时,不论是环球账户, 标准账户或是模拟账户, 都填在 client_config.account 下, 默认只会使用这里的账户.
23+
# standard_account 属性和 paper_account 属性只是为多账户时取用方便, 一般可忽略
2224
client_config.standard_account = None # 标准账户
2325
client_config.paper_account = None # 模拟账户
2426
client_config.language = Language.en_US

tigeropen/quote/domain/market_status.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77

88

99
class MarketStatus(object):
10-
def __init__(self, market, status, open_time):
10+
def __init__(self, market, status, open_time, trading_status):
1111
self.market = market
1212
self.status = status
1313
self.open_time = open_time
14+
self.trading_status = trading_status
1415

1516
def __repr__(self):
1617
"""

tigeropen/quote/response/market_status_response.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def parse_response_content(self, response_content):
2626

2727
if self.data and isinstance(self.data, list):
2828
for item in self.data:
29-
market, status, open_time = None, None, None
29+
market, status, open_time, trading_status = None, None, None, None
3030
for key, value in item.items():
3131
if value is None:
3232
continue
@@ -38,12 +38,15 @@ def parse_response_content(self, response_content):
3838
if value.endswith(' EDT') or value.endswith(' EST'):
3939
value = value[0:len(value) - 4]
4040
open_time = dateparser.parse(value)
41+
elif key == 'status':
42+
trading_status = get_string(value)
43+
4144
if open_time and market:
4245
if market == 'US':
4346
open_time = eastern.localize(open_time)
4447
elif market == 'HK':
4548
open_time = hongkong.localize(open_time)
4649
elif market == 'CN':
4750
open_time = china.localize(open_time)
48-
market_status = MarketStatus(market, status, open_time)
51+
market_status = MarketStatus(market, status, open_time, trading_status)
4952
self.markets.append(market_status)

0 commit comments

Comments
 (0)