[Eikon Python API] How do I specify a source when fetching data with the get_data function?

In Excel I am able to run the following formula: =RtGet("ATS", "INTERNAL_RIC", "BID")
To get access to a quote from an internal instrument.

How could I replicate this in python using the get_data function?
I have tried:

import eikon as ek
ek.set_app_key("xxx")

df, err = ek.get_data(
instruments=["INTERNAL_RIC"],
fields=["BID"],
parameters={"source":"ATS"}
)

without success.
How could I access the same (internal) data as in excel with the Python API?

Thanks and regards

Best Answer

Answers

  • Hi @nathan.simonis2 ,
    I would advise using the RD Library with Codebook and the DIB. The RD library is basically the Eikon Data API version 2.0. Codebook is a Python Environment with example code for you to refer to and automatic credential management solutions that ensure that any issues you encounter are not caused by permission issues. Lastly, DIB allows for an intuitive search of the fields you are after.

    I looked on DIB for the field I think you're after:
    1681830209463.png


    I then copied the field name at the bottom right into codebook:
    1681830313088.png


    Is this the data you were after?


    Once you find the code you're after testing in Codebook, I suggest copying and pasting it in your own environment of choice with your own credentials. More about credential management in RD's Library in Python can be found here:
    https://github.com/Refinitiv-API-Samples/Example.DataLibrary.Python/tree/main/Configuration


  • Hello Jonathan,

    Unfortunately, this is not the data I am after.

    As mentioned in the question, I would like to retrieve some data from an internal RIC which is not available on the IDN feed.

    In Excel I can do this with : =RtGet(MY_SOURCE, MY_RIC, "BID"). It just so happens that in the example above, MY_SOURCE='ATS'.

    1681832265813.png

    I would like to know if there is a way that I can specify that I want the source to be different than the default IDN so I can fetch the same data with the Python API.


    Thank you,

    Regards

    Nathan

  • Hi @nathan.simonis2

    You may be able to use the Pricing interfaces to access your locally configured service. For example:

    import refinitiv.data as rd
    from refinitiv.data.content import pricing
    # Open a desktop session
    rd.open_session()
    # Try to request data from your ATS.
    stream = pricing.Definition(
    universe = ["AAPL.O"], # "INTERNAL_RIC"
    fields = ["BID", "ASK"],
    service="IDN_RDF" # Try specifying "ATS"
    ).get_stream();

    stream.open()
    # Retrieve data from the managed cache
    stream.get_snapshot()
  • Hi @nick.zincone,

    Thanks for the reply.

    I have tried the above but am getting stuck when trying to open the stream.

    stream.open()

    This runs indefinitely without returning an error message.