中国恐慌指数VIX(基于沪深300的)

数据抓取代码部分

'''
##数据抓取与储存 (需要更改储存路径和日期)
###shibor,用于计算无风险利率
begin = '20191201'
end = datetime.strftime(datetime.now(),'%Y%m%d')
Pro = ts.pro_api('**********b893f1c10e43d0017***********')
shibor_interst = Pro.shibor(start_date = begin , end_date = end)
shibor_interst.date =  [i[0:4]+'/'+i[4:6]+'/'+i[6:8] for i in shibor_interst.date]
shibor_interst.to_csv(r'C:\Users\Desktop\金工2\沪深300IVIX计算\shibor_interst.csv',index = None)
###期权数据
opt300_code = Pro.opt_basic(exchange = 'CFFEX',fields ='ts_code,name,call_put,last_edate,exercise_price')  
data_excel = []
for index,row in opt300_code.iterrows():
    df = Pro.opt_daily(ts_code = row['ts_code'],fields = 'ts_code,trade_date,close')
    df['call_put']=ro

你可能感兴趣的:(finance,python)