New posts are disabled while we improve the user experience.

You can browse the site, or for urgent issues, raise a query at MyAccount.

question

Upvotes
Accepted
1 0 1 2

eikon.get_data precision level is not full

Is there a way to pull full precision values of future settlement prices when using Eikon API? More specifically, I am using the below script:

a, b = ek.get_data("TUM9", "TR.SETTLEMENTPRICE", parameters = {"SDate":"2019-05-20"})

and I am getting 106.542969. However, when I use Eikon excel add in the price I get is 106.542968750 which is 3 decimal points more precise. Is there a way I could get the same precision level while using the Eikon API?

Thank you!

Shahlar

eikoneikon-data-apipythonworkspacerefinitiv-dataplatform-eikonworkspace-data-apisettlement
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
87.8k 294 53 79

@shahlar.mammadov

If I set raw_output to True, the value of TR.SETTLEMENTPRICE is 106.54296875.

a= ek.get_data("TUM9", "TR.SETTLEMENTPRICE", parameters = {"SDate":"2019-05-20"},raw_output=True)
print(a)
{'columnHeadersCount': 1, 'data': [['TUM9', 106.54296875]], 'headerOrientation': 'horizontal', 'headers': [[{'displayName': 'Instrument'}, {'displayName': 'Settlement Price', 'field': 'TR.SETTLEMENTPRICE'}]], 'rowHeadersCount': 1, 'totalColumnsCount': 2, 'totalRowsCount': 2}

However, the data frame shows 06.542969.

a,b= ek.get_data("TUM9", "TR.SETTLEMENTPRICE", parameters = {"SDate":"2019-05-20"})
print(a)
Instrument  Settlement Price
0       TUM9        106.542969

However, if I call a.values, it returns 106.54296875.

a,b= ek.get_data("TUM9", "TR.SETTLEMENTPRICE", parameters = {"SDate":"2019-05-20"})
print(a.values)
[['TUM9' 106.54296875]]

Therefore, it should be related to how the data is displayed by the data frame. I found a solution in the stack overflow which uses pandas.set_option.

import pandas as pd
...
a,b= ek.get_data("TUM9", "TR.SETTLEMENTPRICE", parameters = {"SDate":"2019-05-20"})
pd.set_option("display.precision", 8)
print(a)
  Instrument  Settlement Price
0       TUM9      106.54296875
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.