get_stocks_historical_data.py 文件源码

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

项目:stock_cn 作者: QuantFisher 项目源码 文件源码
def get_stock_daily_trading_data(code, start_date=startDate, end_date=endDate):
    code = str(code).zfill(6)
    try:
        stock_data = ts.get_h_data(str(code), start=start_date, end=end_date, autype=None)
        filename = hisDataPath + code + ".csv"
        stock_data.to_csv(filename, index=True, encoding='gbk')
        print('Get stock:', code, 'historical data done!')
    except Exception:
        print('Failed to get stock:', code, 'historical data!')
        time.sleep(30)
        get_stock_daily_trading_data(code, startDate, endDate)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号