1. 程式人生 > >Python 3 獲取 股票、期權等資料

Python 3 獲取 股票、期權等資料

1. 獲取 API 

1)註冊 https://tushare.pro/

 

2. Python 安裝 tushare 庫 

"pip install tushare"

 

 

3. 通過介面獲取資料

https://tushare.pro/document/2?doc_id=25

import tushare as ts

pro = ts.pro_api('xxxxxxxx')  #tushare token

df = pro.daily(ts_code = '000001.SZ', start_date = '
20181201', end_date = '20181220') print(df) data = pro.query('stock_basic', exchange='', list_status='L', fields='ts_code,symbol,name,area,industry,list_date') print(data)
View Code