Skip to content

Commit 28cec19

Browse files
committed
Fix the Status output and tidy up Chain notebooks
1 parent ea918cb commit 28cec19

File tree

3 files changed

+193
-136
lines changed

3 files changed

+193
-136
lines changed

2.Content/2.2-Pricing/2.2.02-Pricing-StreamingCache.ipynb

Lines changed: 85 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
{
6969
"data": {
7070
"text/plain": [
71-
"<refinitiv.data._data.core.session._platform_session.PlatformSession at 0x2442e0461c0>"
71+
"<refinitiv.data._data.core.session._platform_session.PlatformSession at 0x25afe81da30>"
7272
]
7373
},
7474
"execution_count": 2,
@@ -414,13 +414,74 @@
414414
},
415415
{
416416
"cell_type": "code",
417-
"execution_count": null,
417+
"execution_count": 3,
418418
"metadata": {},
419-
"outputs": [],
419+
"outputs": [
420+
{
421+
"data": {
422+
"text/html": [
423+
"<div>\n",
424+
"<style scoped>\n",
425+
" .dataframe tbody tr th:only-of-type {\n",
426+
" vertical-align: middle;\n",
427+
" }\n",
428+
"\n",
429+
" .dataframe tbody tr th {\n",
430+
" vertical-align: top;\n",
431+
" }\n",
432+
"\n",
433+
" .dataframe thead th {\n",
434+
" text-align: right;\n",
435+
" }\n",
436+
"</style>\n",
437+
"<table border=\"1\" class=\"dataframe\">\n",
438+
" <thead>\n",
439+
" <tr style=\"text-align: right;\">\n",
440+
" <th></th>\n",
441+
" <th>Instrument</th>\n",
442+
" <th>BID</th>\n",
443+
" <th>ASK</th>\n",
444+
" </tr>\n",
445+
" </thead>\n",
446+
" <tbody>\n",
447+
" <tr>\n",
448+
" <th>0</th>\n",
449+
" <td>EUR=</td>\n",
450+
" <td>1.1939</td>\n",
451+
" <td>1.1943</td>\n",
452+
" </tr>\n",
453+
" <tr>\n",
454+
" <th>1</th>\n",
455+
" <td>GBP=</td>\n",
456+
" <td>1.3908</td>\n",
457+
" <td>1.3912</td>\n",
458+
" </tr>\n",
459+
" <tr>\n",
460+
" <th>2</th>\n",
461+
" <td>BADRIC</td>\n",
462+
" <td>&lt;NA&gt;</td>\n",
463+
" <td>&lt;NA&gt;</td>\n",
464+
" </tr>\n",
465+
" </tbody>\n",
466+
"</table>\n",
467+
"</div>"
468+
],
469+
"text/plain": [
470+
" Instrument BID ASK\n",
471+
"0 EUR= 1.1939 1.1943\n",
472+
"1 GBP= 1.3908 1.3912\n",
473+
"2 BADRIC <NA> <NA>"
474+
]
475+
},
476+
"execution_count": 3,
477+
"metadata": {},
478+
"output_type": "execute_result"
479+
}
480+
],
420481
"source": [
421482
"# Define our Streaming Price object\n",
422483
"mixed = rd.content.pricing.Definition(\n",
423-
" ['EUR=', 'GBP=', 'DUMMY'],\n",
484+
" ['EUR=', 'GBP=', 'BADRIC'],\n",
424485
" fields=['BID', 'ASK']\n",
425486
").get_stream()\n",
426487
"# Open the Stream - Once opened, the library starts caching the updates\n",
@@ -437,22 +498,36 @@
437498
},
438499
{
439500
"cell_type": "code",
440-
"execution_count": null,
501+
"execution_count": 5,
441502
"metadata": {},
442-
"outputs": [],
503+
"outputs": [
504+
{
505+
"data": {
506+
"text/plain": [
507+
"{'status': <StreamState.Closed: 1>,\n",
508+
" 'code': 'NotFound',\n",
509+
" 'message': '**The record could not be found'}"
510+
]
511+
},
512+
"execution_count": 5,
513+
"metadata": {},
514+
"output_type": "execute_result"
515+
}
516+
],
443517
"source": [
444-
"mixed['DUMMY'].state"
518+
"mixed['BADRIC'].status"
445519
]
446520
},
447521
{
448522
"cell_type": "markdown",
449523
"metadata": {},
450524
"source": [
451-
"For an invalid instrument you should see: \n",
525+
"As you will note, for an invalid instrument we get: \n",
452526
"{'status': <StreamState.Closed: 1>, **'code': 'NotFound'**, 'message': '** The Record could not be found'} \n",
527+
"\n",
453528
"However, if you are not licensed for the instrument you would see something like: \n",
454529
"{'status': <StreamState.Closed: 1>, **'code': 'NotEntitled'**, 'message': 'A21: DACS User Profile denied access to vendor'} \n",
455-
"**NOTE**: Do not rely on the message text to remain unchanged, use the **code** value for any programmatic decision making."
530+
"**NOTE**: The exact wording of **message** can change over time - therefore,only use the **code** value for any programmatic decision making."
456531
]
457532
},
458533
{
@@ -464,7 +539,7 @@
464539
},
465540
{
466541
"cell_type": "code",
467-
"execution_count": null,
542+
"execution_count": 6,
468543
"metadata": {
469544
"pycharm": {
470545
"name": "#%%\n"

2.Content/2.2-Pricing/2.2.04-Pricing-Chain.ipynb

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,9 @@
100100
},
101101
{
102102
"cell_type": "code",
103-
"execution_count": 4,
103+
"execution_count": null,
104104
"metadata": {},
105-
"outputs": [
106-
{
107-
"data": {
108-
"text/plain": [
109-
"<StreamState.Closed: 1>"
110-
]
111-
},
112-
"execution_count": 4,
113-
"metadata": {},
114-
"output_type": "execute_result"
115-
}
116-
],
105+
"outputs": [],
117106
"source": [
118107
"ftse.open()"
119108
]
@@ -487,7 +476,7 @@
487476
"cell_type": "markdown",
488477
"metadata": {},
489478
"source": [
490-
"Once closed is called the Chain stops updating its internal cache of Constituents . The get_constituents function can still be called but it will always return the same values. "
479+
"Once close is called the Chain stops updating its internal cache of Constituents. The get_constituents function can still be called but it will always return the state of the chaing before the close was called. "
491480
]
492481
},
493482
{
@@ -515,7 +504,8 @@
515504
"cell_type": "markdown",
516505
"metadata": {},
517506
"source": [
518-
"If you are not planning to use the Chain over an extended period of time and just want to snap the current Constituents, you can open it without updates."
507+
"#### Snap the Chain constituents\n",
508+
"If you are not planning to use the Chain over an extended period of time and/or just want to snap the current Constituents, you can open it without updates."
519509
]
520510
},
521511
{
@@ -542,7 +532,8 @@
542532
"cell_type": "markdown",
543533
"metadata": {},
544534
"source": [
545-
"The Library will request the Chain and then close the stream once it has received a response from the server."
535+
"The Library will request the Chain and then close the stream once it has received a response from the server. \n",
536+
"You can then use the get_constituents function to access the consituent list as they were at the time of open() call."
546537
]
547538
},
548539
{
@@ -560,13 +551,6 @@
560551
"source": [
561552
"close_session()"
562553
]
563-
},
564-
{
565-
"cell_type": "code",
566-
"execution_count": null,
567-
"metadata": {},
568-
"outputs": [],
569-
"source": []
570554
}
571555
],
572556
"metadata": {

0 commit comments

Comments
 (0)