|
8 | 8 | "# Refinitiv Data Library for Python\n", |
9 | 9 | "## Define and Open a session\n", |
10 | 10 | "\n", |
11 | | - "Depending on the Credentials and Refinitiv Products/Services you have access to, you need define & open either a PlatformSession or DesktopSession: \n", |
| 11 | + "Depending on the Credentials and Refinitiv Products/Services you have access to, you need define & open either a Platform Session or Desktop Session: \n", |
12 | 12 | "\n", |
13 | | - " - **PlatformSession:** Used to connect to the Refinitiv Data Platform (RDP) directly or via a local (deployed) Real-time Distribution System(RTDS). The PlatformSession requires RDP credentials (machine account) or connection details of your local platform (IP of the local server and DACS user name).\n", |
| 13 | + " - **Platform Session:** Used to connect to the Refinitiv Data Platform (RDP) directly or via a local (deployed) Real-time Distribution System(RTDS). The PlatformSession requires RDP credentials (machine account) or connection details of your local platform (IP of the local server and DACS user name).\n", |
14 | 14 | " - When the PlatformSession is used with RDP credentials only, it retrieves both streaming data and non-streaming data from the Refinitiv Data Platform.\n", |
15 | 15 | " - When the PlatformSession is used with connection details of your local deployed platform, it retrieves streaming data only from your local platform. \n", |
16 | 16 | " \n", |
17 | 17 | " \n", |
18 | | - " - **DesktopSession:** This type of session is used to connect RDP either via Eikon or via the Refinitiv Workspace. Eikon or the Refinitiv Workspace must be run **on the same PC** as your Python code.\n", |
| 18 | + " - **Desktop Session:** This type of session is used to connect RDP either via Eikon or via the Refinitiv Workspace. Eikon or the Refinitiv Workspace must be run **on the same PC** as your Python code.\n", |
19 | 19 | " \n", |
20 | 20 | "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." |
21 | 21 | ] |
|
25 | 25 | "id": "c77f2e4c-c19f-4a6c-ac1e-31d1678a28b4", |
26 | 26 | "metadata": {}, |
27 | 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", |
| 28 | + "## Set the location of the configuration file\n", |
| 29 | + "For ease of use, you can set various initialization parameters of the RD Library in the **_refinitiv-data.config.json_** configuration file - as detailed in the next section below.\n", |
30 | 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", |
| 31 | + "Typically you may place this file in the same folder as your Notebook or Python script.\n", |
| 32 | + "Alternatively, you can place the file in an folder of your choice and specify the location using the _RD_LIB_CONFIG_PATH_ environment variable. \n", |
33 | 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." |
| 34 | + "As these tutorial Notebooks are in Categorised sub-folders and to avoid the need for multiple config files (in each sub-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.\n", |
| 35 | + "\n", |
| 36 | + "Before proceeding, please **ensure you have entered your credentials** into the config file in the ***Configuration*** folder." |
35 | 37 | ] |
36 | 38 | }, |
37 | 39 | { |
38 | 40 | "cell_type": "code", |
39 | | - "execution_count": 1, |
| 41 | + "execution_count": null, |
40 | 42 | "id": "4c9f9a18-4960-43bf-aeeb-9a60ce748084", |
41 | 43 | "metadata": {}, |
42 | 44 | "outputs": [], |
43 | 45 | "source": [ |
44 | 46 | "import os\n", |
45 | | - "os.environ[\"RD_LIB_CONFIG_PATH\"] = \"../../../Configuration\"" |
| 47 | + "os.environ[\"RD_LIB_CONFIG_PATH\"] = \"../Configuration\"" |
46 | 48 | ] |
47 | 49 | }, |
48 | 50 | { |
|
69 | 71 | "metadata": {}, |
70 | 72 | "source": [ |
71 | 73 | "## Using the 'refinitiv-data.config.json' file\n", |
72 | | - "The Refinitiv data library config file has a default name of **'refinitiv-data.config.json'** allows you to specify session related parameters such as:\n", |
73 | | - "* the default session to use\n", |
74 | | - "* credentials\n", |
75 | | - "* connectivity parameters \n", |
76 | | - "\n", |
77 | | - "for the various session types. \n", |
| 74 | + "Using the Refinitiv data library config file allows you to specify various parameters such as:\n", |
| 75 | + "* Default session\n", |
| 76 | + "* Credentials\n", |
| 77 | + "* Connectivity parameters \n", |
| 78 | + "* Logging related: \n", |
| 79 | + " - Enable or Disable console/file logging\n", |
| 80 | + " - Log Level\n", |
| 81 | + " - Filename\n", |
78 | 82 | "\n", |
79 | 83 | "### Easiest way to Create & Open a Session\n", |
80 | 84 | "\n", |
81 | | - "Using the config file, where possible, provides the simplest approach to creating and opening sessions. \n", |
| 85 | + "Using the above json config file, where possible, provides the simplest approach to creating and opening sessions. \n", |
82 | 86 | "For example, assuming you have \n", |
83 | | - "* a '*refinitiv-data.config.json*' in the current working directory \n", |
| 87 | + "* a '*refinitiv-data.config.json*' in the ***Configuration*** directory \n", |
| 88 | + "* **populated the file with your credentials**\n", |
84 | 89 | "* and specified a 'default' session in the config file \n", |
85 | 90 | "\n", |
86 | 91 | "you can create and open the default session as follows:" |
|
121 | 126 | "metadata": {}, |
122 | 127 | "outputs": [], |
123 | 128 | "source": [ |
124 | | - "rd.open_session(name='platform.deployed')" |
| 129 | + "rd.open_session(name='platform.rdp')" |
125 | 130 | ] |
126 | 131 | }, |
127 | 132 | { |
128 | 133 | "cell_type": "markdown", |
129 | 134 | "id": "6917355d-c1f3-4df8-a5d5-368e7dea0d02", |
130 | 135 | "metadata": {}, |
131 | 136 | "source": [ |
132 | | - "The above would open a session based on the parameters specified in the '*\"platform.deployed\"* section of the json file." |
| 137 | + "The above would open a session based on the parameters specified in the '*\"platform.rdp\"* section of the json file." |
133 | 138 | ] |
134 | 139 | }, |
135 | 140 | { |
|
139 | 144 | "source": [ |
140 | 145 | "#### Open a session defined in a custom configuration file \n", |
141 | 146 | "As well as the default config filename of **'refinitiv-data.config.json'**, you can also use a custom file to specify the config. \n", |
142 | | - "The following call opens the default session as defined in your custom configuration file - with the filename passed as a parameter." |
| 147 | + "The following call opens the default session as defined in a custom configuration file - with the filename passed as a parameter." |
143 | 148 | ] |
144 | 149 | }, |
145 | 150 | { |
|
149 | 154 | "metadata": {}, |
150 | 155 | "outputs": [], |
151 | 156 | "source": [ |
152 | | - "rd.open_session(config_name=\"../Configuration/refinitiv-data.config.json\")" |
| 157 | + "rd.open_session(config_name=\"../Configuration/refinitiv-data.custom.config.json\")" |
153 | 158 | ] |
154 | 159 | }, |
155 | 160 | { |
|
158 | 163 | "metadata": {}, |
159 | 164 | "source": [ |
160 | 165 | "<br> \n", |
161 | | - "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", |
| 166 | + "Alternatively, if you do not wish to use a refinitiv-data config file, you can define sessions by specifying the parameters and session type explicitly - as shown below.\n", |
162 | 167 | "\n", |
163 | 168 | "## Define the session using your own credentials store\n", |
164 | 169 | "Sessions can be created by explicitly passing in your credentials/connectivity parameters.\n", |
|
169 | 174 | { |
170 | 175 | "cell_type": "code", |
171 | 176 | "execution_count": null, |
172 | | - "id": "af7ee821-4413-4754-9f38-c3a22725a962", |
| 177 | + "id": "3a5a7542-833e-421f-b5f3-a7d54701e169", |
173 | 178 | "metadata": {}, |
174 | 179 | "outputs": [], |
175 | 180 | "source": [ |
|
180 | 185 | "REALTIME_DISTRIBUTION_SERVICE_USER_NAME = 'YOUR_USER_NAME_ON_YOUR_RTDS_HOST' " |
181 | 186 | ] |
182 | 187 | }, |
| 188 | + { |
| 189 | + "cell_type": "markdown", |
| 190 | + "id": "3b0f1e3f-c16f-4618-87be-ee422b7a50e1", |
| 191 | + "metadata": {}, |
| 192 | + "source": [ |
| 193 | + "\n", |
| 194 | + "However, if you choose not use the refinitiv-data config file - rather than hardcoding parameters in your code, you may prefer to keep your credentials in a .env file (or some other external store) - to avoid accidentally exposing your credentials when sharing code. \n", |
| 195 | + "A empty .env file has been included in this ***Quick Start*** folder.\n" |
| 196 | + ] |
| 197 | + }, |
| 198 | + { |
| 199 | + "cell_type": "code", |
| 200 | + "execution_count": null, |
| 201 | + "id": "6685af34-58f9-4cff-85b6-c646a83a0595", |
| 202 | + "metadata": {}, |
| 203 | + "outputs": [], |
| 204 | + "source": [ |
| 205 | + "# OR \n", |
| 206 | + "# Load credentials from a .env file (+ override any OS system env vars of the same name)\n", |
| 207 | + "from dotenv import load_dotenv\n", |
| 208 | + "# change the path to the location of your .env file\n", |
| 209 | + "load_dotenv(dotenv_path='c:/Refinitiv/.env',override=True)\n", |
| 210 | + "APP_KEY = os.getenv('APP_KEY') # As created using the AppKey generator\n", |
| 211 | + "RDP_LOGIN = os.getenv('RDP_LOGIN') # e.g. 'GE-A-01234567-8-9101'\n", |
| 212 | + "RDP_PASSWORD = os.getenv('RDP_PASSWORD') # the long password set via the link in the Machine Account Welcome Email\n", |
| 213 | + "REALTIME_DISTRIBUTION_SERVICE_HOST = os.getenv('DEPLOYED_PLATFORM_HOST') # ADS hostname:PORT or IP:PORT e.g. 'myADS:15000'\n", |
| 214 | + "REALTIME_DISTRIBUTION_SERVICE_USER_NAME = os.getenv('DEPLOYED_PLATFORM_USER_NAME') # Your DACS User name" |
| 215 | + ] |
| 216 | + }, |
183 | 217 | { |
184 | 218 | "cell_type": "markdown", |
185 | 219 | "id": "54ce2f53", |
|
0 commit comments