How can I get hourly data via python RDP api?

Hi,

I am trying to gather the hourly ask/bid price for JPYUSD using code below, but all I can get is data by minutes. Seems like it does not support intervals other than daily and one minutes.

Thanks

image

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @filip.shu

    It looks like to be a bug in the API, as mentioned in this thread.

    The workaround, for now, is using the endpoint to make a request.

    endpoint = rdp.Endpoint(
        session = rdp.get_default_session(), # Optionnal
        url = "/data/historical-pricing/v1/views/intraday-summaries/JPY=")
    response = endpoint.send_request(
        method = rdp.Endpoint.RequestMethod.GET,
        query_parameters={
            'interval': 'PT1H',        
            'start': '2021-02-01T00:00:00.00000000Z',
            'end': '2021-02-24T00:00:00.000000000Z',
            'summaryTimestampLabel': 'endPeriod'
        }
    )
    if response.is_success:
        headers = [h['name'] for h in response.data.raw[0]['headers']]
        df = pd.DataFrame(data=response.data.raw[0]['data'], columns=headers)
        display(df)

    The output is:

    image