Skip to content

Commit 0bb294f

Browse files
committed
update RTO console app
1 parent 634a3a9 commit 0bb294f

File tree

3 files changed

+61
-593
lines changed

3 files changed

+61
-593
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ notebook/images/trna_process.png
1515
notebook/images/trna_process_assemble.png
1616

1717
old-requirements.txt
18+
mrn_console_app_rto.py

README.md

Lines changed: 60 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Please see the full documentation of this example application in [this article](
1414

1515

1616
**Update (As of December 2021)**: The example now supports the Refinitiv Real-Time -- Optimized (RTO - formerly known as ERT in Cloud) connection.
17-
* The RTO example is the mrn_console_rto.py console application file.
17+
* The RTO console example: Please check my colleague's [Refinitiv-API-Samples/Example.WebSocketAPI.Python.MRN.RTO](https://github.com/Refinitiv-API-Samples/Example.WebSocketAPI.Python.MRN.RTO) GitHub Repository.
1818
* The deployed Refinitiv Real-Time Distribution System (RTDS) examples are mrn_console_app.py console application and mrn_notebook_app.ipynb notebook files.
1919

2020
## Prerequisite
@@ -71,69 +71,88 @@ This example requires the following dependencies software and libraries.
7171

7272
## Application Files
7373
This example project contains the following files and folders
74-
1. *mrn_console_app.py*: The example application file
75-
2. *notebook_python/mrn_notebook_app.ipynb*: The example Jupyter Notebook application file
74+
1. *mrn_console_app.py*: The example console application for the deployed RTDS connection file
75+
2. *notebook_python/mrn_notebook_app.ipynb*: The example Jupyter Notebook application for the deployed RTDS connection file
7676
3. *Dockerfile*: The example application Dockerfile
7777
3. *requirements.txt*: The application dependencies configuration file
7878
4. LICENSE.md: Project's license file
7979
5. README.md: Project's README file
8080

81-
## How to run this example
81+
## <a id="how_to_run"></a>How to run this example
8282

83-
Please be informed that your Refinitiv Real-Time Advanced Data Hub and Refinitiv Real-Time Advanced Distribution Server should have a Service that contains MRN data. The first step is to unzip or download the example project folder into a directory of your choice, then choose how to run the application based on your environment below.
83+
The first step is to unzip or download the example project folder into a directory of your choice, then choose how to run the application based on your environment below.
8484

85-
### A console example
86-
1. Go to the project folder in the console
87-
2. Run ```$> pip install -r requirements.txt``` command in a console to install all the dependencies libraries.
88-
3. Then you can run mrn_console_app.py application with the following command
89-
```
90-
$> python mrn_console_app.py --hostname <Real-Time Advanced Distribution Server IP Address/Hostname> --port <WebSocket Port> --ric <MRN RIC name>
91-
```
92-
Optionally, the application subscribes ```MRN_STORY``` RIC code from Real-Time Advanced Distribution Server 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
85+
### <a id="how_to_setup"></a>Set Up Environment
9386

94-
### Docker example
95-
1. Go to the project folder in the console
96-
2. Run ```$> docker build -t <project tag name> .``` command in a console to build an image from a Dockerfile.
97-
```
98-
$> docker build -t rtsdk_ws_mrn_python .
99-
```
100-
3. Once the build is a success, you can create and run the container with the following command
101-
```
102-
$> docker run --name mrn_console -it rtsdk_ws_mrn_python --hostname Real-Time Advanced Distribution Server IP Address/Hostname> --port <WebSocket Port> --ric <MRN RIC name>
103-
```
104-
4. If you want to connect the Docker container to a localhost, please use ```host.docker.internal``` as the Host name.
105-
5. Press Ctrl+C buttons to stop the application
87+
It is an advisable to create a dedicate Python environment to run each Python project. You can create a new Conda environment names *MRN_WEBSOCKET* with the following steps
10688

107-
### Classic Jupyter Notebook example
89+
1. Open Anaconda Prompt and go to the project's folder
90+
2. Run the following command in an Anaconda Prompt to create a Conda environment named *MRN_WEBSOCKET* for the project.
91+
```
92+
(base) $>conda create --name MRN_WEBSOCKET python=3.8
93+
```
94+
3. Once the environment is created, activate MRN_WEBSOCKET environment with this command in Anaconda Prompt
95+
```
96+
(base) $>conda activate MRN_WEBSOCKET
97+
```
98+
4. Run the following command to install the dependencies in the *MRN_WEBSOCKET* environment
99+
```
100+
(MRN_WEBSOCKET) $>pip install -r requirements.txt
101+
```
102+
### <a id="rtds_jupyter"></a>RTDS Jupyter Notebook example
108103

109-
Please be informed that Python [Anaconda](https://www.anaconda.com/distribution/) or [MiniConda](https://docs.conda.io/en/latest/miniconda.html) distribution/package manager is highly recommended for running the Jupyter Notebook example.
104+
Please be informed that your Refinitiv Real-Time Advanced Data Hub and Refinitiv Real-Time Advanced Distribution Server should have a Service that contains MRN data. The Python [Anaconda](https://www.anaconda.com/distribution/) or [MiniConda](https://docs.conda.io/en/latest/miniconda.html) distribution/package manager is highly recommended for running the JupyterLab example.
110105

111106
1. Open Anaconda Prompt and go to the project's folder
112-
2. Run the following command in an Anaconda Prompt to create a Conda environment named *mrn_python_notebook* for the project.
107+
2. Activate MRN_WEBSOCKET environment with this command in Anaconda Prompt
108+
```
109+
(base) $>conda activate MRN_WEBSOCKET
113110
```
114-
(base) $>conda create --name mrn_python_notebook python=3.8
111+
3. Run the following command to install the JupyterLab application and pandas in the *MRN_WEBSOCKET* environment
115112
```
116-
3. Once the environment is created, activate Conda environment named ```mrn_python_notebook``` with this command in Anaconda Prompt
113+
(MRN_WEBSOCKET) $>conda install -c conda-forge jupyterlab pandas
117114
```
118-
(base) $>conda activate mrn_python_notebook
115+
4. In the current Anaconda Prompt, go to the project's notebook folder. Run the following command to start the JupyterLab application in the notebook folder.
119116
```
120-
4. In mrn_python_notebook environment, install the following prerequisite libraries
117+
(MRN_WEBSOCKET) $>jupyter lab
121118
```
122-
(mrn_python_notebook) $>conda install -c conda-forge notebook
119+
5. Open *mrn_notebook_app.ipynb* Notebook document, then follow through each notebook cell.
123120

124-
(mrn_python_notebook) $>conda install -c conda-forge pandas
121+
### <a id="rtds_console"></a>RTDS Console example
125122

126-
(mrn_python_notebook) $>pip install -r requirements.txt
123+
Please be informed that your Refinitiv Real-Time Advanced Data Hub and Refinitiv Real-Time Advanced Distribution Server should have a Service that contains MRN data.
124+
125+
1. Open Anaconda Prompt and go to the project's folder
126+
2. Activate MRN_WEBSOCKET environment with this command in Anaconda Prompt
127+
```
128+
(base) $>conda activate MRN_WEBSOCKET
127129
```
128-
5. Go to the project's notebook folder in the console
129-
6. Run the following command in a console to start the classic Jupyter Notebook in the notebook folder.
130+
3. Then you can run mrn_console_app.py application with the following command
130131
```
131-
(mrn_python_notebook) $>jupyter notebook
132+
(MRN_WEBSOCKET) $> python mrn_console_app.py --hostname <Real-Time Advanced Distribution Server IP Address/Hostname> --port <WebSocket Port>
132133
```
133-
7. Open *mrn_notebook_app.ipynb* Notebook document, then follow through each notebook cell.
134+
4. The application subscribes to ```MRN_STORNY``` RIC code from Real-Time Advanced Distribution Server 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.
135+
136+
### <a id="rto_console"></a>RTO console example
137+
138+
Please check my colleague's [Refinitiv-API-Samples/Example.WebSocketAPI.Python.MRN.RTO](https://github.com/Refinitiv-API-Samples/Example.WebSocketAPI.Python.MRN.RTO) GitHub Repository.
139+
140+
Alternatively, the *mrn_trna_console_rto.py* example of the [Refinitiv-API-Samples/Example.WebSocketAPI.Python.TRNA](https://github.com/Refinitiv-API-Samples/Example.WebSocketAPI.Python.TRNA) also supports the MRN consumer with RTO, but it subscribes to ```MRN_TRNA``` RIC code from the RTO by default.
141+
142+
143+
### Docker example
144+
1. Go to the project folder in the console
145+
2. Run ```$> docker build -t <project tag name> .``` command in a console to build an image from a Dockerfile.
146+
```
147+
$> docker build -t rtsdk_ws_mrn_python .
148+
```
149+
3. Once the build is a success, you can create and run the container with the following command
150+
```
151+
$> docker run --name mrn_console -it rtsdk_ws_mrn_python --hostname Real-Time Advanced Distribution Server IP Address/Hostname> --port <WebSocket Port> --ric <MRN RIC name>
152+
```
153+
4. If you want to connect the Docker container to a localhost, please use ```host.docker.internal``` as the Host name.
154+
5. Press Ctrl+C buttons to stop the application
134155
135-
*Note:*
136-
- 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 environments 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.
137156
138157
## Example Results
139158
### Send MRN_STORY request to Real-Time Advanced Distribution Server

0 commit comments

Comments
 (0)