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)
get_stocks_historical_data.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录