interval parameter doesn't work

Hello.

I want to get weekly or monthly data using historical price summary function, but only I can get daily data.

Should I use another RIC code or function? Please help me. Thanks a lot.

col = ['CMCU3']
start_date = '2019-01-01T00:00:00'
end_date =  '2021-02-01T00:00:00'

df1 = rdp.get_historical_price_summaries(univers = col, interval = rdp.Intervals.WEEKLY, start = start_date, end = end_date)



Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @lsibobe

    It could be a bug in the library.

    The workaround could be like the following.

    col = 'CMCU3'
    start_date = '2019-01-01'
    end_date =  '2021-02-01'
    endpoint = rdp.Endpoint(
        session = rdp.get_default_session(), # Optionnal
        url = "/data/historical-pricing/v1/views/interday-summaries/"+col)

    response = endpoint.send_request(
        method = rdp.Endpoint.RequestMethod.GET,
        query_parameters={
            'interval': 'P1W',
            'start': start_date,
            'end': end_date
        }
    )
    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)

    For monthly data, the interval value is P1M.

Answers