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
43 2 5 8

Wrong currency or null value returned in Refinitiv Data Library

Hi.
The following request returns either wrong values or null values.

instruments = [".MIEUG0000PEU", ".FTAWPACXJAR", ".TRIFREMLVNU", ".dMIGB0ECISGGB", ".dMIWO0EC0SGGB", 
               ".MIJP0200BGGB", ".MIUGG200BGGB", ".MIAXK200BGGB", ".MIUS0200BGGB", ".MIEF0EC0SGGB" ]
rd.get_data(universe = instruments, fields = ["TR.IndexCalculationCurrency"])

1686746247216.png


However, when I check in Workspace, the correct data can be retrieved

1686746988232.png


Can you have a look, please?

Thanks



python#technology#contentpython apicodebook
1686746247216.png (37.9 KiB)
1686746988232.png (138.5 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
Accepted
80.2k 259 52 75

You can also use Eikon Data API in Codebook.

The code looks like this:

import refinitiv.data.eikon as ek


ek.set_app_key('DEFAULT_CODE_BOOK_APP_KEY')
instruments = [".MIEUG0000PEU", ".FTAWPACXJAR", ".TRIFREMLVNU", ".dMIGB0ECISGGB", ".dMIWO0EC0SGGB", 
               ".MIJP0200BGGB", ".MIUGG200BGGB", ".MIAXK200BGGB", ".MIUS0200BGGB", ".MIEF0EC0SGGB" ]
df, err = ek.get_data(instruments, fields = ["CF_CURR"])
df

The output is:

1686911681633.png


1686911681633.png (45.0 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
17.8k 82 39 63

Hi @yaokoffi.kouassi

Try using the field: CF_CURR

1686751951593.png


1686751951593.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.

Upvotes
43 2 5 8

Hi @nick.zincone and thank you for your reply.

I tried to use CF_CURR field and the response is not satisfying.

Instead of getting the string value of the currency, I retrieved the digital currency code as you can see below

1686907631749.png


I've read this post which allows to resolve the currency code in RDP which is in my mind a hack.

As the code I'm currently designing is for an external user, I prefer to have an elegant solution.


Question : is there a parameter I can put in the get_data parameter field to resolve the currency code ?

Thanks



1686907631749.png (36.6 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.

Upvote
1.4k 5 3 6

Hi @yaokoffi.kouassi

What about this?

You try to get a currency from the TR.PriceClose.currency. However it seems that the second instrument is a bit different with the currency code "US2" and is not recognized, therefore you may try this workaround:

rd.get_data(universe = instruments, fields = ["AVAIL(TR.PriceClose.currency,TR.IndexCalculationCurrency)"])
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
43 2 5 8

Hi @marcin.bunkowski01 ,

Fantastic! in your code above, If I use TR.ClosePrice.currency instead of TR.PriceClose.currency, then the output is correct.

1686911031478.png


Thank you for your help.


1686911031478.png (33.4 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
43 2 5 8

Thanks @Jirapongse!

Your piece of code works as well.

However, I've been advised to use Refinitiv Data Library instead of EIkon Data API.

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.

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.