quandl FXH1下载数据

时间:2018-11-11 01:31:47

标签: python quandl

我订阅了FXCM 1小时数据。当我转到https://www.quandl.com/tables/FXH1/FXCM-H1时可以看到数据。下面的代码不断给我

    File "quandl1.py", line 17, in <module>
data = quandl.get('FXH1/FXCM-H1')
    File "/usr/lib64/python3.5/site-packages/quandl/get.py", line 48, in get
    data = Dataset(dataset_args['code']).data(params=kwargs, handle_column_not_found=True)

如果我访问网站https://www.quandl.com/tables/FXH1/FXCM-H1,我会看到有限的数据。库不是FXH1 / FXCM-H1吗?

    import quandl
    quandl.ApiConfig.api_key = "My Key"
    data = quandl.get('FXH1/FXCM-H1')
    data.tail()


    [me@localhost fxcm]$ python3 quandl1.py
    Traceback (most recent call last):
    File "quandl1.py", line 17, in <module>
    data = quandl.get('FXH1/FXCM-H1')
    File "/usr/lib64/python3.5/site-packages/quandl/get.py", line 48, in get
    data = Dataset(dataset_args['code']).data(params=kwargs, handle_column_not_found=True)
    File "/usr/lib64/python3.5/site-packages/quandl/model/dataset.py", line 47, in data
    return Data.all(**updated_options)
    File "/usr/lib64/python3.5/site-packages/quandl/operations/list.py", line 14, in all
    r = Connection.request('get', path, **options)
    File "/usr/lib64/python3.5/site-packages/quandl/connection.py", line 36, in request
    return cls.execute_request(http_verb, abs_url, **options)
    File "/usr/lib64/python3.5/site-packages/quandl/connection.py", line 44, in execute_request
    cls.handle_api_error(response)
    File "/usr/lib64/python3.5/site-packages/quandl/connection.py", line 85, in handle_api_error
    raise klass(message, resp.status_code, resp.text, resp.headers, code)
    quandl.errors.quandl_error.NotFoundError: (Status 404) (Quandl Error QECx02) You have submitted an incorrect Quandl code. Please check your Quandl codes and try again.

1 个答案:

答案 0 :(得分:0)

    import quandl
    import pandas as pd
    quandl.ApiConfig.api_key = "My Key"
    pd.data = ({"None", "symbol", "date", "hour", "openbid", "highbid", "lowbid", "closebid", "openask", "highask", "lowask", "closeask", "totalticks"})
    pd.data = quandl.get_table('FXCM/H1', date = "2002-02-01,2002-02-02,2002-02-03,2002-02-04,2002-02-05,2002-02-06,2002-02-07,2002-02-08,2002-02-09", symbol='EUR/USD')
    for index, row in pd.data.iterrows() :
         print(row.to_frame().T)