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.

Best Answer

  • [Deleted User]
    [Deleted User] Newcomer
    Answer ✓

    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