OWNERSHIP DATA BY TYPE AND COUNTRY: EIKON API FOR PYTHON

fgf505
fgf505 Newcomer
edited February 3 in Eikon Data APIs

Dear Developer Community,

I am trying to access ownership data. For each firm-year, I seek PctOfSharesOutHeld by investor type in a particular country.

I need guidance with the required modificaitons in the following code, I think this requires sum of PctOfSharesOutHeld by InvestorType and by InvAddrCountry. Please guide me regarding the implementation.

data, err = ek.get_data(
instruments=['4449.T', 'ADV.OQ', 'WEBO.MI'],
fields=[
'TR.InvestorFullName',
'TR.SharesHeld',
'TR.SharesHeld.calcdate',
'TR.PctOfSharesOutHeld',
'TR.InstrStatTypeValue',
'TR.InvestorType',
'TR.InvestorTypeId',
'TR.CategoryOwnershipPct',
'TR.InvParentType',
'TR.InvInvestmentStyleCode',
'TR.OwnTrnverRating',
'TR.InvAddrCountry',
'TR.InvestorAddrCity'
],
parameters={'Frq':'Y','SDate': '2013-12-31','EDate':'2014-12-31'}
)

Best Answer

  • fgf505
    fgf505 Newcomer
    Answer ✓

    Dear Jirapongse,

    Thank you for your reply.

    I think I am close, but I need some more assistance. I aim to extract ownership data for firms over time in the following format (screenshot attached).

    The recent code you shared specifies a particular investor in the parameter. However, I do not want to limit it to any investor. As in the following snapshot, 'Sum(TR.PctOfSharesOutheld)' should return the sum of the percentage of shares outheld by an investor type within the country or by country and investor type.

    Thanks Again,

    Regards,

    Amjad

    image.png

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @fgf505

    Thank you for reaching out to us.

    Is this question about the Python dataframe manupulations? If yes, the code should look like this:

    data, err = ek.get_data(
        instruments=['4449.T', 'ADV.OQ', 'WEBO.MI'],
        fields=[    
        'TR.PctOfSharesOutHeld', 
        'TR.InvestorType',
        'TR.InvestorTypeId',
        'TR.InvAddrCountry'
        ]
        )
    df = data.groupby(['Instrument', 'Investor Type Description ID','Investor Address Country'], sort=True).sum().reset_index()
    df
    

    For more information, please refer to the dataframe document.

  • fgf505
    fgf505 Newcomer

    Dear Jirapongse,

    Thank you for your swift response.

    The question does not pertain to Python data manipulation. Rather, I want to set the parameters within the data extraction code. For example, the following Excel formula brings forward the sum of shares outheld by investor type.

    =@RDP.Data($A$2,"SUM(TR.PctOfSharesOutHeld)","TheInvestorType=#1 Sdate=#2 CH=Fd",,$L$7,C$1)

    I seek to download bulk data. I want to perform a similar operation but within a subgroup of the country of address.

    Looking forward to hearing from you.

    Regards,

    Amjad

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @fgf505

    Thank you for the explanation. You can convert the =@RDP.Data formula to the Python by using the same fields, and parameters, as shown below.

    data, err = ek.get_data(
        instruments=['4449.T', 'ADV.OQ', 'WEBO.MI'],
        fields=[    
        'SUM(TR.PctOfSharesOutHeld)'
        ],
        parameters={'TheInvestorType':301,'SDate':'2024-01-01'}
        )
    data
    

    If you have questions regarding the parameters used in the =@RDP.Data formula, please contact the helpdesk support team directly via MyAccount. After you get the =@RDP.Data formula, you can convent it to the Python code.

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @fgf505

    Please contact the helpdesk team directly via MyAccount and ask for the =@RDP.Data formula that can get the required data.

    After that, please share the formula so I can convert it to the Python code.