How to retrieve monthly institutional shareholding data for over 200 firms from 2003 to 2023 usin...

...g Eikon API
Hi everyone,
I am relatively new using Eikon API and I am also relatively unfamiliar with the code. I want to retrieve the monthly institutional shareholding data for about 200 firms from 2003 to 2023 without having to download the shareholder report for every company one by one. Specifically, taking one company's shareholder report as an example, it contains information of every investor's name, the % Outstanding, position ($M), position change (etc). However, for each of my 200 firms, I want to retrive every investor's name, the percentage of shares held by each investor (TR.PctOfSharesOutHeld), the Investor Type ( 'TR.InvParentType') of each investor, the Investor Sub-type ('TR.InvestorType' of each investor, the investment stype ('TR.InvInvestmentStyleCode') of each investor, the country/region ('TR.InvAddrCountry') in which the investor locates every month from 2003 to 2023. I know there is monthly data available through checking one specific company's shareholder report in Refinitiv Workspace. I want the final dataframe to be in the following format (I just choose two companies as an example. I want my dataframe to include all 200 firms, the Date column to include all month from 2003/1/31 to 2023/12/31 for every firm, the Investor Name and the following columns to include all investors for the specific company). Is there any code that will enable me to do this?
In addition, I have already tried the following code myself. But it fails to return me the dataframe. Can anyone help me with this? Thank you very much!
ek.set_timeout(200)
instruments = ['AAL.L' 'ABDN.L' 'ABF.L' 'ADML.L' 'AHT.L' 'ANTO.L' 'ATST.L' 'AZN.L'
'BAB.L' 'BAES.L' 'BALF.L' 'BARC.L' 'BATS.L' 'BDEV.L' 'BEZG.L' 'BKGH.L'
'BLND.L' 'BOY.L' 'BP.L' 'BWNG.L' 'BWY.L' 'BYG.L' 'CAL.L' 'CBRO.L' 'CCL.L'
'CHG.L' 'CLDN.L' 'CLLN.L' 'CLSH.L' 'CNA.L' 'CNE.L' 'CPG.L' 'CPI.L'
'CRDA.L' 'CURY.L' 'DLAR.L' 'DLN.L' 'EMG.L' 'EZJ.L' 'GFRD.L' 'GFTU_u.L'
'GNC.L' 'GPEG.L' 'GRI.L' 'GSK.L' 'HBR.L' 'HEAD.L' 'HFD.L' 'HLCL.L'
'HLMA.L' 'HMSO.L' 'HSBA.L' 'HSX.L' 'HTG.L' 'HWG.L' 'ICGIN.L' 'IHG.L'
'III.L' 'INF.L' 'INVP.L' 'ITRK.L' 'ITV.L' 'IWG.L' 'JDW.L' 'JMAT.L'
'KGF.L' 'KIE.L' 'KLR.L' 'LLOY.L' 'LSEG.L' 'MARS.L' 'MCG.L' 'MGNS.L'
'MKS.L' 'MSLH.L' 'MTO.L' 'NG.L' 'NWG.L' 'NXT.L' 'PAGE.L' 'PAGPA.L'
'PFC.L' 'PFD.L' 'PHARP.L' 'PINE.L' 'PNN.L' 'PSN.L' 'PSON.L' 'PZC.L'
'RAT.L' 'RIO.L' 'RNK.L' 'ROR.L' 'RR.L' 'RSW.L' 'RTO.L' 'RWI.L' 'SBRY.L'
'SDR.L' 'SDY.L' 'SFR.L' 'SGE.L' 'SGRO.L' 'SHEL.L' 'SHI.L' 'SJP.L'
'SMDS.L' 'SMIN.L' 'SMWH.L' 'SN.L' 'SPT.L' 'SPX.L' 'SRP.L' 'SSE.L'
'STAN.L' 'SVS.L' 'SVT.L' 'SXS.L' 'TATE.L' 'TPK.L' 'TPT.L' 'TSCO.L' 'TW.L'
'ULVR.L' 'UTG.L' 'UU.L' 'VANQ.L' 'VCTX.L' 'VOD.L' 'VSVS.L' 'VTYV.L'
'WEIR.L' 'WG.L' 'WKP.L' 'WTB.L' 'ZIG.L']
dataframes = {}
# Loop through each instrument and fetch data
for instrument in instruments:
success = False
retries = 100
for attempt in range(retries):
try:
df, err = ek.get_data(
[instrument],
['TR.CompanyName','TR.PctOfSharesOutHeld.date', 'TR.PctOfSharesOutHeld', 'TR.InvestorFullName', 'TR.InvParentType', 'TR.InvestorType', 'TR.InvInvestmentStyleCode', 'TR.InvestorAddrCity', 'TR.InvAddrCountry'],
parameters={'SDate': '2003-01-01', 'EDate': '2024-01-02', 'Frq': 'M'}
)
if err is None:
dataframes[instrument] = df
success = True
print(f"Data successfully retrieved for {instrument}")
break # Exit the retry loop on success
except ek.EikonError as e:
print(f"Attempt {attempt + 1} failed for {instrument}: {e}")
time.sleep(5) # Wait 5 seconds before retrying
if not success and attempt == retries - 1:
print(f"Failed to retrieve data for {instrument} after {retries} attempts.")
Best Answer
-
Thank you for reaching out to us.
The get_data method is not desinged to retrieve a lot of data at once. Therefore, you need to split to multiple requests, such as requesting data for ten RICs at a time, as mentioned in this discussion.
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
- 684 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
- 250 ETA
- 554 WebSocket API
- 37 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
- 643 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
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 228 TRKD
- 915 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 中文论坛