getting different values using ek.get_data for same instrument

Hi ,

while using eikon data api in python for instrument 'GLTR.K' , I am getting multiple rows with different values.

I am expecting single row.

Can you please help. Am I missing something?


Below is the code snippet with output:

df, err = ek.get_data(

instruments = ['GLTR.K'],

fields = ['TR.CommonName',

'TR.CompanySharesOutstanding(SDate=0)/*# Shares Outstanding*//*# Shares Outstanding*/',

'TR.FundNumberOfShares',

'TR.NETASSETVAL'

]

)


display(df)



output:

1656925070381.png



Tagged:

Best Answer

  • raksina.samasiri
    Answer ✓

    hi @A.Anand ,

    I tried to add the possible output parameters of fields you have used and got the result below

    df, err = ek.get_data(
    instruments = ['GLTR.K'],
    fields = ['TR.CommonName',
    'TR.CompanySharesOutstanding(SDate=0)','TR.CompanySharesOutstanding(SDate=0).date',
    'TR.FundNumberOfShares','TR.FundNumberOfShares.holdingname','TR.FundNumberOfShares.instrument',
    'TR.NETASSETVAL'
    ]
    )
    display(df) 

    1656926381131.png

    The multiple rows returned are caused by the field 'TR.FundNumberOfShares'. The suggestion is you can split the code like an example below

    df, err = ek.get_data(
    instruments = ['GLTR.K'],
    fields = ['TR.FundNumberOfShares','TR.FundNumberOfShares.holdingname','TR.FundNumberOfShares.instrument'
    ]
    )
    display(df)
    df, err = ek.get_data(
    instruments = ['GLTR.K'],
    fields = ['TR.CommonName',
    'TR.CompanySharesOutstanding(SDate=0)','TR.CompanySharesOutstanding(SDate=0).date',
    'TR.NETASSETVAL'
    ]
    )
    display(df)

    1656926506012.png

    To see the available output parameter of each field, Data Item Browser (DIB) can be used, you may check this video to see how to use it

    Hope this helps and please let me know in case you have any further questions

Answers