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
1 1 1 4

Pulling Lipper fund holdings for a large list of RIC instruments using Eikon API (python)

Hello, I need to pull Lipper fud holdings for a list of more than 4000 RIC Instrument. I am using the code copied below, but i get Expected timeout error.


Is it possible to pull these data with only one code?



df0, err = ek.get_data(RIC_list0, ['TR.FundHoldingRIC','TR.FundHoldingName',

'TR.FundLatestFilingDate','TR.FundNumberOfShares',

'TR.FundNumberOfSharesChanged','TR.FundPercentageOfFundAssets'],

{'Endnum':'5000'})

df0


eikon-data-apipython#technologyfundslipper
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
1.6k 3 2 3

Hi @RamadanEA , I am not sure if I understand your need for "with only one code". If you mean you want pull the data fund by fund, yes, you just need to replace the RIC_list0 in your code by the RIC string of the fund (e.g.: 'LP60000012') one by one.

Hence, you loop the list of RICs in your original RIC_list0, and call the ek.get_data one RIC code at a time in the loop and process the data fund by fund.

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.

hi @bob.lee Thank you so much for your reply. I am beginner to coding and still have not been better in looping. Would you please how to write the code as you explained.


The code I posted worked after I tried rerunning it several time, but I am really interested to see how to use for loop in this case. I have tried to do it, but I could not.


Your help would be appreciated!


Thank you!

Ebtehal

Hi @RamadanEA , I think this is a Python coding question that this forum is not the best place to ask. I am not an expert on Python, but I think you can try the loop below:

results = pd.DataFrame([])
for RIC in RIC_list0:
  df0, err = ek.get_data(RIC, ['TR.FundHoldingRIC','TR.FundHoldingName','TR.FundLatestFilingDate','TR.FundNumberOfShares','TR.FundNumberOfSharesChanged','TR.FundPercentageOfFundAssets'],{'Endnum':'5000'})
  results = results.append(df0)
results

The data-frame variable: results should contains all the fund's holdings data in it after the loop. However, if you got a long list of funds, it is very inefficient (may got memory issue if the data set is too large) to keep appending data to data-frame. If you can write (append) the data to a file within the loop rather than keep appending to the "results" variable, it is better to do so using file.

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.