Skip to content

A Python WebSocket API example that Consumes MRN STORY data from Refinitiv Real-Time Optimised using Service Discovery

License

Notifications You must be signed in to change notification settings

LSEG-API-Samples/Example.WebSocketAPI.Python.MRN.RTO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Example.WebSocketAPI.Python.MRN.RTO

A Python WebSocket API example that Consumes MRN STORY data from Refinitiv Real-Time Optimised using Service Discovery (rather than a fixed host/endpoint)

Whilst we have individual examples/tutorials that

  • show you how to consume Refinitiv Machine Readable News Stories (MRN_STORY) from Refinitiv Real-Time Optimized
  • show you how to use Refinitiv Platform Service Discovery Gateway to automatically select a host/endpoint for your preferred region

we don't have an example that combines both of the above.

We have been asked by inexperienced coders if we provide such an example - as they don't wish to rely on a single hardcoded endpoint when consuming MRN data.

To address this, I have simply taken the existing source code for a Service Discovery example and combined it with an MRN_STORY example to produce the attached example.

This example has only undergone basic testing, and is itself based on other educational examples and is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

For further details on Service Discovery and parsing Refinitiv Machine Readable News Stories, please refer to the above links and Websocket API and RTO documentation materials:

Websocket API MRN Tutorial example
Websocket API QuickStart
Websocket API & RTO Documentation
Websocket API Tutorials

REGION choice

The example currently has the region coded as 'us-east-1'. If you are in a different region, you can change this value - allowing the service discovery mechanism to select a potentially closer host/endpoint.

The current available region choices are:

  • eu-west-1
  • ap-southeast-1
  • us-east-1
  • us-east-2

You can find more information on the regions and their associated endpoints by referring to the RTO Documentation.

Prerequisite

This example requires the following dependencies softwares and libraries.

  1. RDP Credentials with MRN Service.
  2. Python compiler and runtime
  3. Python's requests 2.x library.
  4. Python's websocket-client library (version 1.2.1 or greater).
  5. A few other libraries as listed in requirements.txt file

Running the example

  1. Go to project folder in console
  2. Run $> pip install -r requirements.txt command in a console to install all the dependencies libraries.
  3. Then you can run example application with the following command
    $> python mrn_rdpgw_service_discovery.py --client_id <RDP Client ID/AppKey> --user <RDP Username> --password <RDP Password>

The above will run with the default region - which you can override on the command line e.g.
$> python mrn_rdpgw_service_discovery.py --client_id <RDP Client ID/AppKey> --user <RDP Username> --password <RDP Password> --region eu-west-1

Also, since this example used the RDP Service Discovery example, it includes some of the other command line options including Hot Standby, ability to change RDP password etc. Please refer to the notes for the service discovery example for more details.

About

A Python WebSocket API example that Consumes MRN STORY data from Refinitiv Real-Time Optimised using Service Discovery

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages