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

 

posted on 2018-12-23 21:22  bruce_he  阅读(2075)  评论(0编辑  收藏  举报