Retrieve LAST_QUOTE from Eikon API using python

I need to retrieve LAST_QUOTE data history using python and Eikon API. I want the same output as if using Eikon Excel call:

=RHistory(".IBBEU003D","LAST_QUOTE.Timestamp;LAST_QUOTE.Close","INTERVAL:1D NBROWS:25",,"TSREPEAT:NO")

It would be appreciated if the solution would work for similar data fields.

Best Answer

  • @fgaspar So the get_timeseries api call has a reduced datamodel - Open, High, Low, Close, Volume, Count. The Close field in that model is the same as CF_CLOSE - which you can find the description for in the Data Item Browser app. Unfortunately you cannot use the get_timeseries API to request any other fields as a timeseries history. You can use the get_data api call to retrieve non-realtime field history. Something like this would usually work (it does not with the RIC you wanted - see my note below regarding this instrument):

    df, err = ek.get_data('VOD.L', fields = ['TR.PriceClose.date','TR.PriceClose','TR.Volume'],parameters={'SDate':'2019-12-01','Frq':'D','EDate':'2020-12-01'})

    df

    image

    We do however, have another route - which is the Refinitv Data Platform (RDP) APIs and their accompanying ease of use RDP Libraries (Python, Typescript and a community supported .NET version). Eikon users have access to many new services there such as Search APIs, Instrument Pricing and Analytics APIs & much more, and importantly in your case Historical Pricing APIs - these have an enhanced realtime data model of about 30 fields instead of the reduced get_timeseries data model. You can see examples of how to get started (pip install refinitiv.dataplatform) in the links above. You could try something as simple as:

    import refinitiv.dataplatform as rdp
    import pandas as pd
    import numpy as np
    session = rdp.open_desktop_session('YOUR EIKON APP KEY HERE')

    rdp.get_historical_price_summaries('VOD.L')

    image

    Now unfortunately - the RIC you were initially looking for .IBBEU003D is not yet available via this service, but many others will be - so it may help you in future.

    In terms of Data Item Browser usage you should type in an instrument and then you can also get values. The instrument you were looking for is a contributed index which is using illogical Fields or FIDs - so it is slightly more complicated than more standard instruments. If you need more help with that particular instrument and field meanings or where things are located please open a ticket with our content support team using Contact Us in the main Eikon menu and specifying a content query.

    I hope this can help.

Answers

  • @fgaspar - so if you are looking for just the latest value snapshot you can just us the following python call to our real-time fields (any realtime field - you can use the data item browser (type DIB into eikon search bar) to search for any field you like):

    df,err = ek.get_data(".IBBEU003D",['CF_Date','CF_Time',"CF_Last"]) 
    df

    image

    If you want a timeseries history of this you can try:

    df1 = ek.get_timeseries(".IBBEU003D",['CLOSE'],count=25,interval='daily') df1

    image

    The most recent value available is from 1-Feb so I'm not sure what time this is updated every day - maybe 18:25 each day as this seems to be an index. I hope this can help.

  • Could you please share how one can find the item codes needed? I am using Eikon Data Item Browser and I am unable to find "CLOSE"/"close" item and what I find is empty, please see the image:image

    I have similar issue in obtaining Mid Yield for the same identifier so I would like to know the way to resolve these task myself.