For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 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-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythonsettlement
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

1 Answer

Upvote
Accepted
38.1k 71 35 53

@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 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea