Eikon Python API - get_timeseries() - bid/ask

Hello.

Do you plan to add bid and ask columns to the get_timeseries() function? According to the docs, bid and ask are not in list of available fields currently.

For example, for this RIC - /APCJ271702500.U - there no Close price, but there are Bid Close and Ask Close as of 2017-10-26, both can be retrieved using RHistory() in Excel. How to get them using get_timeseries()?

It seems that there is .WithView("BID") in C# API for this purpose, but is there any Python equivalent?

Thank you.

Best Answer

  • Hi,

    Currently, timeseries service provides only a limited field list according to the selected interval:

    • 'tick' => [TIMESTAMP, VALUE, VOLUME]
    • 'daily', 'monthly', 'quarterly', 'yearly' => [TIMESTAMP, HIGH, CLOSE, LOW, OPEN, COUNT, VOLUME]

    If you need other fields like ASK and BID, you should use get_data function:

    >>> data, error=ek.get_data('MSFT.O', ['TR.ASKPRICE.Date', 'TR.ASKPRICE','TR.BIDPRICE'], parameters={'SDate':'2017-08-01', 'EDate':'2017-08-04'})
    >>> data
    Instrument Date Ask Price Bid Price
    0 MSFT.O 2017-08-01T00:00:00Z 72.56 72.55
    1 MSFT.O 2017-08-02T00:00:00Z 72.25 72.24
    2 MSFT.O 2017-08-03T00:00:00Z 72.15 72.14
    3 MSFT.O 2017-08-04T00:00:00Z 72.66 72.65

Answers

  • Does the get_timeseries function allow for adding Bid and Ask now? I am looking for a function that returns Bid and ask on a minutes level for a given stock.

  • Hi @basilio.konstantin.kalus ,

    Please check the answer below from this thread

    For your information, after this, please start the new post by asking a further question as the question with an accepted answer won't be monitored by the forum's moderator so the answer might not be provided.

    I would recommend you look at the newer RD Library for Python - which is currently in Beta and due for release in the coming months.

    The following code is able to get Bid and Ask in a minute interval

    import refinitiv.data as rd
    rd.open_session()
    rd.get_history(universe="LSEG.L", fields=["BID", "ASK"], interval="1min")

    You may follow its example in the Codebook app on Eikon Desktop/ Refinitiv Workspace in the directory __Examples__/01. Data Retrieval & Discovery/01.01. Refinitiv Data Library/EX_01_01_02__Access__Get_History.ipynb

    1655371937643.png

    It will also have fuller documentation - the RD Library team advised that they are awaiting the completion of the documentation to confirm the release date.

    Please let me know in case there is any further questions

  • Thanks for your response. However, I was not able to use the code snippet above.

    import refinitiv.data as rd

    always runs into an error (No module named 'refinitiv.data') and subsequently the code is not executing. I was not able to solve that issue. How can I avoid this error?

  • Hi @basilio.konstantin.kalus

    The refinitiv.data Python library needs to be installed before it can be imported.

    It's recommended to follow this RD library quick start guide: getting started with Python.

    Please let me know in case you have any questions.

  • I have used this command to install the library:

    pip install refinitiv-dataplatform
    import refinitiv.dataplatform as rdp

    However, it still does not work even if I open a desktop session and using my API key

    rdp.open_desktop_session('MY API KEY')

    The Dataframe I get is just empty, also if I run the code snippet provided on the refinitiv website like this one:

    rdp.get_historical_price_summaries(
    universe = 'VOD.L',
    interval = rdp.Intervals.DAILY,
    fields = ['BID','ASK','OPEN_PRC','HIGH_1','LOW_1','TRDPRC_1','NUM_MOVES','TRNOVR_UNS']
    )
  • Hi @basilio.konstantin.kalus ,

    The refinitiv.data (RD) and Refinitiv.dataplatform (RDP) are the different libraries

    as mentioned in this comment, The RD library is recommended to be used.

    However, if you'd like to use refinitiv-dataplatform one, you could update your code to be as the below (import the library as rdp and do the rdp.open_desktop_session(), so it's matched with the rdp.get_historical_price_summaries()

    )

    1656583412098.png

    Hope this helps

  • Hi @raksina.samasiri ,

    thanks for your help. Unfortunately, this code only works in the codebook environment from Refinitiv (at least for me), it does not work if I run the code locally in Pycharm (while I am loged into Refintiv)

    Do you have and recommendations to solve this issue?