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
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-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-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.

@shahlar.mammadov

Hi,

Thank you for your participation in the forum.

Is the reply below satisfactory in answering your question?

If yes please click the 'Accept' text next to the most appropriate reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,

AHS

1 Answer

· Write an Answer
Upvote
Accepted
78.8k 250 52 74

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