For a deeper look into our Elektron API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted

may I ask if there is a python solution that does not use websockets, instead using the EMA libraries?, or do we need to use a custom java app

I cannot use the websocket api to connect to the ADS server using managed feed user . Can you advise the possible reason ? The below setup is available for OneTick RFA OMM Collector, which is used to collect data from a Refinitiv source using the RFA OMM API


onetick@ny2-laa-011.analytics> python3 market_price.py --hostname 10.253.4.4 --port 14002 --position 10.31.145.219 --user AM3_MFSA_US06060

Connecting to WebSocket ws://10.253.4.4:14002/WebSocket ...

failed CONNECT via proxy status: 403

WebSocket Closed


script link

https://github.com/Refinitiv/websocket-api/blob/master/Applications/Examples/python/market_price.py


We have advised that On Windows, there is no solution to use 14002 port because refinitiv-data Python library relies on the Websocket API protocol and therefore only manages websocket connection (default port 443).

For a RSSL connection (port 14002), the user will have to continue with EMA it it’s a question of performance (compare to RSSL connection, the websocket is slower and accept less simultaneous RIC subscriptions), the Python solution is probably not the right solution.


may I ask if there is a python solution that does not use websockets, instead using the EMA libraries?, or do we need to use a custom java app


#technologyapipython apiwebsockets
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
27k 65 17 14

Hello @LanceGabriel.Villacrusis

According to your "If you need to work with a websocket API, Python is a suitable choice.", the answer is not simply "Yes" or "No".

It is depending on the client requirements such as:

  • If the client needs the streaming data on the web, the browser's supported languages such as JavaScript or TypeScript is much more suitable than Python
  • If the client needs performance, Python is obvious not a choice ("Python is a slow language").
  • If the client needs to run an application on Windows platform, the .NET technology languages like C# is more suitable.
  • etc.

Actually, if the client concerns about a performance, either Python or WebSocket API are not a choice for them.

The WebSocket API Tutorials choose to give developers detail via Python because it is one of the easiest to understand language.

The WebSocket (and the JSON message) connection is designed for supporting multiple languages, support an open-standard technology, easy to parse data. On the other hand, the RSSL connection is designed for highly distribution data application. It is the backbone of our LSEG Real-Time platform, so the EMA has a better performance than any languages on the WebSocket API.

I hope this information helps.

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
24.3k 62 15 21

EMA SDK is only available in Java, C++ and .NET. Python will have to use Websocket API. The port 14002 is an RSSL port and cannot be used with Python. Websockets typically run on port 15000 and have to be enabled in ADS first.

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

So In summary:

  1. Python and Websockets:

    • Python supports websockets through libraries like websockets or websockets-client.
    • If you need to work with a websocket API, Python is a suitable choice.
  2. EMA Library and Python Compatibility:

    • The EMA (Elektron Message API) library is primarily designed for Java, C++ and .NET.
    • Unfortunately, there isn’t a direct Python implementation of the EMA library.
    • If you specifically need EMA features, you’ll need to use the following Java, C++ and .NET
  3. Custom Java Application:

    • To leverage EMA features and interact with a websocket API, create a custom Java application.
    • Your Java app can handle both EMA connectivity and websocket communication.

Kindly correct me if im wrong or if I have missed anything

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.

Only websockets-client module is supported in provided samples.

If an app uses EMA, it can directly consume data from RSSL connection and does not need to use websockets. RSSL offers better performance compared to WS.

Upvotes

@wasin.w and @Gurpreet Thank you so much for your insights, would appreciate if you could validate and approve my summary:


Summary:


1.Python and Websockets:

-Python supports websockets through libraries like websockets or websockets-client.

-If you need to work with a websocket API using Python there are a few things to reconsider:

It depends on your requirements below

A. If the client needs the streaming data on the web, the browser's supported languages such as JavaScript or TypeScript is much more suitable than Python

B. If the client needs performance, Python is obvious not a choice ("Python is a slow language").

C. If the client needs to run an application on Windows platform, the .NET technology languages like C# is more suitable.

etc.


2. EMA Library and Python Compatibility:

-The EMA (Elektron Message API) library is primarily designed for Java, C++ and .NET.

-Unfortunately, there isn’t a direct Python implementation of the EMA library.

-If you specifically need EMA features, you’ll need to use the following Java, C++ and .NET

-If an app uses EMA, it can directly consume data from RSSL connection and does not need to use websockets. RSSL offers better performance compared to WS.

-If you are considered about performance, either Python or WebSocket API are not a choice.

The WebSocket API Tutorials choose to give developers detail via Python because it is one of the easiest to understand language.The WebSocket (and the JSON message) connection is designed for supporting multiple languages, support an open-standard technology, easy to parse data. On the other hand, the RSSL connection is designed for highly distribution data application. It is the backbone of our LSEG Real-Time platform, so the EMA has a better performance than any languages on the WebSocket API.


3. Custom Java Application:

-To leverage EMA features and interact with a websocket API, create a custom Java application.

-Your Java app can handle both EMA connectivity and websocket communication.


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.

Sounds about right except - Python samples don't support websockets module - only websockets-client.
Upvotes
27k 65 17 14

Hello @LanceGabriel.Villacrusis

Please let me remind you that even though the EMA supports both RSSL and the WebSocket connections, the RSSL connection is the recommended on.

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.