# encoding: utf-8 from opendatatools import fx if __name__ == '__main__': # 人民币汇率中间价历史数据 df, msg = fx.get_hist_cny_cpr() print(df[['date', 'USD/CNY']]) # # shibor历史数据 # df, msg = fx.get_his_shibor() # print(df) # # # shibor实时数据 # df = fx.get_realtime_shibor() # print(df) # # # 人民币汇率最新数据 # df = fx.get_cny_spot_price() # print(df)
# encoding: utf-8 from opendatatools import fx if __name__ == '__main__': # 人民币汇率中间价历史数据 df,msg = fx.get_hist_cny_cpr(start_date='2016-01-01') print(df.head(10)) # shibor历史数据 df, msg = fx.get_his_shibor(start_date='2016-01-01') print(df) # shibor实时数据 #df = fx.get_realtime_shibor() #print(df) # 人民币汇率最新数据 #df = fx.get_cny_spot_price() #print(df)
def fx_get_hist_cny_cpr(): df, msg = fx.get_hist_cny_cpr(start_date=request.form['start_date'], end_date=request.form['end_date']) return df.to_json(orient='table')
def test_get_his_cny_cpr(self): df, msg = fx.get_hist_cny_cpr() assert (len(df) >= 100) df, msg = fx.get_hist_cny_cpr('2017-01-01', '2018-05-01') assert (df == None)