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

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @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