famous Backend error. 400 Bad Request starting from yesterday
The api works fine until yesterday. Starting from yesterday, i keep getting the 404 bad request. I simply just wrote a try catch loop for 3 times and it worked through.
However, starting from this morning, my try catch loop could not give me any result. I increased the repeat time to 20 times, and it didn't succeeded once.
To replicate:
python 3.6
import eikon as ek
ek.set_app_id(app_id)
ek.set_timeout(120)
date = '2018-03-28'
symbol_ric = ['AUDCAD=', 'AUDCHF=', 'AUDJPY=', 'AUDNZD=', 'AUD=', 'CADCHF=', 'CADJPY=', 'CHFJPY=', 'EURAUD=',
'EURCAD=', 'EURCHF=', 'EURGBP=', 'EURJPY=', 'EURNZD=', 'EUR=', 'GBPAUD=', 'GBPCAD=', 'GBPCHF=',
'GBPJPY=', 'GBPNZD=', 'GBP=', 'NZDCAD=R', 'NZDCHF=R', 'NZDJPY=', 'NZD=', 'CAD=', 'CHF=', 'JPY=']
req, error = ek.get_data(symbol_ric, parameters={'SDate':f'{date}', 'EDate':f'{date}'}, fields=['TR.ASKPRICE','TR.BIDPRICE'], debug=True)
some times the result is timeout, sometimes it is returns a dataframe with some ric missing
full log on one trial with debug=True on is attached.trdebug-log.txt
I tried to get the rate one by one, and it always stuck on AUDCHF=
please advise how to fix this!
Best Answer
-
i also tried to pack the symbol ric inside a list as following:
req, error = ek.get_data(symbol_ric, parameters={'SDate':f'{date}', 'EDate':f'{date}'}, fields=['TR.ASKPRICE','TR.BIDPRICE'], debug=True)
however, the result would be either time out or some symbol prices were missing.
full log on one trial with debug=True on:
2018-03-29 11:42:42,448 - DEBUG - http://localhost:9000 "GET /api/v1/data HTTP/1.1" 500 148
2018-03-29 11:42:42,448 - INFO - Response : 500 - <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Internal Server Error</pre>
</body>
</html>2018-03-29 11:42:42,448 - INFO - Port 9000 is detected 2018-03-29 11:42:42,448 - INFO - Port 9000 was retrieved from .portInUse file 2018-03-29 11:42:42,448 - INFO - Set Proxy port number to 9000 2018-03-29 11:42:42,448 - INFO - Application ID: AB394EC1C2983363B045EE16 --- Logging error --- Traceback (most recent call last): File "{fakepath}\env\lib\logging\__init__.py", line 992, in emit msg = self.format(record) File "{fakepath}\env\lib\logging\__init__.py", line 838, in format return fmt.format(record) File "{fakepath}\env\lib\logging\__init__.py", line 575, in format record.message = record.getMessage() File "{fakepath}\env\lib\logging\__init__.py", line 338, in getMessage msg = msg % self.args TypeError: not all arguments converted during string formatting Call stack: File "{fakepath}\pnl_calculator\main_pnl_worker.py", line 109, in run result_list = main(self.fd, self.td, self.book) File "{fakepath}\pnl_calculator\main_pnl_worker.py", line 67, in main start_price_dict = tr_api.get_tr_price(time_interval['from_time_divisa'].date()) File "{fakepath}\pnl_calculator\util.py", line 31, in timed result = method(*args, **kw) File "{fakepath}\pnl_calculator\tr_api.py", line 45, in get_tr_price req, error = ek.get_data(symbol_ric, parameters={'SDate':f'{date}', 'EDate':f'{date}'}, fields=['TR.ASKPRICE','TR.BIDPRICE'], debug=True) File "{fakepath}\env\lib\site-packages\eikon\data_grid.py", line 151, in get_data result = eikon.json_requests.send_json_request(DataGrid_UDF_endpoint, payload, debug=debug) File "{fakepath}\env\lib\site-packages\eikon\json_requests.py", line 49, in send_json_request logger.debug("entity: ", entity) Message: 'entity: ' Arguments: ('DataGrid',) 2018-03-29 11:42:42,452 - DEBUG - payload: 2018-03-29 11:42:42,452 - DEBUG - Request: {"Entity": {"E": "DataGrid", "W": {"instruments": ["AUDCAD=", "AUDCHF=", "AUDJPY=", "AUDNZD=", "AUD=", "CADCHF=", "CADJPY=", "CHFJPY=", "EURAUD=", "EURCAD=", "EURCHF=", "EURGBP=", "EURJPY=", "EURNZD=", "EUR=", "GBPAUD=", "GBPCAD=", "GBPCHF=", "GBPJPY=", "GBPNZD=", "GBP=", "NZDCAD=R", "NZDCHF=R", "NZDJPY=", "NZD=", "CAD=", "CHF=", "JPY="], "fields": [{"name": "TR.ASKPRICE"}, {"name": "TR.BIDPRICE"}], "parameters": {"SDate": "2018-03-28", "EDate": "2018-03-28"}}}, "ID": "123"} 2018-03-29 11:43:01,556 - DEBUG - http://localhost:9000 "POST /api/v1/data HTTP/1.1" 200 65 2018-03-29 11:43:01,557 - INFO - HTTP Response: 200 - {"ErrorCode":400,"ErrorMessage":"Backend error. 400 Bad Request"} 2018-03-29 11:43:01,557 - ERROR - Backend error. 400 Bad Request Traceback (most recent call last): File "{fakepath}\pnl_calculator\tr_api.py", line 45, in get_tr_price req, error = ek.get_data(symbol_ric, parameters={'SDate':f'{date}', 'EDate':f'{date}'}, fields=['TR.ASKPRICE','TR.BIDPRICE'], debug=True) File "{fakepath}\env\lib\site-packages\eikon\data_grid.py", line 151, in get_data result = eikon.json_requests.send_json_request(DataGrid_UDF_endpoint, payload, debug=debug) File "{fakepath}\env\lib\site-packages\eikon\json_requests.py", line 87, in send_json_request check_server_error(result) File "{fakepath}\env\lib\site-packages\eikon\json_requests.py", line 135, in check_server_error raise requests.HTTPError(error_message, response=server_response) requests.exceptions.HTTPError: Backend error. 400 Bad Request
0
Answers
-
Thank you for reporting this issue. I have reproduced and escalated it. I will post on this thread as soon as I hear back from the resolver team. As an immediate workaround you can retrieve yesterday's closing bid and ask rates for FX RICs using CLOSE_BID and CLOSE_ASK fields, e.g.
ek.get_data(symbol_ric, fields=['CLOSE_BID','CLOSE_ASK'])
0 -
thanks, the close_bid works.
0 -
I also have the same problem starting yesterday........
0 -
So right now the TR.ASK and TR.BID is working, but no matter what SDATE and EDATE i post to the request for ['CLOSE_BID','CLOSE_ASK'], it will give me todays data. any thoughts on that?
ek.get_data('JPY=', parameters={'SDate':'2018-03-01', 'EDate':'2018-04-01'},fields=['CLOSE_BID','CLOSE_ASK'], debug=True)
0 -
CLOSE_BID and CLOSE_ASK fields can only provide bid/ask rates as of yesterday's close. SDate and EDate parameters are not applicable to these fields and are ignored in the request. In general field names that do not start with TR.* come from the real-time data stream and do not provide timeseries of history.
0 -
ok, only found out that today. I will keep using TR.askprice and TR.bidprice since it was fixed(I assume?)
0 -
We identified one possible source of the problem, but not yet sure if this was indeed the root cause. We're still continuing the investigation.
0
Categories
- All Categories
- 6 AHS
- 39 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
- 60 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛