獲取股票歷史數據[日線][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