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
46 0 1 1

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-apirefinitiv-dataplatform-eikonworkspaceworkspace-data-apijupyter-notebookstreaming
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
25.3k 87 12 25

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 512.0 KiB each and 1.0 MiB total.

Thank you!!

I downgraded Websocket library, then it is solved.

Upvotes
25.3k 87 12 25

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 512.0 KiB each and 1.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
25.3k 87 12 25

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 512.0 KiB each and 1.0 MiB total.

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.