Downloading data via EIKON unstable
Hello,
test_stock_peers_and_relative_valuation2.txt
I am reaching out to request your expertise and advice regarding an issue we are encountering with downloading factor data via the Eikon API. In our daily fund operations, we need to download 20 specific factors for approximately 6000 US stocks. This process is essential and occurs daily. Unfortunately, our current methodology, as detailed in the attached code (.txt file), requires upwards of 400 seconds to complete on its most efficient days. More concerning is that it frequently encounters issues, particularly with certain factors, where it fails to complete the download process at all (error messages attached). This issue persists across several servers we have tested, leading to significant operational delays. Notably, we observe that retrieving estimate factors is particularly prone to these interruptions. Given these challenges, I suspect that our approach may be outdated or not aligned with best practices. It would be immensely helpful if you could review our attached code and provide any recommendations or insights on how we might enhance our data retrieval process to be more efficient and reliable. Your guidance on this matter would be greatly appreciated, as it would significantly impact our operational efficiency and reliability.
the list of factors:
attached: (1) a list of factors
TR.RelValPENTMTR.RelValEVEBITDANTMTR.RelValEVSalesNTMTR.RelValPriceCashFlowNTMTR.RelValPriceBookNTMTR.RelValDividendYieldNTMTR.RelValPETTMTR.RelValEVEBITDATTMTR.RelValEVSalesTTMTR.RelValPriceCashFlowTTMTR.RelValPriceBookTTMTR.RelValDividendYieldTTMTR.PricePctChg1DTR.TotalReturn1MoTR.FwdPtoEPSSmartEst(Period=NTM)TR.PtoREVSmartEst(Period=NTM)TR.PtoCPSSmartEst(Period=NTM)TR.EVtoREVSmartEst(Period=NTM)TR.EVtoEBITDASmartEst(Period=NTM)TR.EPSSmartEstQtrtoYearAgoQtrGrowthTR.ROESmartEst(Period=NTM)TR.F.TotDebtPctofTotEq
(2) Error message
Best Answer
-
@operations06 Thanks for your question and sorry to hear about your issue. I briefly had a look at your code and I would recommend using our latest Data Libraries instead of the older Eikon API package.
pip install refinitiv-data
after you have installed the package:
import refinitiv.data as rd
import pandas as pdrd.open_session()
You mentioned you had a universe of 6000 RICs and around 20 fields so thats around 120,000 datapoints. The per API call limit is 10,000. So you need to chunk and iterate. First let me build a large universe:
riclist1 = rd.get_data(universe=['0#.SPX','0#.RUT',,'0#.STOXX'],fields='TR.RIC')
riclist1next let me define a chunking function to break down my large ric list into chunks of n rics:
def chunks(l, n):
for i in range(0,len(l),n):
yield l[i:i+n]rics = list(chunks(riclist1['RIC'].to_list(),50))
cur_date = '2024-01-03'
data1 = pd.DataFrame()
for chunk in rics:
try:
df1 = rd.get_data(universe=chunk,fields=['TR.RevenueMean(SDate=' + cur_date + ',Period=FY1).calcdate','TR.RevenueMean(SDate=' + cur_date + ',Period=FY1)','TR.F.MktCap(SDate=' + cur_date + ',Period=FY0).calcdate','TR.F.MktCap(SDate=' + cur_date + ',Period=FY0)'])
if len(data1):
data1 = pd.concat([data1,df1])
else:
data1 = df1
except:
print(str(chunk) + "failed")
passdata1.reset_index(drop=False,inplace=True)
data1You should try to avoid the busiest periods with larger payloads. Keep things smaller to increase the probability of returns without having to represent the API call on fail. Also the throttling for requests is 5 per second maximum. You can find out more details about limits and throttling here. Let us know if this is useful.
I hope this can help.
0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛