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 2

trying to connect to eikon api - error 404

I'm trying to get data in the Eikon api in Python.

i run the following code:

import eikon as ek

API_KEY = "my_api_generated_from_eikon"
ek.set_app_key(API_KEY)
df = ek.get_timeseries(["MSFT.O"], start_date="2023-01-01", end_date="2023-01-10")

but i get the following error:

2023-11-27 13:10:29,087 P[12100] [MainThread 20108] Error code 404 | Client Error: <!DOCTYPE html>

<html lang="en">

<head>

<meta charset="utf-8">

<title>Error</title>

</head>

<body>

<pre>Cannot POST /api/v1/data</pre>

</body>

</html>


I tried going into the troubleshooting section, and went into http://localhost:9000/ping?all

but could not find any {"path":"api"}

also, i don't get any response from: http://localhost:9060/api/status

What is the problem?

#producterror-404
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
Accepted
76.7k 239 52 72

@shai

If you don't have {"path":"/api"} in ping?all, it could mean that your Eikon or Workspace account doesn't have permission to use the API.

1704428768253.png

You can contact your Refinitiv account team or sales team directly to verify your account.


1704428768253.png (33.2 KiB)
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
5.3k 21 2 4

Hi @shai,


Please note that we are deprecating the `eikon` library (a.k.a.: the EDAPI); we advise using the RD library. It works very similarly to the `eikon` library in your case.
With that said, if upgrading to the refinitiv data library does not resolve your issue, would you mind please letting me know if you have Eikon/Workspace running on the machine you are running the code on? This is necessary to run the above.

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, i tried using the RD library. it seems like i am able to connect but i don't manage to get any data. my code is quite simple:

import refinitiv.data as rd
from refinitiv.data.content import pricing

import os
os.environ["RD_LIB_CONFIG_PATH"] = "C:/Users/Shai Ben Shabat/PycharmProjects/TheSystem/venv/Lib/site-packages/refinitiv/configuration"
rd.open_session()

non_streaming = rd.content.pricing.Definition(['EUR=', 'GBP=', 'JPY=', 'CAD='],fields=['BID', 'ASK']).get_stream()
# We want to just snap the current prices, don't need updates
# Open the instrument in non-streaming mode
print(non_streaming['EUR=']['BID']) 

but this only returns "None". when i try non_streaming.open(with_updates=False) it fails and gives back:
No user scope for key=/streaming/pricing/v1/, method=GET.
Insufficient Scope. Cannot load the list of associated URLs from https://api.refinitiv.com/streaming/pricing/v1/ for apis.streaming.pricing.endpoints.main endpoint.


Hi @shai, Can you use the get_history function? It seems appropriate if you would not like a stream


import refinitiv.data as rd
rd.open_session()

snapshot = rd.get_history(
    universe=['EUR=', 'GBP=', 'JPY=', 'CAD='],
    fields=['BID', 'ASK'],
    interval='tick',
    count=1) # returns data in GMT
# Get localised timezone:
mrkt_price = snapshot.copy()
mrkt_price.index = pd.MultiIndex.from_tuples(
    [(i, j) for i, j in zip(
        snapshot.index,
        snapshot.index.tz_localize('GMT').tz_convert('Europe/Paris'))],
    names=["gmt", "cet"])
mrkt_price

1701357794058.png


Does this provide you with the data intended?

1701357794058.png (28.1 KiB)

It does, thank you, but the reason i went to non_stream was that i wanted to see if something works because get_data didn't. If i do want to stream, the code, as i understand it is:

response = rd.content.pricing.Definition(['EUR=', 'GBP=', 'JPY=', 'CAD='], fields=['BID', 'ASK']).get_data()

but that returns:

Traceback (most recent call last):

File "C:\Users\Shai Ben Shabat\PycharmProjects\TheSystem\api_connect.py", line 7, in <module>

response = rd.content.pricing.Definition(

File "C:\Users\Shai Ben Shabat\PycharmProjects\TheSystem\venv\lib\site-packages\refinitiv\data\content\_content_provider_layer.py", line 58, in get_data

return super().get_data(session, on_response)

File "C:\Users\Shai Ben Shabat\PycharmProjects\TheSystem\venv\lib\site-packages\refinitiv\data\delivery\_data\_data_provider_layer.py", line 149, in get_data

response = get_data(self._data_type, self._provider, session, **self._kwargs)

what am i doing wrong?

another question - whenever i run the api, does it force eikon to close?

Show more comments
Upvotes
21 1 1 1

How about you guys fix the issues with the Eikon API until everyone has trasitioned to RD Library?? This is an ongoing issue and there are so many posts about this issue

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 0 0 2

Hi, i looked at the link but this doesn't solve my problem. my code is:

import refinitiv.data as rd


def get_realtime_spot(currency):
    rd.open_session("desktop.workspace")
    snapshot = rd.get_history(
        universe=[currency],
        fields=['BID', 'ASK'],
        interval='tick',
        count=1)
    mrkt_price = snapshot.copy()
    mrkt_price_bid = mrkt_price.to_dict()["BID"]
    mrkt_price_ask = mrkt_price.to_dict()["ASK"]
    for key in mrkt_price_bid:
        bid = mrkt_price_bid[key]
    for key in mrkt_price_ask:
        ask = mrkt_price_ask[key]
    return round((bid + ask)/2, 4)

when i run it with rd.open_session() it works perfectly but logs out from Eikon. When i try to run it like this it returns:

Traceback (most recent call last):

File "C:\Users\Shai Ben Shabat\PycharmProjects\Pricer\main.py", line 34, in <module>

constant_calc()

File "C:\Users\Shai Ben Shabat\PycharmProjects\Pricer\main.py", line 18, in constant_calc

create_strategy(pricer)

File "C:\Users\Shai Ben Shabat\PycharmProjects\Pricer\entry_processor.py", line 19, in create_strategy

spot = get_spot(currency, pricer.spot_manual_entry.get())

File "C:\Users\Shai Ben Shabat\PycharmProjects\Pricer\base_params.py", line 47, in get_spot

return get_realtime_spot(currency)

File "C:\Users\Shai Ben Shabat\PycharmProjects\Pricer\api_connect.py", line 9, in get_realtime_spot

snapshot = rd.get_history(

File "C:\Users\Shai Ben Shabat\PycharmProjects\Pricer\venv\lib\site-packages\refinitiv\data\_access_layer\get_history_func.py", line 206, in get_history

raise RDError(-1, except_msg)

refinitiv.data._errors.RDError: Error code -1 | No data to return, please check errors: ERROR: No successful response.

(404, <!DOCTYPE html>


I'd appreciate your support on the matter

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 @shai, may I ask, what is written in your configuration file under "Default"?


1702984140739.png

I am asking because if it is "platform.rdp", as per the screenshot above, then this is what is used with the `rd.open_session()`, explaining why Workspace closes when you run your code. Since it works when using `rd.open_session()`, then, if "Default" in your configuration file says "platform.rdp", I woudl suggest (i) checking that configuration file and making sure that the "app-key" argument is the same under "platform" "rdp" and "desktop" "workspace", (ii) checking that you are logging into the Workspace Desktop App on the same machine on which you are running your Python code, (iii) checking that you are loging into the Workspace Desktop App with the same "username" & "password" arguments as what is in said configuration file.

Please let me know if you can go through (i) to (iii) and if you are still getting the same issue.

Hi, the current default is indeed "platform.rdp". I did check everything and all seems in order. the app-key is the same one. I did notice that the original config file did not have a username and password under the desktop, so i added it but still no luck. I'm attaching here the structure without the details, so you can see that it's good.

{

"logs": {

"level": "debug",

"transports": {

"console": {

"enabled": false

},

"file": {

"enabled": false,

"name": "refinitiv-data-lib.log"

}

}

},

"sessions": {

"default": "platform.rdp",

"platform": {

"rdp": {

"app-key": "XXX",

"username": "YYY",

"password": "ZZZ"

},

"deployed": {

"app-key": "XXX",

"realtime-distribution-system": {

"url" : "YOUR DEPLOYED HOST:PORT GOES HERE!",

"dacs" : {

"username" : "YOUR DACS ID GOES HERE!",

"application-id" : 256,

"position" : ""

}

}

}

},

"desktop": {

"workspace": {

"app-key": "XXX",

"username": "YYY",

"password": "ZZZ"

}

}

}

}

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.