question

Salih.Bagci avatar image
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
10 |1500

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

1 Answer

jonathan.legrand avatar image
1.9k 12 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


10 |1500

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