import tushare as ts
pro = ts.pro_api('填写你自己的key')
df = pro.daily(**{
"ts_code": "000001.SZ",
"trade_date": "",
"start_date": 20220101,
"end_date": 20220301,
"offset": "",
"limit": ""
}, fields=[
"ts_code",
"trade_date",
"open",
"high",
"low",
"close",
"pre_close",
"change",
"pct_chg",
"vol",
"amount"
])
print(df)
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/34e27df237a697acbad979c670b4a79d.png)
import tushare as ts
pro = ts.pro_api('')
data = pro.query('stock_basic', exchange='', list_status='L', fields='ts_code,symbol,name,area,industry,list_date')
print(data)
print(type(data))
print(type(data['ts_code']))
print(data['ts_code'][0])
print(data['ts_code'][1])
print(data['name'][0])
print(data['name'][1])
print('*********************')
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/adb0a2bf762c722a86e330a02e3f4ef4.png)