Hi There. I'm trying to run the following using pycharm IDE (python 2.7). I however get a "400 Bad R
My Script:
df, err = ek.get_data(000001.SZ,000002.SZ,000030.KS,000039.SZ,000050.SZ, TR.PriceClose.calcdate; TR.EPSActValue(Period=FY - 3); TR.EPSActValue(Period=FY - 2); TR.EPSActValue(Period=FY - 1); TR.EPSActValue(Period=FY0); TR.EPSMean(Period=FY1); TR.EPSMean(Period=FY2); TR.EPSMean(Period=FY3); TR.NumberOfAnalysts(Period=FY - 3); TR.NumberOfAnalysts(Period=FY - 2); TR.NumberOfAnalysts(Period=FY - 1); TR.NumberOfAnalysts(Period=FY0); TR.NumberOfAnalysts(Period=FY1); TR.NumberOfAnalysts(Period=FY2); TR.NumberOfAnalysts(Period=FY3); TR.EPSMean(Period=FY - 3).periodenddate; TR.EPSMean(Period=FY - 2).periodenddate; TR.EPSMean(Period=FY - 1).periodenddate; TR.EPSMean(Period=FY0).periodenddate; TR.EPSMean(Period=FY1).periodenddate; TR.EPSMean(Period=FY2).periodenddate; TR.EPSMean(Period=FY3).periodenddate ,SDate=2017-01-01,EDate=2017-03-31,Frq=M)
Error I get:
Traceback (most recent call last): File "/Users/richardtbenade/Repos/df_001/datapull.py", line 71, in <module> df, err = ek.get_data(instrument_list_batch[k],get_command_string) File "/Users/richardtbenade/virtualenvs/eikon/lib/python2.7/site-packages/eikon/data_grid.py", line 141, in get_data result = eikon.json_requests.send_json_request(DataGrid_UDF_endpoint, payload, debug=debug) File "/Users/richardtbenade/virtualenvs/eikon/lib/python2.7/site-packages/eikon/json_requests.py", line 82, in send_json_request check_server_error(result) File "/Users/richardtbenade/virtualenvs/eikon/lib/python2.7/site-packages/eikon/json_requests.py", line 130, in check_server_error raise requests.HTTPError(error_message, response=server_response) requests.exceptions.HTTPError: 400 Bad Request Process finished with exit code 1
Best Answer
-
@Jan
I'm afraid the method you're executing doesn't make sense to me on more than one level.
The request example you provided has so many syntax errors, I don't see how it can possibly ever run fine. I have to assume that somehow the text must have been altered in transfer between IDE and your post here? Otherwise you'd be getting syntax errors instead of HTTP 400.
Semantically why do you want to mix the last business day of the month between January and March 2017 (provided by TR.PriceClose.calcdate with {'SDate':'2017-01-01','EDate':'2017-03-31','Frq':'M'} parameters) with EPS estimates for the previous and the next 3 years? But assuming for whatever reason this is indeed what you want to retrieve, the correct syntax is:df, err = ek.get_data(['000001.SZ','000002.SZ','000030.KS','000039.SZ','000050.SZ'], ['TR.PriceClose.calcdate', 'TR.EPSActValue(Period=FY-3)', 'TR.EPSActValue(Period=FY-2)', 'TR.EPSActValue(Period=FY-1)', 'TR.EPSActValue(Period=FY0)', 'TR.EPSMean(Period=FY1); TR.EPSMean(Period=FY2)', 'TR.EPSMean(Period=FY3)', 'TR.NumberOfAnalysts(Period=FY-3)', 'TR.NumberOfAnalysts(Period=FY-2)', 'TR.NumberOfAnalysts(Period=FY-1)', 'TR.NumberOfAnalysts(Period=FY0)', 'TR.NumberOfAnalysts(Period=FY1)', 'TR.NumberOfAnalysts(Period=FY2)', 'TR.NumberOfAnalysts(Period=FY3)', 'TR.EPSMean(Period=FY-3).periodenddate', 'TR.EPSMean(Period=FY-2).periodenddate', 'TR.EPSMean(Period=FY-1).periodenddate', 'TR.EPSMean(Period=FY0).periodenddate', 'TR.EPSMean(Period=FY1).periodenddate', 'TR.EPSMean(Period=FY2).periodenddate', 'TR.EPSMean(Period=FY3).periodenddate'],{'SDate':'2017-01-01','EDate':'2017-03-31','Frq':'M'})
I noticed in your example you have white spaces in some of the field level parameters, e.g. there are two spaces in TR.NumberOfAnalysts(Period=FY - 3). Not sure of you had them in your script, but these spaces will certainly result in HTTP 400 error.
0
Answers
-
Hi @Jan,
Would it be possible on your side to retest with Python 3.6?
I can not be sure about this specific issue, but find that some unexpected behaviors stop manifesting with py 3.6.
Thanks
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 中文论坛