Skip to content

Commit e244b38

Browse files
committed
Update 1.0 - Sessions.ipynb
1 parent 27e8003 commit e244b38

File tree

1 file changed

+53
-28
lines changed

1 file changed

+53
-28
lines changed

1. Quick Start/1.0 - Sessions.ipynb

Lines changed: 53 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,31 @@
2020
"You will also require an App Key that uniquely identifies your application. Please refer to the Refinitiv Data Libraries Quick Start guide's **Access Credentials** section for instructions on creating an App Key."
2121
]
2222
},
23+
{
24+
"cell_type": "markdown",
25+
"id": "c77f2e4c-c19f-4a6c-ac1e-31d1678a28b4",
26+
"metadata": {},
27+
"source": [
28+
"## Set the configuration file location\n",
29+
"For ease of use, we offer the option of setting various initialization parameters of the Refinitiv Data Library in the _refinitiv-data.config.json_ configuration file. \n",
30+
"\n",
31+
"Typically you would place this file in the same folder as your Notebook or Python script.\n",
32+
"Alternatively, you can place the file in an alternative folder as specified using the _RD_LIB_CONFIG_PATH_ environment variable. \n",
33+
"\n",
34+
"As these tutorial Notebooks are in Categorised sub-folders and to avoid the need for multiple config files (in each folder), we will use the _RD_LIB_CONFIG_PATH_ environment variable to point to a single instance of the config file in the top-level ***Configuration*** folder."
35+
]
36+
},
37+
{
38+
"cell_type": "code",
39+
"execution_count": 1,
40+
"id": "4c9f9a18-4960-43bf-aeeb-9a60ce748084",
41+
"metadata": {},
42+
"outputs": [],
43+
"source": [
44+
"import os\n",
45+
"os.environ[\"RD_LIB_CONFIG_PATH\"] = \"../../../Configuration\""
46+
]
47+
},
2348
{
2449
"cell_type": "markdown",
2550
"id": "560d68d9",
@@ -30,7 +55,7 @@
3055
},
3156
{
3257
"cell_type": "code",
33-
"execution_count": 1,
58+
"execution_count": null,
3459
"id": "e801bb0e",
3560
"metadata": {},
3661
"outputs": [],
@@ -50,8 +75,15 @@
5075
"* connectivity parameters \n",
5176
"\n",
5277
"for the various session types. \n",
78+
"\n",
79+
"### Easiest way to Create & Open a Session\n",
80+
"\n",
5381
"Using the config file, where possible, provides the simplest approach to creating and opening sessions. \n",
54-
"For example, assuming you have specified a 'default' session in the config file, you can create and open the default session as follows:"
82+
"For example, assuming you have \n",
83+
"* a '*refinitiv-data.config.json*' in the current working directory \n",
84+
"* and specified a 'default' session in the config file \n",
85+
"\n",
86+
"you can create and open the default session as follows:"
5587
]
5688
},
5789
{
@@ -89,7 +121,7 @@
89121
"metadata": {},
90122
"outputs": [],
91123
"source": [
92-
"rd.open_session(name = 'platform.deployed')"
124+
"rd.open_session(name='platform.deployed')"
93125
]
94126
},
95127
{
@@ -117,7 +149,7 @@
117149
"metadata": {},
118150
"outputs": [],
119151
"source": [
120-
"rd.open_session(config_name=\"refinitiv-data.custom.config.json\")"
152+
"rd.open_session(config_name=\"../Configuration/refinitiv-data.config.json\")"
121153
]
122154
},
123155
{
@@ -128,10 +160,10 @@
128160
"<br> \n",
129161
"Alternatively, if you do not wish to use the refinitiv-data config file, you can define sessions by specifying the parameters and session type explicitly - as shown below.\n",
130162
"\n",
131-
"## Define the session of your choice\n",
132-
"The following example calls use credentials/connectivity parameters as defined in the **Configuration//credentials.ipynb** file. \n",
133-
"\n",
134-
"Please edit **Configuration/credentials.ipynb** to set your credentials and run the next cell before continuing"
163+
"## Define the session using your own credentials store\n",
164+
"Sessions can be created by explicitly passing in your credentials/connectivity parameters.\n",
165+
"For example, the following calls use credentials/connectivity parameters defined inthe cell below.\n",
166+
"Please edit the following cell to set your credentials and execute, before continuing."
135167
]
136168
},
137169
{
@@ -141,7 +173,11 @@
141173
"metadata": {},
142174
"outputs": [],
143175
"source": [
144-
"%run ../Configuration/credentials.ipynb"
176+
"APP_KEY = 'YOUR_APP_KEY'\n",
177+
"RDP_LOGIN = 'YOUR_REFINITIV_DATA_PLATFORM_LOGIN'\n",
178+
"RDP_PASSWORD = 'YOUR_REFINITIV_DATA_PLATFORM_PASSWORD'\n",
179+
"REALTIME_DISTRIBUTION_SERVICE_HOST = 'THE_HOST:PORT_OF_YOUR_RTDS_HOST' \n",
180+
"REALTIME_DISTRIBUTION_SERVICE_USER_NAME = 'YOUR_USER_NAME_ON_YOUR_RTDS_HOST' "
145181
]
146182
},
147183
{
@@ -156,7 +192,7 @@
156192
},
157193
{
158194
"cell_type": "code",
159-
"execution_count": 2,
195+
"execution_count": null,
160196
"id": "51fad442",
161197
"metadata": {},
162198
"outputs": [],
@@ -207,8 +243,8 @@
207243
"source": [
208244
"session = rd.session.platform.Definition(\n",
209245
" app_key = APP_KEY, \n",
210-
" deployed_platform_host = DEPLOYED_PLATFORM_HOST,\n",
211-
" deployed_platform_username = DEPLOYED_PLATFORM_USER_NAME\n",
246+
" deployed_platform_host = REALTIME_DISTRIBUTION_SERVICE_HOST,\n",
247+
" deployed_platform_username = REALTIME_DISTRIBUTION_SERVICE_USER_NAME\n",
212248
").get_session()"
213249
]
214250
},
@@ -237,8 +273,8 @@
237273
" username = RDP_LOGIN, \n",
238274
" password = RDP_PASSWORD\n",
239275
" ),\n",
240-
" deployed_platform_host = DEPLOYED_PLATFORM_HOST,\n",
241-
" deployed_platform_username = DEPLOYED_PLATFORM_USER_NAME\n",
276+
" deployed_platform_host = REALTIME_DISTRIBUTION_SERVICE_HOST,\n",
277+
" deployed_platform_username = REALTIME_DISTRIBUTION_SERVICE_USER_NAME\n",
242278
").get_session()"
243279
]
244280
},
@@ -293,21 +329,10 @@
293329
},
294330
{
295331
"cell_type": "code",
296-
"execution_count": 4,
332+
"execution_count": null,
297333
"id": "f628d577",
298334
"metadata": {},
299-
"outputs": [
300-
{
301-
"data": {
302-
"text/plain": [
303-
"<SessionState.Closed: 1>"
304-
]
305-
},
306-
"execution_count": 4,
307-
"metadata": {},
308-
"output_type": "execute_result"
309-
}
310-
],
335+
"outputs": [],
311336
"source": [
312337
"session.close()"
313338
]
@@ -358,7 +383,7 @@
358383
},
359384
{
360385
"cell_type": "code",
361-
"execution_count": 6,
386+
"execution_count": null,
362387
"id": "f2bfad89-53d1-4e22-9903-3eba81159252",
363388
"metadata": {},
364389
"outputs": [],

0 commit comments

Comments
 (0)