Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 1

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?

#technologypython apierror-403html
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hello @jubu

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?


If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,


AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,
AHS

Upvotes
Accepted
1.3k 3 2 4

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:

  1. check your proxy settings to retrieve the ip address
  2. 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.
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
5k 16 2 7

Hi @jubu,


Do you have Workspace/Eikon running on the background?


Bes regards,

Haykaz

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi @aramyan.h, yes I have.

Upvotes
5k 16 2 7

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

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
1.3k 3 2 4

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


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi pf, your code works and it does indeed print "State.Open".

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.