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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
46 0 0 0

Eikon API Streaming error

I followed tutorial as below on Jupyter Notebook.

https://developers.refinitiv.com/en/api-catalog/eikon/eikon-data-api/tutorials#streaming-api-how-to-retrieve-real-time-streaming-prices


streaming_prices = ek.StreamingPrices(

instruments = ['GBP=','JPY=', 'CAD='],

fields = ['CF_BID','CF_ASK','OPEN_PRC', 'CF_HIGH','CF_LOW', 'CF_CLOSE'])

streaming_prices.open()


I got error when I run the code.

streaming_prices.open()


the error message is as below.

2021-04-21 17:01:47,086 P[15720] [WebSocket 0 15960] error from callback <bound method StreamConnection._ws_message of <StreamConnection(WebSocket 0, started daemon 15960)>>: the JSON object must be str, bytes or bytearray, not WebSocketApp


this code works in Pycharm but not in Jupyter Notebook.

could you let me know why does it happen.


Thank you in advance.

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonjupyter-notebookstreaming
icon clock
10 |1500

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

Upvotes
Accepted
20.3k 73 10 20

Hi @daham.lee

We did have issues with the RDP Library (which shares some code with the Eikon library) in terms of the Websocket versions.

RDP WebSocket hanging when connecting - Forum | Refinitiv Developer Community

If you refer to the above you will note that downgrading the Websocket version resolved the issue.

icon clock
10 |1500

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

Thank you!!

I downgraded Websocket library, then it is solved.

Upvotes
20.3k 73 10 20

Hi @daham.lee

I just tried the code here in Jupyter and it is working ok. So, just wonder if it some local difference between Jupyter and Pycharm in libraries/python versions being used?




1618995003569.png (17.4 KiB)
icon clock
10 |1500

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

Hello @daham.lee

I have tested with my local Jupyter Notebook and it got the same result as Chavalit

What are the versions of Python, Eikon Data API in your PyCharm, and Notebook?

Please refer to this post about how to find the library version.


ahs-eikon.png (35.0 KiB)

@umer.nalla

Thank you for your answer.

I attached my specs as below.


Pycharm: python :3.8.7, eikon: 1.1.2

Anaconda: python: 3.8.5 , eikon:1.1.2


do I need to wait more till getting <StreamState.Open 3>...?


I think It seems WebSocket library issue..

capture.png (13.3 KiB)
Upvotes
20.3k 73 10 20

Hi @daham.lee

If all you are interested in for this script is real-time streaming or snapshot data, then you can also use the RDP Library with a Desktop Session to connect to your Eikon or Workspace.

Discover our Refinitiv Data Platform Library (part 1) | Refinitiv Developers

You can also find several real-time data examples in the Jupyter Notebook form for the RDP library at

Refinitiv-API-Samples/Example.RDPLibrary.Python: Example projects demonstrating access to the Refinitiv Data Platform using the Python Library (github.com)

e.g. 2.3.2 - Content - StreamingPrices - As a cache


icon clock
10 |1500

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

Click below to post an Idea Post Idea