Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 1

[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

eikoneikon-data-apipython#productATS
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi @nathan.simonis2 ,

Could you please let us know if the issue still persists?

Thanks,
AHS

Hello @nathan.simonis2

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?


If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,


AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,


AHS

Upvotes
Accepted
14.2k 30 5 10

Hi @nathan.simonis2 ,

I can retrieve the data properly, could you please let me know if the issue still persists?

If it is, please follow bullet 2.2 ) Refinitiv Data Library (RD Library) in Eikon Data API and Refinitiv Data Library - Troubleshooting and post the detail you got here for further investigation (RD Python Library version, enable the logging)

1683711286881.png


1683711286881.png (24.8 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
5.8k 21 2 6

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



1681830209463.png (106.9 KiB)
1681830313088.png (16.7 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

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

1681832265813.png (11.0 KiB)
Upvote
17.4k 82 39 63

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()
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

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.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.