获取股票历史数据[日线][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 里的全部的股票号码,可以从同花顺等软件中导出


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM