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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
3 0 1 1

Obtain TR.CommonName and TR.RIC given a list of companies

I have a list of 1752 private company names. I would like to ask how to extract TR.CommonName and TR.RIC for all of the 1752 companies.

I use the following code to obtain TR.CommonName and TR.RIC for Jetstar

df, err = ek.get_data([SCREEN(U(IN(Private(OrgType(COM,UNK,MKP)))),Contains(TR.CommonName, Jetstar))], [TR.CommonName,TR.RIC])

when I try to apply the code to a list of company names like following, I notice that eikon search for companies with names that contains the character "company_list [x]", instead of the value that company_list [x] refers to.

for x in company_list[0,1751]

df_1 = df

df_2, err = ek.get_data(['SCREEN(U(IN(Private(OrgType(COM,UNK,MKP)))),Contains(TR.CommonName,company_list [x]))'], ['TR.CommonName','TR.RIC'])

df_2["MerchantName"] = company_list [x]

df_merged = pd.concat([df_1,df_2],ignore_index = True)

df = df_merged


Thank you very much.

eikoneikon-data-apiricspython apicompany
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

Upvotes
Accepted
14.3k 23 8 12

Hello @songqirong

Do you mean the Eikon Screener search for the company with "company_list[x]" string instead of the value of the company_list[x] variable?

If so, you need to concat the actual value of the company_list[x] variable to the Screener query string.

for x in company_list:
    screen = 'SCREEN(U(IN(Private(OrgType(COM,UNK,MKP)))),Contains(TR.CommonName, {})'.format(x)
    print(screen)

concat-string-screener.png


You can find more details from the following Python resources:


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.