How do I use the Eikon API to get detailed ETF position data?

Best Answer

  • chavalit-jintamalit
    Answer ✓

    Hi @yuyang

    You can use "CODECR" application in Eikon to check for the available fields.

    image


    From your provided screenshot, here is the sample code:

    df, err = ek.get_data(
        instruments = ['ARKK.K'],
        fields = [
            'TR.ETPConstituentRIC',
            'TR.ETPConstituentName',
            'TR.ETPConstituentShares',
            'TR.ETPConstituentWeightPercent'
        ],
        parameters = {'SDate': '2021-04-30'}
    )
    df = df.sort_values('Weight percent', ascending=False)
    df.head(10)

    image


Answers

  • @yuyang, Firstly, you may need to find the Lipper ID for that ETF, in your sample case, the ARK Innovative ETF is 40209693, hence the ID used for Eikon is "LP40209693". Then the following call will return the latest holdings:

    fund_holdings = ek.get_data('LP40209693', ['TR.FundHoldingRIC','TR.FundHoldingName','TR.FundPercentageOfFundAssets','TR.FundNumberOfShares','TR.FundNumberOfSharesChanged'],{'Endnum':'5000'})
  • Thank you for your reply. When I used this method to obtain ETF positions, I often found that I could not request data but returned NaN. Could you please tell me what happened?

  • @yuyang

    You may verify the data by using Eikon Excel with the formula builder. If the data in the Eikon Excel is also NaN, it could be a content issue. You should directly contact the content support via MyRefinitiv to verify the problem.