示例#1
0
# 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)
示例#2
0
# 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)
示例#3
0
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')
示例#4
0
    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)