!9 新建的stock.db不包括已经退市的股票,导致历史数据没有导入

Merge pull request !9 from Jet/fix-strategy
This commit is contained in:
fasiondog 2024-03-04 08:31:10 +00:00 committed by Gitee
commit 2c2287b983
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -111,6 +111,17 @@ def import_stock_name(connect, api, market, quotations=None):
stk_list.extend(get_fund_code_name_list(market))
for stock in stk_list:
newStockDict[str(stock['code'])] = stock['name']
if market == MARKET.SH:
df = ak.stock_info_sh_delist()
l = df[['公司代码', '公司简称']].to_dict(orient='records') if not df .empty else []
for stock in l:
newStockDict[str(stock[''])] = stock['']
elif market == MARKET.SZ:
for t in ['', '']:
df = ak.stock_info_sz_delist(t)
l = df[['证券代码', '证券简称']].to_dict(orient='records') if not df.empty else []
for stock in l:
newStockDict[str(stock[''])] = stock['']
marketid = get_marketid(connect, market)