get_market -- bug
This commit is contained in:
1nchaos 2023-10-26 01:21:58 +08:00
parent 0318285abd
commit ca51e06ff7
3 changed files with 4 additions and 2 deletions

View File

@ -77,6 +77,8 @@ class StockMarketBaiDu(StockMarketTemplate):
rename_columns = {'turnoverratio': 'turnover_ratio', 'preClose': 'pre_close', 'range': 'change',
'ratio': 'change_pct', 'time': 'trade_time'}
result_df = pd.DataFrame(data=data, columns=keys).rename(columns=rename_columns)[self._MARKET_COLUMNS]
if result_df.empty:
return pd.DataFrame(data=[], columns=self._MARKET_COLUMNS)
result_df['stock_code'] = stock_code
result_df['trade_date'] = result_df['trade_time']
result_df['trade_time'] = pd.to_datetime(result_df['trade_time']).dt.strftime('%Y-%m-%d %H:%M:%S')

View File

@ -1,4 +1,4 @@
requests>=2.16.0
pandas>=1.1.5
pandas>=0.22.0
beautifulsoup4>=4.0.2
py_mini_racer>=0.6.0

View File

@ -19,7 +19,7 @@ with open("README.md", "r", encoding='utf-8') as f:
requires = [
"requests>=2.16.0",
"pandas>=1.1.5",
"pandas>=0.22.0",
"beautifulsoup4>=4.0.2",
"py_mini_racer>=0.6.0",
]