Tusahre注册链接 https://tushare.pro/register?reg=365850
import os
import tushare as ts
import pandas
import datetime
token = '自己的'
#可以登录文章首的链接注册获取
pro = ts.pro_api(token)
dateToday = datetime.datetime.today().strftime('%Y%m%d')
def GetList():
try:
data = pro.stock_basic(exchange='SSE', list_status='L', fields='ts_code,symbol,name,area,industry,list_date')
#上交所exchange='SSE' 交易所 SSE上交所 SZSE深交所 BSE北交所
filelist = 'D:\PycharmProjects\Liang-huajiaoyi\A-Data\LIST\Tickerlist.csv'
list = data.ts_code
if os.path.exists(filelist):
history = pandas.read_csv(filelist, index_col=0)
list.append(filelist)
elif os.path.abspath(filelist):
list.to_csv(filelist)
list.to_csv(filelist,index=None)
except:
pass
if __name__ == '__main__':
GetList()
数据样例:
当然也可以修改参数获得更详细的信息
更详细的信息可以去Tushare的社区找
https://tushare.pro/register?reg=365850