Tushare Pro官网:https://waditu.com/
注册之后使用自己的token即可查询数据。
import tushare as ts
import datetime
def isopen():
"""
判断当前日期大盘是否开盘
is_open = 1 开盘
is_open = 0 不开盘
:return:
"""
DatetimeNOW = datetime.datetime.now().strftime('%Y%m%d')
ts.set_token('08c2ea97dfcff2586e37d我是马赛克86a7e9f170be772aae14fe8eabd5c')
pro = ts.pro_api()
cal_date_pd = pro.trade_cal()
cal_date_pd_daterow = cal_date_pd[cal_date_pd['cal_date'].isin([DatetimeNOW])]
is_open = cal_date_pd_daterow.iloc[-1]['is_open']
return is_open