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
Best Answer
-
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.
0
Answers
-
@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.hi
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
0 -
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)
resultsThe 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.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 685 Datastream
- 1.4K DSS
- 615 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 252 ETA
- 556 WebSocket API
- 38 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 652 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 228 TRKD
- 917 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛