|
66 | 66 | }, |
67 | 67 | { |
68 | 68 | "cell_type": "code", |
69 | | - "execution_count": 2, |
| 69 | + "execution_count": 3, |
70 | 70 | "metadata": {}, |
71 | 71 | "outputs": [], |
72 | 72 | "source": [ |
|
87 | 87 | }, |
88 | 88 | { |
89 | 89 | "cell_type": "code", |
90 | | - "execution_count": 3, |
| 90 | + "execution_count": 4, |
91 | 91 | "metadata": {}, |
92 | 92 | "outputs": [ |
93 | 93 | { |
94 | 94 | "data": { |
95 | 95 | "text/plain": [ |
96 | | - "<refinitiv.data.session.Definition object at 0x7f83b3979b10 {name='workspace'}>" |
| 96 | + "<refinitiv.data.session.Definition object at 0x7ff41524d4f0 {name='workspace'}>" |
97 | 97 | ] |
98 | 98 | }, |
99 | | - "execution_count": 3, |
| 99 | + "execution_count": 4, |
100 | 100 | "metadata": {}, |
101 | 101 | "output_type": "execute_result" |
102 | 102 | } |
|
119 | 119 | "### Define callbacks to receive streaming data" |
120 | 120 | ] |
121 | 121 | }, |
| 122 | + { |
| 123 | + "cell_type": "markdown", |
| 124 | + "metadata": {}, |
| 125 | + "source": [ |
| 126 | + "### Create a stream and open it" |
| 127 | + ] |
| 128 | + }, |
122 | 129 | { |
123 | 130 | "cell_type": "code", |
124 | | - "execution_count": 4, |
| 131 | + "execution_count": 5, |
125 | 132 | "metadata": {}, |
126 | 133 | "outputs": [], |
127 | 134 | "source": [ |
|
139 | 146 | " display(df)\n", |
140 | 147 | "\n", |
141 | 148 | "\n", |
142 | | - "def update_dataframe(streaming_prices, instrument_name, fields):\n", |
| 149 | + "def update_dataframe(fields, instrument_name, streaming_prices):\n", |
143 | 150 | " global df\n", |
144 | 151 | " clear_output(wait=True)\n", |
145 | 152 | " for field_name, field_value in fields.items():\n", |
146 | 153 | " df.at[instrument_name, field_name] = field_value\n", |
147 | 154 | " display(df)" |
148 | 155 | ] |
149 | 156 | }, |
150 | | - { |
151 | | - "cell_type": "markdown", |
152 | | - "metadata": {}, |
153 | | - "source": [ |
154 | | - "### Create a stream and open it" |
155 | | - ] |
156 | | - }, |
157 | 157 | { |
158 | 158 | "cell_type": "code", |
159 | | - "execution_count": 5, |
| 159 | + "execution_count": 6, |
160 | 160 | "metadata": {}, |
161 | 161 | "outputs": [ |
162 | 162 | { |
|
187 | 187 | " <tbody>\n", |
188 | 188 | " <tr>\n", |
189 | 189 | " <th>EUR=</th>\n", |
190 | | - " <td>1.1331</td>\n", |
191 | | - " <td>1.1335</td>\n", |
| 190 | + " <td>1.053</td>\n", |
| 191 | + " <td>1.0534</td>\n", |
192 | 192 | " </tr>\n", |
193 | 193 | " <tr>\n", |
194 | 194 | " <th>GBP=</th>\n", |
195 | | - " <td>1.3352</td>\n", |
196 | | - " <td>1.3356</td>\n", |
| 195 | + " <td>1.2264</td>\n", |
| 196 | + " <td>1.2265</td>\n", |
197 | 197 | " </tr>\n", |
198 | 198 | " <tr>\n", |
199 | 199 | " <th>JPY=</th>\n", |
200 | | - " <td>114.15</td>\n", |
201 | | - " <td>114.16</td>\n", |
| 200 | + " <td>136.26</td>\n", |
| 201 | + " <td>136.29</td>\n", |
202 | 202 | " </tr>\n", |
203 | 203 | " <tr>\n", |
204 | 204 | " <th>CAD=</th>\n", |
205 | | - " <td>1.2782</td>\n", |
206 | | - " <td>1.2783</td>\n", |
| 205 | + " <td>1.2937</td>\n", |
| 206 | + " <td>1.2941</td>\n", |
207 | 207 | " </tr>\n", |
208 | 208 | " </tbody>\n", |
209 | 209 | "</table>\n", |
210 | 210 | "</div>" |
211 | 211 | ], |
212 | 212 | "text/plain": [ |
213 | 213 | " BID ASK\n", |
214 | | - "EUR= 1.1331 1.1335\n", |
215 | | - "GBP= 1.3352 1.3356\n", |
216 | | - "JPY= 114.15 114.16\n", |
217 | | - "CAD= 1.2782 1.2783" |
| 214 | + "EUR= 1.053 1.0534\n", |
| 215 | + "GBP= 1.2264 1.2265\n", |
| 216 | + "JPY= 136.26 136.29\n", |
| 217 | + "CAD= 1.2937 1.2941" |
218 | 218 | ] |
219 | 219 | }, |
220 | 220 | "metadata": {}, |
|
243 | 243 | }, |
244 | 244 | { |
245 | 245 | "cell_type": "code", |
246 | | - "execution_count": 6, |
| 246 | + "execution_count": 7, |
247 | 247 | "metadata": {}, |
248 | 248 | "outputs": [ |
249 | 249 | { |
250 | 250 | "data": { |
251 | 251 | "text/plain": [ |
252 | | - "<OpenState.Closed: 3>" |
| 252 | + "<OpenState.Closed: 'Closed'>" |
253 | 253 | ] |
254 | 254 | }, |
255 | | - "execution_count": 6, |
| 255 | + "execution_count": 7, |
256 | 256 | "metadata": {}, |
257 | 257 | "output_type": "execute_result" |
258 | 258 | } |
|
270 | 270 | }, |
271 | 271 | { |
272 | 272 | "cell_type": "code", |
273 | | - "execution_count": 7, |
| 273 | + "execution_count": 8, |
274 | 274 | "metadata": {}, |
275 | 275 | "outputs": [], |
276 | 276 | "source": [ |
|
287 | 287 | ], |
288 | 288 | "metadata": { |
289 | 289 | "kernelspec": { |
290 | | - "display_name": "Python 3", |
| 290 | + "display_name": "Python 3 (ipykernel)", |
291 | 291 | "language": "python", |
292 | 292 | "name": "python3" |
293 | 293 | }, |
|
301 | 301 | "name": "python", |
302 | 302 | "nbconvert_exporter": "python", |
303 | 303 | "pygments_lexer": "ipython3", |
304 | | - "version": "3.7.6" |
| 304 | + "version": "3.9.7" |
305 | 305 | } |
306 | 306 | }, |
307 | 307 | "nbformat": 4, |
|
0 commit comments