[MainThread 47708] Backend error. 400 Bad Request

I am attempting to download some data using the Eikon python package (version == 1.1.2 due to some issues with more recent versions), however it is very hit or miss whether I actually receive a response from the Eikon servers. Very frequently I get the 400 error (bad request) and when I do receive a response frequently many, if not all, the values in my resulting dataframe are "na". Is there anything I can do to ensure I receive prompt and complete data?
Code to Reproduce:
import eikon as ek
ek.set_app_key("YOUR KEY HERE")
for years_back in range(25):
year = str(2020 - years_back)
print(year)
s, e = 365 * years_back, 365 * years_back + 1
data, err = ek.get_data(tickers,
fields=['AVG(TR.PriceToSalesPerShare(SDate=-{s},EDate=-{e},Frq=D))'.format(s=s, e=e),
'AVG(TR.CompanyMarketCap(Curn=USD,SDate=-{s},EDate=-{e},Frq=D))'.format(s=s, e=e),
'AVG(TR.DailyValueTraded(Curn=USD, SDate=-{s},EDate=-{e},Frq=D))'.format(s=s, e=e),
'TR.CoRPrimaryCountry'])
Environment:
conda version : 4.8.4
pip: 20.2.2
platform : win-64
eikon: 1.1.2
pandas: 1.1.1
Best Answer
-
This error is most likely due to timeouts on the backend. The requests you're submitting are fairly taxing on the backend, which is required to retrieve daily timeseries for each of the fields and aggregate them (calculate the average). I would suggest to try reducing the number of tickers in each request. I appreciate this may increase the overall retrieval time, but this is pretty much the only thing you can do from the client side to improve the success rate of these requests. If this workaround is not acceptable, then I would suggest using Fiddler to capture a few requests that return "Bad request" or nulls, and then opening a support case with Refinitiv Helpdesk, so that Refinitiv Support could investigate the backend errors.
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 中文论坛