question

Upvotes
Accepted
3 0 0 1

How to find Country of Risk based on RIC code with Datastream Python API?

The country of risk can be obtained using the datastream excel add-in with the function: =TR(RIC code,"TR.CoRPrimaryCountry"), whereas I cannot find how to retrieve the country of risk for a countryparty with the Python API.

datadatastream-apidsws-api
icon clock
10 |1500

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

1 Answer

Upvotes
Accepted
1.4k 6 2 2

Dear Bagci,

"TR.CoRPrimaryCountry" is a field used to collect data (in this case: 'Country of Risk') from Refinitiv Workspace (a.k.a.: Eikon). This field can be used with the Eikon Data API for any stock (e.g.: Apple with the RIC '@AAPL') via the following code in Python:


import eikon as ek
ek.set_app_key("insert eikon key here")
df, err = ek.get_data(instruments = ['@AAPL'],
                      fields = ['TR.CoRPrimaryCountry'],
                      parameters = {'SDate':'0',
                                    'EDate':'-19',
                                    'Period':'FY0',
                                    'Frq':'FY'})
df


Datastream dos not - unfortunately - have such a field. You may find a list of all the fields available from Datastream in the document attached: Datastream fields for AAPL.txt


icon clock
10 |1500

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

Click below to post an Idea Post Idea