Upgrade from Eikon -> Workspace. Learn about programming differences.

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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
3 0 0 2

How to retrieve subsidiary data given the Company PermID?

I'm using the eikon API to retrieve the subsidiary data from the refinitiv. I'm able to retrieve subsidiary information for level 1 subsidiaries only. I'm unable to retrieve the level2 or upto level n subsidiaries. I want my results to be in the form of dictionary. In short for a company tree, the result of the function should return dictionary.

For example, the output of retrieve_subsidiaries(['5000065135', '4298158727']) should be ...

{

'5000065135': ['5036778064', '5043368391', '5076086756', '5046707557', '', '5036778506', '5082358234']

'4298158727': []

}.

I have tried this. But unfortunately, the run time is also very high as there are multiple API requests being done.

I have tried this at my end. Is there any other way to address this issue?

def retrieve_subsidiaries(tcodes):
    subs_parameters = {
        'SDate': 0,
        'EDate': -3,
        'Curn': 'JPY',
        'Scale': 6,  
        'ReportType': 'Latest',       # Latest, Prelim, Final, All
        'ReportingState': 'Rsdt',    # Orig, Rsdt, All
        'FRQ': 'FY',
    }

    subs_fields = [
        'TR.OrganizationID',
        'TR.RelatedOrgId',
        'TR.RelatedOrgType',
    ]

    try: # Main part of the code
        display(tcodes)
        subs, err = ek.get_data(tcodes, subs_fields, subs_parameters)
        display(subs)
    except Exception as e:
        display(e)
        sys.exit(1)
        
    result = {}
    
    tcodes = [int(item) for item in tcodes_list]
    for tcode in tcodes:
        subsidiaries = subs[(subs['Instrument'] == tcode) & (subs['Related Org Type'] == 'Subsidiary')]['Related OrgId'].tolist()
        result[tcode] = [sub for sub in subsidiaries if sub]  
        
    return result, subs
eikoneikon-data-api#technologypython api
icon clock
10 |1500

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

1 Answer

· Write an Answer
Upvotes
Accepted
80.1k 257 52 75

@Jeslin.S

Thank you for reaching out to us.

Please enable logging in the Eikon Data API and share the log file. Therefore, we can verify why the runtime is very high.

You can enable logging in the API by using the following code.

ek.set_log_level(1)
ek.set_app_key('<app key>')

I tried to run the provided the code and got the following error.

1693296263677.png



1693296263677.png (46.2 KiB)
icon clock
10 |1500

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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