Can't get API to work in local script (works in codebook)

Trying to fetch some historical data from Eikon API. I am running the following code:
# Importing libraries
import eikon as ek
import datetime
import pandas as pd
ek.set_app_key('MY APP KEY')
# Defining start time for the data series
start = datetime.datetime.now() - datetime.timedelta(days=1) # 1 day ago
end = datetime.datetime.now()
# Defining lists with RIC's under interest
rics = ['US10YT=RR']
# Fetching intraday time series data with 1-minute intervals
data = ek.get_timeseries(rics, start_date=start, end_date=end, interval='minute', fields="CLOSE")
print(data)
This works in the codebook editor in the application, where I get the wanted output. However, when I try to run this script on my local device I get the following error:
2023-12-13 15:56:01,612 P[33280] [MainThread 26372] HTTP request failed: EikonError-Client Error: <!-- IE friendly error message walkround.
if error message from server is less than
512 bytes IE v5+ will use its own error
message instead of the one returned by
server. -->
... Together with a lot of HTML code. It seems like it somehow connects, since I don't get an error, but I don't get the data either. Is there a solution for this?
Best Answer
-
Ok, next step is to check if how local Eikon API Proxy manages timeseries request.
As @aramyan.h suggested, you can read this article on troubleshooting, especially section 1) Check Desktop Applications. The SxS log file should contains errors.
One common issue could be due to user proxy:
- check your proxy settings to retrieve the ip address
- create HTTP_PROXY and/or HTTPS_PROXY environment variables (https://www.python-httpx.org/environment_variables/#http_proxy-https_proxy-all_proxy)
Note that Eikon Desktop need it in its environment.
0
Answers
-
Hi @aramyan.h, yes I have.
0 -
Hi @jubu ,
This might be a proxy/firewall related issue which you would need to ask your IT team to whitelist. There are two similar questions in the portal, please check this and this. And have a look also at this article on troubleshooting.
Hope this will help you to resolve the issue.
Best regards,
Haykaz
0 -
Hi @jubu ,
Before investigating, can the following code be used to check whether the session has been successfully initialised?
# Importing libraries
import eikon as ek
import datetime
import pandas as pd
ek.set_app_key('MY APP KEY')
print(ek.get_desktop_session().get_open_state())
# Defining start time for the data series
start = datetime.datetime.now() - datetime.timedelta(days=1) # 1 day ago
end = datetime.datetime.now()
# Defining lists with RIC's under interest
rics = ['US10YT=RR']
# Fetching intraday time series data with 1-minute intervals
data = ek.get_timeseries(rics, start_date=start, end_date=end, interval='minute', fields="CLOSE")
print(data)It should display:
State.Open
0 -
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
- 616 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 中文论坛