tushare_source.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:zipline_cn_databundle 作者: rainx 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号