Skip to content

Commit ff068a9

Browse files
committed
new market status
1 parent c218b48 commit ff068a9

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

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)