Skip to content

Commit e70f066

Browse files
author
Olivier Davant
committed
Quick Start guide and Tutorials updated for 1.0.0b16
1 parent c2a43bb commit e70f066

File tree

4 files changed

+171
-204
lines changed

4 files changed

+171
-204
lines changed

Tutorials/2.Content/2.2-Pricing/TUT_2.2.03-Pricing-StreamingEvents.ipynb

Lines changed: 41 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
{
8181
"data": {
8282
"text/plain": [
83-
"<refinitiv.data.session.platform.Definition object at 0x16ff3b399a0 {session_name='rdp'}>"
83+
"<refinitiv.data.session.Definition object at 0x7fdd732222b0 {name='workspace'}>"
8484
]
8585
},
8686
"execution_count": 3,
@@ -106,20 +106,21 @@
106106
"outputs": [],
107107
"source": [
108108
"# Function to handle the intial Refresh for each item\n",
109-
"def handle_refresh(streaming_prices, instrument_name, fields):\n",
109+
"def handle_refresh(fields, instrument_name, streaming_prices):\n",
110110
" # One way to access data - get dataframe\n",
111111
" print(f\"Refresh : {streaming_prices.get_snapshot()}\")\n",
112112
" return\n",
113113
"\n",
114114
"# Function to update dataframe, when we receive updates for individual items\n",
115-
"def handle_update(streaming_prices, instrument_name, fields):\n",
115+
"def handle_update(fields, instrument_name, streaming_prices):\n",
116116
" # Alternative way of accesing data - access the updated fields\n",
117117
" print(f\"Update : {instrument_name}:{fields}\")\n",
118118
" \n",
119119
"# Function to extract status code for an item as & when received from server\n",
120120
"# Status contains a 'code' and a more detailed 'message'\n",
121-
"def handle_status(streaming_prices, instrument_name, status):\n",
122-
" print(f\"Status : {instrument_name}:{status['code']}:{status['message']}\")"
121+
"def handle_status(status, instrument_name, streaming_prices):\n",
122+
" state=status['State']\n",
123+
" print(f\"Status : {instrument_name}:{state['Code']}:{state['Text']}\")"
123124
]
124125
},
125126
{
@@ -138,41 +139,28 @@
138139
"name": "stdout",
139140
"output_type": "stream",
140141
"text": [
141-
"Refresh : Instrument BID ASK\n",
142-
"0 EUR= 1.1222 1.1226\n",
142+
"Refresh : Instrument ASK BID\n",
143+
"0 EUR= 1.0596 1.0592\n",
143144
"1 GBP= <NA> <NA>\n",
144145
"2 JPY= <NA> <NA>\n",
145146
"3 BADRIC <NA> <NA>\n",
146-
"Refresh : Instrument BID ASK\n",
147-
"0 EUR= 1.1222 1.1226\n",
148-
"1 GBP= 1.3325 1.333\n",
149-
"2 JPY= 115.24 115.27\n",
147+
"Refresh : Instrument ASK BID\n",
148+
"0 EUR= 1.0596 1.0592\n",
149+
"1 GBP= 1.2306 1.2302\n",
150+
"2 JPY= <NA> <NA>\n",
150151
"3 BADRIC <NA> <NA>\n",
151-
"Refresh : Instrument BID ASK\n",
152-
"0 EUR= 1.1222 1.1226\n",
153-
"1 GBP= 1.3325 1.333\n",
154-
"2 JPY= 115.24 115.27\n",
155-
"3 BADRIC <NA> <NA>\n"
156-
]
157-
},
158-
{
159-
"name": "stderr",
160-
"output_type": "stream",
161-
"text": [
162-
"[StreamingPrices universe=['EUR=', 'GBP=', 'JPY=', 'BADRIC']] on_status_stream_event <function handle_status at 0x0000016FA352BC10> raised exception: KeyError('code')\n"
163-
]
164-
},
165-
{
166-
"name": "stdout",
167-
"output_type": "stream",
168-
"text": [
169-
"Update : JPY=:{'BID': 115.24, 'ASK': 115.27}\n"
152+
"Refresh : Instrument ASK BID\n",
153+
"0 EUR= 1.0596 1.0592\n",
154+
"1 GBP= 1.2306 1.2302\n",
155+
"2 JPY= 135.87 135.84\n",
156+
"3 BADRIC <NA> <NA>\n",
157+
"Status : BADRIC:NotFound:The record could not be found\n"
170158
]
171159
},
172160
{
173161
"data": {
174162
"text/plain": [
175-
"<OpenState.Opened: 1>"
163+
"<OpenState.Opened: 'Opened'>"
176164
]
177165
},
178166
"execution_count": 5,
@@ -183,28 +171,22 @@
183171
"name": "stdout",
184172
"output_type": "stream",
185173
"text": [
186-
"Update : JPY=:{'BID': 115.25, 'ASK': 115.27}\n",
187-
"Update : GBP=:{'BID': 1.3325, 'ASK': 1.3329}\n",
188-
"Update : GBP=:{'BID': 1.3324, 'ASK': 1.3329}\n",
189-
"Update : EUR=:{'BID': 1.1222, 'ASK': 1.1226}\n",
190-
"Update : GBP=:{'BID': 1.3326, 'ASK': 1.3327}\n",
191-
"Update : GBP=:{'BID': 1.3325, 'ASK': 1.3329}\n",
192-
"Update : JPY=:{'BID': 115.24, 'ASK': 115.27}\n",
193-
"Update : EUR=:{'BID': 1.1223, 'ASK': 1.1224}\n",
194-
"Update : JPY=:{'BID': 115.25, 'ASK': 115.26}\n",
195-
"Update : JPY=:{'BID': 115.25, 'ASK': 115.27}\n",
196-
"Update : JPY=:{'BID': 115.24, 'ASK': 115.27}\n",
197-
"Update : GBP=:{'BID': 1.3326, 'ASK': 1.3329}\n",
198-
"Update : JPY=:{'BID': 115.25, 'ASK': 115.27}\n",
199-
"Update : GBP=:{'BID': 1.3325, 'ASK': 1.3329}\n",
200-
"Update : JPY=:{'BID': 115.25, 'ASK': 115.26}\n",
201-
"Update : JPY=:{'BID': 115.24, 'ASK': 115.27}\n",
202-
"Update : JPY=:{'BID': 115.24, 'ASK': 115.27}\n",
203-
"Update : JPY=:{'BID': 115.24, 'ASK': 115.27}\n",
204-
"Update : GBP=:{'BID': 1.3325, 'ASK': 1.3329}\n",
205-
"Update : EUR=:{'BID': 1.1223, 'ASK': 1.1224}\n",
206-
"Update : JPY=:{'BID': 115.25, 'ASK': 115.27}\n",
207-
"Update : GBP=:{'BID': 1.3326, 'ASK': 1.3329}\n"
174+
"Update : GBP=:{'ASK': 1.2305, 'BID': 1.2304}\n",
175+
"Update : JPY=:{'ASK': 135.86, 'BID': 135.85}\n",
176+
"Update : EUR=:{'ASK': 1.0595, 'BID': 1.0594}\n",
177+
"Update : JPY=:{'ASK': 135.86, 'BID': 135.85}\n",
178+
"Update : EUR=:{'ASK': 1.0596, 'BID': 1.0592}\n",
179+
"Update : JPY=:{'ASK': 135.89, 'BID': 135.84}\n",
180+
"Update : EUR=:{'ASK': 1.0595, 'BID': 1.0593}\n",
181+
"Update : JPY=:{'ASK': 135.86, 'BID': 135.85}\n",
182+
"Update : GBP=:{'ASK': 1.2305, 'BID': 1.2304}\n",
183+
"Update : JPY=:{'ASK': 135.86, 'BID': 135.85}\n",
184+
"Update : JPY=:{'ASK': 135.86, 'BID': 135.85}\n",
185+
"Update : EUR=:{'ASK': 1.0596, 'BID': 1.0592}\n",
186+
"Update : GBP=:{'ASK': 1.2306, 'BID': 1.2302}\n",
187+
"Update : JPY=:{'ASK': 135.86, 'BID': 135.83}\n",
188+
"Update : EUR=:{'ASK': 1.0594, 'BID': 1.0593}\n",
189+
"Update : GBP=:{'ASK': 1.2304, 'BID': 1.2303}\n"
208190
]
209191
}
210192
],
@@ -242,13 +224,14 @@
242224
"name": "stdout",
243225
"output_type": "stream",
244226
"text": [
245-
"Update : EUR=:{'BID': 1.1223, 'ASK': 1.1224}\n"
227+
"Update : JPY=:{'ASK': 135.86, 'BID': 135.85}\n",
228+
"Update : EUR=:{'ASK': 1.0595, 'BID': 1.0593}\n"
246229
]
247230
},
248231
{
249232
"data": {
250233
"text/plain": [
251-
"<OpenState.Closed: 3>"
234+
"<OpenState.Closed: 'Closed'>"
252235
]
253236
},
254237
"execution_count": 6,
@@ -286,9 +269,9 @@
286269
],
287270
"metadata": {
288271
"kernelspec": {
289-
"display_name": "RevData39",
272+
"display_name": "Python 3 (ipykernel)",
290273
"language": "python",
291-
"name": "rd39"
274+
"name": "python3"
292275
},
293276
"language_info": {
294277
"codemirror_mode": {
@@ -300,7 +283,7 @@
300283
"name": "python",
301284
"nbconvert_exporter": "python",
302285
"pygments_lexer": "ipython3",
303-
"version": "3.9.4"
286+
"version": "3.9.7"
304287
}
305288
},
306289
"nbformat": 4,

0 commit comments

Comments
 (0)