Using the MarketSession parameter in RDP HistoricalPricing endpoint

Hello team,

I am trying to retrieve HistoricalPricing events using rdp.HistoricalPricing.get_events and I would like to specify the MarketSession, but I am getting an error,

Can you please help me build this request?

Thank you for your help


image

Welcome!

It looks like you're new here. Sign in or register to get started.

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @mahjoub.faraj

    The get_events method in the RDP library doesn't have the sessions property. However, you can directly send a request to the /data/historical-pricing/v1/views/events/ endpoint to get the data.

    import pandas as pd
    endpoint = rdp.Endpoint(
        session = rdp.get_default_session(), # Optional
       url = "/data/historical-pricing/v1/views/events/VOD.L")
    response = endpoint.send_request(
        method = rdp.Endpoint.RequestMethod.GET,
        query_parameters={
            'eventTypes': 'trade',        
            'start': '2021-03-15T00:00:00.000000000Z',
            'end': '2021-03-16T00:00:00.000000000Z',
            'sessions': 'normal'
        }
    )
    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)

Answers

  • Hi @mahjoub.faraj

    Looking at the help for the Historical Pricing, the sessions parameter is only valid with summaries data e.g.

    rdp.get_historical_price_summaries(
        universe = 'IBM.N', 
        interval = rdp.Intervals.ONE_MINUTE,    
        count = 500,
        sessions = [
            rdp.MarketSession.PRE, 
            rdp.MarketSession.NORMAL, 
            rdp.MarketSession.POST
        ]
    )

    or

    response = rdp.HistoricalPricing.get_summaries(
        universe = 'IBM.N', 
        interval = rdp.Intervals.ONE_MINUTE,    
        count = 500,
        sessions = [
            rdp.MarketSession.PRE, 
            rdp.MarketSession.NORMAL, 
            rdp.MarketSession.POST
        ]
    )  
  • MF
    MF LSEG

    Thank you both for your answers!

    @umer.nalla : the reference reads: "The sessions parameter represents a list of interested official durations in which trade and quote activities occur for a particular universe. The parameter is only available in intraday-summaries, events and single-event APIs and its possible values include"

    I expect the feature to be available in the events api...


    @Jirapongse

    I tried your code and it works well! Thanks for that

    That said, the python library suggest the feature (should) exist: a session parameter shows in the auto suggest as well as the sessions values enumerator.image

  • Hi @mahjoub.faraj

    Thanks for the update. I was referring to the help output for the RDP library Historical Pricing Contents and Function Layers that I assumed you wanted to use. e.g.

    get_events(universe, session=None, eventTypes=None, start=None, end=None, adjustments=None, count=None, fields=None, on_response=None, closure=None)

    OR

    get_historical_price_events(universe, eventTypes=None, start=None, end=None, adjustments=[], count=1, fields=[], on_response=None, closure=None)

    Just to clarify, the session parameter in the above list is the 'connection session' e.g. platform session or desktop session - not sessions

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.