get_stocks_historical_data.py 文件源码

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

项目:stock_cn 作者: QuantFisher 项目源码 文件源码
def get_stocks_basics_info():
    file = infoFilePath + "stk_basics_" + today + ".csv"
    if os.path.exists(file) is not True:
        try:
            raw_data = ts.get_stock_basics()
        except IOError:
            raise Exception('Can not read stocks basic info through tushare interface!')

        raw_data = raw_data.sort_index()

        try:
            raw_data.to_csv(file, index=True, encoding='gbk')
        except Exception:
            print('Write stocks basic info to csv file error!')

    try:
        raw_data = pd.read_csv(file, encoding='gbk')
    except IOError:
        print('Read stocks basic info from csv file error!')

    return raw_data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号