Skip to content

Commit bf95379

Browse files
committed
Merge branch 'update_link_rebrand'
Update links for rebranding
2 parents 6f80315 + 10debc0 commit bf95379

File tree

4 files changed

+93
-96
lines changed

4 files changed

+93
-96
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
console_python/market_price.py
33
result/
44
notebook_python/test_ws_post.ipynb
5-
notebook_python/test_ws_post2.ipynb
5+
notebook_python/test_ws_post2.ipynb
6+
notebook_python/.ipynb_checkpoints

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ This article is focusing on **the second method** which is contributing data via
4343

4444
![Figure-1](images/diagram_trcc_ws.png "RCC Contribution Diagram")
4545

46-
The Refinitiv Real-Time Advanced Data Hub server connects to RCC through the delivery direct network via Tunnel Stream Aggregator (TSA) adapter, which is a private network (TLS encrypted) between a client site and Refinitiv. The TSA adapter is already packaged with the Advanced Data Hub version 3.2, and needs to be configured. You can find more detail regarding the Advanced Data Hub-RCC configurations on [Contributing your data to Refinitiv article](https://developers.refinitiv.com/article/contributing-your-data-thomson-reuters) page. This example also contain example Advanced Data Hub-RCC configurations in *trep_config/rmds_trcc.cnf* file.
46+
The Refinitiv Real-Time Advanced Data Hub server connects to RCC through the delivery direct network via Tunnel Stream Aggregator (TSA) adapter, which is a private network (TLS encrypted) between a client site and Refinitiv. The TSA adapter is already packaged with the Advanced Data Hub version 3.2, and needs to be configured. You can find more detail regarding the Advanced Data Hub-RCC configurations on [Contributing your data to Refinitiv article](https://developers.refinitiv.com/en/article-catalog/article/contributing-your-data-refinitiv) page. This example also contain example Advanced Data Hub-RCC configurations in *trep_config/rmds_trcc.cnf* file.
4747

4848
## Prerequisite
4949
This example requires the following dependencies softwares and libraries.

notebook_python/.ipynb_checkpoints/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

notebook_python/trcc_posting_notebook.ipynb

Lines changed: 90 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5+
"metadata": {},
56
"source": [
67
"# Contributing your data to Refinitiv with WebSocket API and Refinitiv Real-Time Distribution System\n",
78
"\n",
@@ -40,12 +41,12 @@
4041
"\n",
4142
"![Figure-1](images/diagram_trcc_ws.png \"RCC Contribution Diagram\") \n",
4243
"\n",
43-
"The Refinitiv Real-Time Advanced Data Hub server connects to RCC through the delivery direct network via Tunnel Stream Aggregator (TSA) adapter, which is a private network (TLS encrypted) between a client site and Refinitiv. The TSA adapter is already packaged with the Advanced Data Hub version 3.2, and needs to be configured. You can find more detail regarding the Advanced Data Hub-RCC configurations on [Contributing your data to Refinitiv article](https://developers.refinitiv.com/article/contributing-your-data-thomson-reuters) page. This example also contain example Advanced Data Hub-RCC configurations in *infra_config/rmds_trcc.cnf* file.\n"
44-
],
45-
"metadata": {}
44+
"The Refinitiv Real-Time Advanced Data Hub server connects to RCC through the delivery direct network via Tunnel Stream Aggregator (TSA) adapter, which is a private network (TLS encrypted) between a client site and Refinitiv. The TSA adapter is already packaged with the Advanced Data Hub version 3.2, and needs to be configured. You can find more detail regarding the Advanced Data Hub-RCC configurations on [Contributing your data to Refinitiv article](https://developers.refinitiv.com/en/article-catalog/article/contributing-your-data-refinitiv) page. This example also contain example Advanced Data Hub-RCC configurations in *infra_config/rmds_trcc.cnf* file.\n"
45+
]
4646
},
4747
{
4848
"cell_type": "markdown",
49+
"metadata": {},
4950
"source": [
5051
"## Prerequisite\n",
5152
"\n",
@@ -54,35 +55,36 @@
5455
"2. RCC username, password and host list credentials. Please reach out to your Refinitiv sales associate to acquire RCC access credentials.\n",
5556
"\n",
5657
"*Note:* The RCC access credentials are required in the connection between ADH server and RCC server only, not in the application level."
57-
],
58-
"metadata": {}
58+
]
5959
},
6060
{
6161
"cell_type": "markdown",
62+
"metadata": {},
6263
"source": [
6364
"## How to run this console example\n",
6465
"\n",
6566
"Please be informed that your Refinitiv Real-Time Advanced Data Hub and Real-Time Advanced Distribution servers should be applied the RCC configurations and RCC contribution service should be \"Up\" before running an example."
66-
],
67-
"metadata": {}
67+
]
6868
},
6969
{
7070
"cell_type": "code",
7171
"execution_count": 1,
72+
"metadata": {},
73+
"outputs": [],
7274
"source": [
7375
"# #uncomment if you do not have requests and websocket-client (version 0.49 and above) installed\n",
7476
"# #Install requests package in a current Jupyter kernal\n",
7577
"\n",
7678
"# import sys\n",
7779
"# !{sys.executable} -m pip install requests\n",
7880
"# !{sys.executable} -m pip install websocket-client"
79-
],
80-
"outputs": [],
81-
"metadata": {}
81+
]
8282
},
8383
{
8484
"cell_type": "code",
8585
"execution_count": 1,
86+
"metadata": {},
87+
"outputs": [],
8688
"source": [
8789
"# import required libraries\n",
8890
"\n",
@@ -95,13 +97,13 @@
9597
"import threading\n",
9698
"import os\n",
9799
"from threading import Thread, Event"
98-
],
99-
"outputs": [],
100-
"metadata": {}
100+
]
101101
},
102102
{
103103
"cell_type": "code",
104104
"execution_count": 2,
105+
"metadata": {},
106+
"outputs": [],
105107
"source": [
106108
"# TREP connection variables\n",
107109
"\n",
@@ -111,13 +113,13 @@
111113
"app_id = '256'\n",
112114
"position = socket.gethostbyname(socket.gethostname())\n",
113115
"login_id = 1"
114-
],
115-
"outputs": [],
116-
"metadata": {}
116+
]
117117
},
118118
{
119119
"cell_type": "code",
120120
"execution_count": 3,
121+
"metadata": {},
122+
"outputs": [],
121123
"source": [
122124
"# RCC contribution variables\n",
123125
"\n",
@@ -128,24 +130,23 @@
128130
"bid_value = 34.25\n",
129131
"ask_value = 35.48\n",
130132
"primact_1_value = 116.50"
131-
],
132-
"outputs": [],
133-
"metadata": {}
133+
]
134134
},
135135
{
136136
"cell_type": "code",
137137
"execution_count": 4,
138+
"metadata": {},
139+
"outputs": [],
138140
"source": [
139141
"# WebSocket connections Variables\n",
140142
"\n",
141143
"web_socket_app = None\n",
142144
"web_socket_open = False"
143-
],
144-
"outputs": [],
145-
"metadata": {}
145+
]
146146
},
147147
{
148148
"cell_type": "markdown",
149+
"metadata": {},
149150
"source": [
150151
"## Contribution Process\n",
151152
"\n",
@@ -159,12 +160,13 @@
159160
" * The ```Key``` information which includes ```Name``` and ```Service``` attributes that refer to contribution RIC name and RCC contribution service name\n",
160161
" * The ```Message``` payload must be an Update message type\n",
161162
" * The ```Message``` payload must contain the same ```Key``` information as the Post message"
162-
],
163-
"metadata": {}
163+
]
164164
},
165165
{
166166
"cell_type": "code",
167167
"execution_count": 5,
168+
"metadata": {},
169+
"outputs": [],
168170
"source": [
169171
"# JSON-OMM Login and Process messages\n",
170172
"\n",
@@ -212,22 +214,22 @@
212214
" ws.send(json.dumps(login_json))\n",
213215
" print(\"SENT:\")\n",
214216
" print(json.dumps(login_json, sort_keys=True, indent=2, separators=(',', ':')))"
215-
],
216-
"outputs": [],
217-
"metadata": {}
217+
]
218218
},
219219
{
220220
"cell_type": "markdown",
221+
"metadata": {},
221222
"source": [
222223
"## Off-Stream Post\n",
223224
"\n",
224225
"In an off-stream post, the client application can send a post for an item via a Login stream, regardless of whether a data stream first exists. The route of the post is determined by the Refinitiv Real-Time Distribution System configuration."
225-
],
226-
"metadata": {}
226+
]
227227
},
228228
{
229229
"cell_type": "code",
230230
"execution_count": 6,
231+
"metadata": {},
232+
"outputs": [],
231233
"source": [
232234
"# Create JSON Off-Stream Post message and sends it to ADS server.\n",
233235
"\n",
@@ -278,66 +280,16 @@
278280
" ws.send(json.dumps(mp_post_json_offstream))\n",
279281
" print(\"SENT:\")\n",
280282
" print(json.dumps(mp_post_json_offstream, sort_keys=True, indent=2, separators=(',', ':')))\n"
281-
],
282-
"outputs": [],
283-
"metadata": {}
283+
]
284284
},
285285
{
286286
"cell_type": "code",
287287
"execution_count": 7,
288-
"source": [
289-
"# WebSocket connection process\n",
290-
"\n",
291-
"def on_message(ws, message):\n",
292-
" \"\"\" Called when message received, parse message into JSON for processing \"\"\"\n",
293-
" print(\"RECEIVED: \")\n",
294-
" message_json = json.loads(message)\n",
295-
" print(json.dumps(message_json, sort_keys=True, indent=2, separators=(',', ':')))\n",
296-
"\n",
297-
" for singleMsg in message_json:\n",
298-
" process_message(ws, singleMsg)\n",
299-
" \n",
300-
"def on_error(ws, error):\n",
301-
" \"\"\" Called when websocket error has occurred \"\"\"\n",
302-
" print(error)\n",
303-
" \n",
304-
"def on_close(ws):\n",
305-
" \"\"\" Called when websocket is closed \"\"\"\n",
306-
" global web_socket_open\n",
307-
" print(\"WebSocket Closed\")\n",
308-
" web_socket_open = False\n",
309-
" \n",
310-
"def on_open(ws):\n",
311-
" \"\"\" Called when handshake is complete and websocket is open, send login \"\"\"\n",
312-
"\n",
313-
" print(\"WebSocket successfully connected!\")\n",
314-
" global web_socket_open\n",
315-
" web_socket_open = True\n",
316-
" send_login_request(ws)\n",
317-
"\n",
318-
"if __name__ == \"__main__\":\n",
319-
" # Start websocket handshake\n",
320-
" ws_address = \"ws://{}:{}/WebSocket\".format(hostname, port)\n",
321-
" print(\"Connecting to WebSocket \" + ws_address + \" ...\")\n",
322-
" web_socket_app = websocket.WebSocketApp(ws_address, header=['User-Agent: Python'],\n",
323-
" on_message=on_message,\n",
324-
" on_error=on_error,\n",
325-
" on_close=on_close,\n",
326-
" subprotocols=['tr_json2'])\n",
327-
" web_socket_app.on_open = on_open\n",
328-
"\n",
329-
" # Event loop\n",
330-
" #wst = threading.Thread(target=web_socket_app.run_forever)\n",
331-
" wst = threading.Thread(target=web_socket_app.run_forever, kwargs={'sslopt': {'check_hostname': False}})\n",
332-
" wst.start()\n",
333-
"\n",
334-
" time.sleep(10)\n",
335-
" web_socket_app.close()\n"
336-
],
288+
"metadata": {},
337289
"outputs": [
338290
{
339-
"output_type": "stream",
340291
"name": "stdout",
292+
"output_type": "stream",
341293
"text": [
342294
"Connecting to WebSocket ws://127.0.0.1:15000/WebSocket ...\n",
343295
"WebSocket successfully connected!\n",
@@ -436,10 +388,59 @@
436388
]
437389
}
438390
],
439-
"metadata": {}
391+
"source": [
392+
"# WebSocket connection process\n",
393+
"\n",
394+
"def on_message(ws, message):\n",
395+
" \"\"\" Called when message received, parse message into JSON for processing \"\"\"\n",
396+
" print(\"RECEIVED: \")\n",
397+
" message_json = json.loads(message)\n",
398+
" print(json.dumps(message_json, sort_keys=True, indent=2, separators=(',', ':')))\n",
399+
"\n",
400+
" for singleMsg in message_json:\n",
401+
" process_message(ws, singleMsg)\n",
402+
" \n",
403+
"def on_error(ws, error):\n",
404+
" \"\"\" Called when websocket error has occurred \"\"\"\n",
405+
" print(error)\n",
406+
" \n",
407+
"def on_close(ws):\n",
408+
" \"\"\" Called when websocket is closed \"\"\"\n",
409+
" global web_socket_open\n",
410+
" print(\"WebSocket Closed\")\n",
411+
" web_socket_open = False\n",
412+
" \n",
413+
"def on_open(ws):\n",
414+
" \"\"\" Called when handshake is complete and websocket is open, send login \"\"\"\n",
415+
"\n",
416+
" print(\"WebSocket successfully connected!\")\n",
417+
" global web_socket_open\n",
418+
" web_socket_open = True\n",
419+
" send_login_request(ws)\n",
420+
"\n",
421+
"if __name__ == \"__main__\":\n",
422+
" # Start websocket handshake\n",
423+
" ws_address = \"ws://{}:{}/WebSocket\".format(hostname, port)\n",
424+
" print(\"Connecting to WebSocket \" + ws_address + \" ...\")\n",
425+
" web_socket_app = websocket.WebSocketApp(ws_address, header=['User-Agent: Python'],\n",
426+
" on_message=on_message,\n",
427+
" on_error=on_error,\n",
428+
" on_close=on_close,\n",
429+
" subprotocols=['tr_json2'])\n",
430+
" web_socket_app.on_open = on_open\n",
431+
"\n",
432+
" # Event loop\n",
433+
" #wst = threading.Thread(target=web_socket_app.run_forever)\n",
434+
" wst = threading.Thread(target=web_socket_app.run_forever, kwargs={'sslopt': {'check_hostname': False}})\n",
435+
" wst.start()\n",
436+
"\n",
437+
" time.sleep(10)\n",
438+
" web_socket_app.close()\n"
439+
]
440440
},
441441
{
442442
"cell_type": "markdown",
443+
"metadata": {},
443444
"source": [
444445
"## References\n",
445446
"* [Refinitiv Real-Time & Distribution](https://developers.refinitiv.com/en/use-cases-catalog/refinitiv-real-time) on the [Refinitiv Developer Community](https://developers.refinitiv.com/) web site.\n",
@@ -453,20 +454,19 @@
453454
"* [Contributing Data to Refinitiv Contributions Channel (RCC) via WebSocket Tutorial](https://developers.refinitiv.com/en/api-catalog/refinitiv-real-time-opnsrc/refinitiv-websocket-api/tutorials#contributing-data-to-refinitiv-contributions-channel).\n",
454455
"\n",
455456
"For any question related to this example or WebSocket API, please use the Developer Community [Q&A Forum](https://community.developers.refinitiv.com/spaces/152/websocket-api.html)."
456-
],
457-
"metadata": {}
457+
]
458458
},
459459
{
460460
"cell_type": "code",
461461
"execution_count": null,
462-
"source": [],
462+
"metadata": {},
463463
"outputs": [],
464-
"metadata": {}
464+
"source": []
465465
}
466466
],
467467
"metadata": {
468468
"kernelspec": {
469-
"display_name": "Python 3",
469+
"display_name": "Python 3 (ipykernel)",
470470
"language": "python",
471471
"name": "python3"
472472
},
@@ -480,9 +480,9 @@
480480
"name": "python",
481481
"nbconvert_exporter": "python",
482482
"pygments_lexer": "ipython3",
483-
"version": "3.7.6"
483+
"version": "3.8.11"
484484
}
485485
},
486486
"nbformat": 4,
487487
"nbformat_minor": 2
488-
}
488+
}

0 commit comments

Comments
 (0)