def get_basic_info(show_progress=True):
# ?????
if show_progress:
click.echo("????????")
ts_symbols = ts.get_stock_basics()
if show_progress:
click.echo("??????")
symbols = []
histories = {}
# ??????
i = 0
total = len(ts_symbols)
for index, row in ts_symbols.iterrows():
i = i +1
if i > 10:
break
srow = {}
# ????????
click.echo("??????%s(%s)??????? (%d/%d)" % (index, row['name'], i, total))
histories[index] = ts.get_hist_data(index)
srow['start_date'] = histories[index].index[-1]
srow['end_date'] = histories[index].index[0]
srow['symbol'] = index
srow['asset_name'] = row['name']
symbols.append(srow)
df_symbols = pd.DataFrame(data=symbols).sort_values('symbol')
symbol_map = pd.DataFrame.copy(df_symbols.symbol)
# fix the symbol exchange info
df = df_symbols.apply(func=convert_symbol_series, axis=1)
return df, histories, symbol_map
评论列表
文章目录