Skip to content

Commit 1ea1d9e

Browse files
committed
remove get_string
1 parent 7595f34 commit 1ea1d9e

File tree

8 files changed

+21
-30
lines changed

8 files changed

+21
-30
lines changed

tigeropen/common/util/string_utils.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,3 @@ def camel_to_underline(hunp_str):
2121
return sub
2222

2323

24-
def get_string(value):
25-
return value
26-

tigeropen/fundamental/response/industry_response.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# -*- coding: utf-8 -*-
22

3-
from tigeropen.common.util.string_utils import get_string
43
from tigeropen.common.response import TigerResponse
54

65

@@ -17,8 +16,8 @@ def parse_response_content(self, response_content):
1716
if self.data:
1817
for ind in self.data:
1918
industry = dict(industry_level=ind.get('industryLevel'), id=ind.get('id'),
20-
name_cn=get_string(ind.get('nameCN')),
21-
name_en=get_string(ind.get('nameEN')))
19+
name_cn=ind.get('nameCN'),
20+
name_en=ind.get('nameEN'))
2221
self.industry_list.append(industry)
2322

2423

@@ -38,8 +37,8 @@ def parse_response_content(self, response_content):
3837
industries = item.get('industryDetailDTOList', [])
3938
for ind in industries:
4039
industry_list.append(dict(industry_level=ind.get('industryLevel'), id=ind.get('id'),
41-
name_cn=get_string(ind.get('nameCN')),
42-
name_en=get_string(ind.get('nameEN'))))
40+
name_cn=ind.get('nameCN'),
41+
name_en=ind.get('nameEN')))
4342
company = dict(symbol=item.get('symbol'), company_name=item.get('companyName'),
4443
market=item.get('market'), industry_list=industry_list)
4544
self.industry_stocks.append(company)
@@ -58,6 +57,6 @@ def parse_response_content(self, response_content):
5857
if self.data:
5958
for item in self.data:
6059
industry = dict(industry_level=item.get('industryLevel'), id=item.get('id'),
61-
name_cn=get_string(item.get('nameCN')),
62-
name_en=get_string(item.get('nameEN')))
60+
name_cn=item.get('nameCN'),
61+
name_en=item.get('nameEN'))
6362
self.stock_industry.append(industry)

tigeropen/quote/response/future_exchange_response.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"""
77
import pandas as pd
88

9-
from tigeropen.common.util.string_utils import get_string
109
from tigeropen.common.response import TigerResponse
1110

1211

@@ -29,10 +28,10 @@ def parse_response_content(self, response_content):
2928
if value is None:
3029
continue
3130
if key == 'code':
32-
code = get_string(value)
31+
code = value
3332
elif key == 'name':
34-
name = get_string(value)
33+
name = value
3534
elif key == 'zoneId':
36-
zone = get_string(value)
35+
zone = value
3736
items.append([code, name, zone])
3837
self.exchanges = pd.DataFrame(items, columns=['code', 'name', 'zone'])

tigeropen/quote/response/market_status_response.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77

88
import dateutil.parser as dateparser
99

10-
from tigeropen.common.util.string_utils import get_string
10+
from tigeropen.common.response import TigerResponse
1111
from tigeropen.common.util.common_utils import eastern, china, hongkong
1212
from tigeropen.quote.domain.market_status import MarketStatus
13-
from tigeropen.common.response import TigerResponse
1413

1514

1615
class MarketStatusResponse(TigerResponse):
@@ -31,15 +30,15 @@ def parse_response_content(self, response_content):
3130
if value is None:
3231
continue
3332
if key == 'market':
34-
market = get_string(value)
33+
market = value
3534
elif key == 'marketStatus':
36-
status = get_string(value)
35+
status = value
3736
elif key == 'openTime':
3837
if value.endswith(' EDT') or value.endswith(' EST'):
3938
value = value[0:len(value) - 4]
4039
open_time = dateparser.parse(value)
4140
elif key == 'status':
42-
trading_status = get_string(value)
41+
trading_status = value
4342

4443
if open_time and market:
4544
if market == 'US':

tigeropen/quote/response/quote_depth_response.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# -*- coding: utf-8 -*-
22
from tigeropen.common.response import TigerResponse
3-
from tigeropen.common.util.string_utils import get_string
43

54

65
class DepthQuoteResponse(TigerResponse):
@@ -17,13 +16,13 @@ def parse_response_content(self, response_content):
1716
if self.data and isinstance(self.data, list):
1817
if len(self.data) == 1:
1918
item = self.data[0]
20-
symbol = get_string(item.get('symbol'))
19+
symbol = item.get('symbol')
2120
asks = [(v['price'], v['volume'], v['count']) for v in item.get('asks', [])]
2221
bids = [(v['price'], v['volume'], v['count']) for v in item.get('bids', [])]
2322
self.order_book = {'symbol': symbol, 'asks': asks, 'bids': bids}
2423
else:
2524
for item in self.data:
26-
symbol = get_string(item.get('symbol'))
25+
symbol = item.get('symbol')
2726
asks = [(v['price'], v['volume'], v['count']) for v in item.get('asks', [])]
2827
bids = [(v['price'], v['volume'], v['count']) for v in item.get('bids', [])]
2928
self.order_book[symbol] = {'symbol': symbol, 'asks': asks, 'bids': bids}

tigeropen/quote/response/symbol_names_response.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"""
77

88
from tigeropen.common.response import TigerResponse
9-
from tigeropen.common.util.string_utils import get_string
109

1110

1211
class SymbolNamesResponse(TigerResponse):
@@ -21,5 +20,5 @@ def parse_response_content(self, response_content):
2120
self._is_success = response['is_success']
2221

2322
if self.data and isinstance(self.data, list):
24-
self.symbol_names = [(get_string(item['symbol']), get_string(item['name'])) for item in self.data if
23+
self.symbol_names = [(item['symbol'], item['name']) for item in self.data if
2524
len(item) == 2]

tigeropen/quote/response/symbols_response.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"""
77

88
from tigeropen.common.response import TigerResponse
9-
from tigeropen.common.util.string_utils import get_string
109

1110

1211
class SymbolsResponse(TigerResponse):
@@ -21,4 +20,4 @@ def parse_response_content(self, response_content):
2120
self._is_success = response['is_success']
2221

2322
if self.data and isinstance(self.data, list):
24-
self.symbols = [get_string(symbol) for symbol in self.data if symbol]
23+
self.symbols = [symbol for symbol in self.data if symbol]

tigeropen/trade/response/account_profile_response.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
@author: gaoan
66
"""
77
import json
8+
89
from tigeropen.common.response import TigerResponse
9-
from tigeropen.common.util.string_utils import get_string
1010
from tigeropen.trade.domain.profile import AccountProfile
1111

1212

@@ -30,10 +30,10 @@ def parse_response_content(self, response_content):
3030
if value is None:
3131
continue
3232
if key == 'account':
33-
account = get_string(value)
33+
account = value
3434
elif key == 'capability':
35-
capability = get_string(value)
35+
capability = value
3636
elif key == 'status':
37-
status = get_string(value)
37+
status = value
3838
profile = AccountProfile(account, capability, status)
3939
self.profiles.append(profile)

0 commit comments

Comments
 (0)