获取股票历史数据[日线][Python][Tushare]

import tushare as ts

file = open("d:/stock_txt/stocklist_python.txt")
path='d:/tushare/history/' 
filetype='.csv'

     
while 1:
    line = file.readline()
    rs=line.replace('\n', '')
    if not line:
        break
    pass # 
    name=path+rs+filetype
    print(name)
    df=ts.get_hist_data(rs,retry_count=50)
    df.to_csv(name)
  
stocklist_python.txt 里的全部的股票号码,可以从同花顺等软件中导出

猜你喜欢

转载自www.cnblogs.com/theanqing/p/9904048.html