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
38 6 9 11

How to get the associated countries in a list of revenue fractions via Eikon API

Hello, I'm working with the Eikon API via Python and am trying to obtain the associated list of the top 20 countries that are associated with the 20 countries returned by the "Country of Risk Revenue Fraction" data item. The code below gives me the list of revenue fractions, but not the countries themselves to compare with (I need to compare several companies using this variable and the overlaps across countries).


df, err = ek.get_data(
    instruments = ['AAPL.O'],
    fields = ['TR.CoRRevenueFraction']
)
display(df)


Would you be able to help me modify the API call to return both the revenue fraction AND the associated country list?

Many thanks in advance for your help

eikonpythonapi#content
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.

1 Answer

· Write an Answer
Upvote
Accepted
5k 16 2 7

Hi @AAMZ ,


Thank you for your question. Consider adding 'TR.CoRRevenueFraction.countryname' to your fields parameter:

df, err = ek.get_data(
    instruments = ['AAPL.O'],
    fields = ['TR.CoRRevenueFraction', 'TR.CoRRevenueFraction.countryname']
)
display(df)

screenshot-2023-04-11-at-130349.png


You may check for additional value output parameters from CodeCreator app in Eikon/Workspace:

screenshot-2023-04-11-at-130443.png


Hope this helps.


Best regards,

Haykaz



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.

Thank you very much, this is exactly what I was looking for. Thanks also for the quick reply!

Have a nice rest of the day

You're welcome, happy to be helpful!

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.