Skip to content

Commit

Permalink
format with black
Browse files Browse the repository at this point in the history
  • Loading branch information
SunsetWolf committed May 29, 2024
1 parent 894fcd3 commit 65f16d7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
20 changes: 10 additions & 10 deletions scripts/data_collector/pit/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ def get_instrument_list(self) -> List[str]:
return symbols

def normalize_symbol(self, symbol: str) -> str:
if symbol.startswith('6'):
exchange = 'sh'
elif symbol.startswith('0') or symbol.startswith('3'):
exchange = 'sz'
if symbol.startswith("6"):
exchange = "sh"
elif symbol.startswith("0") or symbol.startswith("3"):
exchange = "sz"
else:
exchange = 'bj'
exchange = "bj"
return f"{exchange}{symbol}"

@staticmethod
Expand Down Expand Up @@ -205,12 +205,12 @@ def get_data(
) -> pd.DataFrame:
if interval != self.INTERVAL_QUARTERLY:
raise ValueError(f"cannot support {interval}")
if symbol.startswith('6'):
exchange = 'sh'
elif symbol.startswith('0') or symbol.startswith('3'):
exchange = 'sz'
if symbol.startswith("6"):
exchange = "sh"
elif symbol.startswith("0") or symbol.startswith("3"):
exchange = "sz"
else:
exchange = 'bj'
exchange = "bj"

code = f"{exchange}.{symbol}"
start_date = start_datetime.strftime("%Y-%m-%d")
Expand Down
5 changes: 4 additions & 1 deletion scripts/data_collector/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,10 @@ def _get_symbol():
if len(_symbols) < 3900:
raise ValueError("request error")

_symbols = [_symbol + '.ss' if _symbol.startswith('6') else _symbol + '.sz' if _symbol.startswith(('0', '3')) else None for _symbol in _symbols]
_symbols = [
_symbol + ".ss" if _symbol.startswith("6") else _symbol + ".sz" if _symbol.startswith(("0", "3")) else None
for _symbol in _symbols
]
_symbols = [_symbol for _symbol in _symbols if _symbol is not None]

return set(_symbols)
Expand Down

0 comments on commit 65f16d7

Please sign in to comment.