You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-13Lines changed: 24 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@
6
6
7
7
## Overview
8
8
9
-
This example shows how to writing the [Elektron WebSocket API](https://developers.refinitiv.com/elektron/websocket-api) application to subscribe Machine Readable News (MRN) from Thomson Reuters Enterprise Platform (TREP). The example just connects to TREP via a WebSocket connection, then subscribes and display MRN News data in a console and . The project are implemented with Python language for both console and Jupyter Notebook applications, but the main concept for consuming and assembling MRN News messages are the same for all technologies.
9
+
This example shows how to writing the [Elektron WebSocket API](https://developers.refinitiv.com/elektron/websocket-api) application to subscribe Machine Readable News (MRN) from Thomson Reuters Enterprise Platform (TREP). The example just connects to TREP via a WebSocket connection, then subscribes and display MRN News data in a console or classic Jupyter Notebook. The project are implemented with Python language for both console and Jupyter Notebook applications, but the main concept for consuming and assembling MRN News messages are the same for all technologies.
10
10
11
11
*Note:* The news message is in UTF-8 JSON string format. Some news messages that contains special unicode character may not be able to show in Windows OS console (cmd, git bash, powershell, etc) due to the OS limitation. Those messages will be print as ```UnicodeEncodeError exception. Cannot decode unicode character``` message in a console instead.
12
12
@@ -41,15 +41,15 @@ This example requires the following dependencies softwares and libraries.
41
41
2.[Python](https://www.python.org/) compiler and runtime
4. Python's [websocket-client](https://pypi.org/project/websocket-client/) library (*version 0.49 or greater*).
44
-
5.[Classic Jupyter Notebook](https://jupyter.org/) runtime (for the Notebook example application only)
45
-
6.[Docker Engine - Community Edition](https://docs.docker.com/install/) (for running the console example in Docker only)
44
+
5.[Classic Jupyter Notebook](https://jupyter.org/) runtime (for the Notebook example only)
45
+
6.[Docker Engine - Community Edition](https://docs.docker.com/install/) (for running a console example in Docker only)
46
46
47
47
*Note:*
48
48
- The Python example has been qualified with Python versions 3.6.5 and Python 3.7.4 (Docker 19.03.1 - CentOS 7)
49
49
- Please refer to the [pip installation guide page](https://pip.pypa.io/en/stable/installing/) if your environment does not have the [pip tool](https://pypi.org/project/pip/) installed.
50
50
- If your environment already have a websocket-client library installed, you can use ```pip list``` command to verify a library version, then use ```pip install --upgrade websocket-client``` command to upgrade websocket-client library.
51
51
- It is not advisable to change the ADH/ADS configuration, if you are not familiar with the configuration procedures. Please consult your Market Data administrator for any questions regarding TREP-MRN service configuration.
52
-
- You can install a classic Jupyter Notebook on your local machine and then test the example on the machine. The alternate choice is a free Jupyter Notebook on cloud environment such as [Azure Notebook](https://notebooks.azure.com/) provided by Microsoft. You can find more details from [this tutorial](https://docs.microsoft.com/en-us/azure/notebooks/tutorial-create-run-jupyter-notebook). If you are not familiar with Jupyter Notebook, the following [tutorial](https://www.datacamp.com/community/tutorials/tutorial-jupyter-notebook) created by DataCamp may help.
52
+
53
53
54
54
## Application Files
55
55
This example project contains the following files and folders
@@ -60,29 +60,39 @@ This example project contains the following files and folders
60
60
4. LICENSE.md: Project's license file
61
61
5. README.md: Project's README file
62
62
63
-
## How to run this console example
63
+
## How to run this example
64
64
65
-
Please be informed that your TREP server (ADS and ADH) should have a Service that contain MRN data.
65
+
Please be informed that your TREP server (ADS and ADH) should have a Service that contain MRN data. The first step is unzip or download the example project folder into a directory of your choice, then choose how to run application based on your environment below.
66
66
67
-
1. Unzip or download the example project folder into a directory of your choice.
68
-
2. Run ```$> pip install -r requestments.txt``` in a console to install all the dependencies libraries.
67
+
### A console example
68
+
1. Go to project folder in console
69
+
2. Run ```$> pip install -r requestments.txt``` command in a console to install all the dependencies libraries.
69
70
3. Then you can run mrn_console_app.py application with the following command
70
71
```
71
72
$> python mrn_console_app.py --hostname <ADS server IP Address/Hostname> --port <WebSocket Port> --ric <MRN RIC name>
72
73
```
73
74
Optionally, the application subscribes ```MRN_STORY``` RIC code from TREP by default. You can pass your interested MRN RIC code to ```--ric``` parameter on the application command line. The supported MRN RIC codes are ```MRN_STORY```, ```MRN_TRNA```, ```MRN_TRNA_DOC``` and ```MRN_TRSI``` only. the application
74
75
75
-
## How to run this console example in Docker
76
-
77
-
1. Unzip or download the example project folder into a directory of your choice.
78
-
2. Run ```$> docker build -t <project tag name> .``` in a console to build an image from a Dockerfile.
76
+
### Docker example
77
+
1. Go to project folder in console
78
+
2. Run ```$> docker build -t <project tag name> .``` command in a console to build an image from a Dockerfile.
79
79
```
80
80
$> docker build -t esdk_ws_mrn_python .
81
81
```
82
82
3. Once the build is success, you can create and run the container with the following command
83
83
```
84
84
$> docker run esdk_ws_mrn_python --hostname <ADS server IP Address/Hostname> --port <WebSocket Port> --ric <MRN RIC name>
85
85
```
86
+
### Classic Jupyter Notebook example
87
+
1. Go to project's notebook folder in console
88
+
2. Run the following command in a console to start classic Jupyter Notebook in the notebook folder.
89
+
```
90
+
$> jupyter notebook
91
+
```
92
+
3. Open *mrn_notebook_app.ipynb* Notebook document, then follow through each notebook cell.
93
+
94
+
*Note:*
95
+
- You can install a classic Jupyter Notebook on your local machine and then test the example on the machine. The alternate choice is a free Jupyter Notebook on cloud environment such as [Azure Notebook](https://notebooks.azure.com/) provided by Microsoft. You can find more details from [this tutorial](https://docs.microsoft.com/en-us/azure/notebooks/tutorial-create-run-jupyter-notebook). If you are not familiar with Jupyter Notebook, the following [tutorial](https://www.datacamp.com/community/tutorials/tutorial-jupyter-notebook) created by DataCamp may help.
* [Introduction to Machine Readable News (MRN) with Elektron Message API (EMA)](https://developers.refinitiv.com/article/introduction-machine-readable-news-mrn-elektron-message-api-ema).
184
194
* [MRN Data Models and Elektron Implementation Guide](https://developers.refinitiv.com/elektron/elektron-sdk-java/docs?content=8736&type=documentation_item).
* [MRN WebSocket JavaScript example on GitHub](https://github.com/Refinitiv-API-Samples/Example.WebSocketAPI.Javascript.NewsMonitor).
196
+
* [MRN WebSocket C# NewsViewer example on GitHub](https://github.com/Refinitiv-API-Samples/Example.WebSocketAPI.CSharp.MRNWebSocketViewer).
186
197
187
198
For any question related to this example or Elektron WebSocket API, please use the Developer Community [Q&A Forum](https://community.developers.refinitiv.com/spaces/152/websocket-api.html).
0 commit comments