Last update | Nov 2023 |
Environment | Any |
Language | Any HTTP is supported |
Compilers | None |
Prerequisites | DSS login, internet access |
Source code | Below |
This tutorial explains how to:
Important note:
The legacy Timeseries Pricing extraction will be removed end February 2020, the more powerful Price History extraction replaces it. This tutorial, and the Postman collection, were updated in May 2019 to reflect this. If you are using the Timeseries Pricing call, you must modify your code. Migrating has a benefit, as the Price History extraction has higher limits, and runs faster than the Timeseries Pricing extraction. As part of the migration process, it is important to understand that, in some instances, field content extracted from the Timeseries Pricing report will be available under different field names in the Price History report. It is also possible that some previously populated values in the Timeseries Pricing report will be blank in the Price History report. This is due to data mapping changes. For more information, please refer to the Product Change Notification PCN 10897.
If you do not know what field lists are available, you can request a list of those available.
The report template type must be specified in the path. As we want price history data we set a value of PriceHistory. The preceding and following tutorials show other possibilities.
Note: for all requests we need a user token. This was retrieved in Tutorial 1.
URL:
https://selectapi.datascope.refinitiv.com/RestApi/v1/Extractions/GetValidContentFieldTypes(ReportTemplateType=DataScope.Select.Api.Extractions.ReportTemplates.ReportTemplateTypes'PriceHistory')
Method: GET
Headers:
Prefer: respond-async
Authorization: Token F0ABE9A3FFF2E02E10AE2765ED872C59B8CC3B40EBB61B30E295E71DE31C254B8648DB9434C2DF9299FDC668AA123501F322D99D45C8B93438063C912BC936C7B87062B0CF812138863F5D836A7B31A32DCA67EF07B3B50B2FC4978DF6F76784FDF35FCB523A8430DA93613BC5730CDC310D4D241718F9FC3F2E55465A24957CC287BDEC79046B31AD642606275AEAD76318CB221BD843348E1483670DA13968D8A242AAFCF9E13E23240C905AE46DED9EDCA9BB316B4C5C767B18DB2EA7ADD100817ADF059D01394BC6375BECAF6138C25DBA57577F0061
Content-Type: application/json; charset=utf-8
Body:
There are more than 100 values in the response. Here is the beginning of the response:
{
"@odata.context": "https://selectapi.datascope.refinitiv.com/RestApi/v1/$metadata#ContentFieldTypes",
"value": [
{
"Code": "ET2.7 Day Compound Yield",
"Name": "7 Day Compound Yield",
"Description": "Instrument's calculated 7-day yield that assumes coupon payments are invested at the current market interest rate at the time of receipt and held until maturity.",
"FormatType": "Number",
"FieldGroup": " "
},
{
"Code": "ET2.7 Day Yield",
"Name": "7 Day Yield",
"Description": "Instrument's calculated 7-day yield, including the day on which the figure is reported, as supplied by NASDAQ.",
"FormatType": "Number",
"FieldGroup": " "
},
{
"Code": "ET2.Accrued Interest",
"Name": "Accrued Interest",
"Description": "Interest which has accumulated on a security since payment.",
"FormatType": "Number",
"FieldGroup": " "
},
{
"Code": "ET2.Accumulated Volume Basket",
"Name": "Accumulated Volume Basket",
"Description": "Accumulated volume of basket trading.",
"FormatType": "Number",
"FieldGroup": " "
},
{
"Code": "ET2.Accumulated Volume Unscaled",
"Name": "Accumulated Volume Unscaled",
"Description": "Unscaled accumulated number of shares, lots or contracts traded according to the market convention.",
"FormatType": "Number",
"FieldGroup": " "
},
This goes on with all the other available fields. Here is the last part:
{
"Code": "ET2.Z Spread",
"Name": "Z Spread",
"Description": "Difference in basis points required to make the bond perform to par.",
"FormatType": "Number",
"FieldGroup": " "
},
{
"Code": "ET2.Zero Yield",
"Name": "Zero Yield",
"Description": "yield value for a zero coupon interest rate against time to maturity.",
"FormatType": "Number",
"FieldGroup": " "
},
{
"Code": "ET2.ZPage",
"Name": "ZPage",
"Description": "Unique system-assigned four-digit alphanumeric identifier for Eurobonds.",
"FormatType": "Text",
"FieldGroup": " "
}
]
}
The result contains the field code, name, a description, field type (number, text, date) and group. Use this to choose the field names you want. In the next step we will make a request for data, using some data fields we chose.
This is similar to the previous tutorials, as it is also an On Demand extraction request.
The body of the request must mention it is an extraction request. It contains several parts:
Note: for all requests we need to include a user token in the header of our request. This was retrieved in Tutorial 1.
URL:
https://selectapi.datascope.refinitiv.com/RestApi/v1/Extractions/ExtractWithNotes
Method: POST
Headers:
Prefer: respond-async
Content-Type: application/json
Authorization: Token F0ABE9A3FFF2E02E10AE2765ED872C59B8CC3B40EBB61B30E295E71DE31C254B8648DB9434C2DF9299FDC668AA123501F322D99D45C8B93438063C912BC936C7B87062B0CF812138863F5D836A7B31A32DCA67EF07B3B50B2FC4978DF6F76784FDF35FCB523A8430DA93613BC5730CDC310D4D241718F9FC3F2E55465A24957CC287BDEC79046B31AD642606275AEAD76318CB221BD843348E1483670DA13968D8A242AAFCF9E13E23240C905AE46DED9EDCA9BB316B4C5C767B18DB2EA7ADD100817ADF059D01394BC6375BECAF6138C25DBA57577F0061
Body:
{
"ExtractionRequest": {
"@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.PriceHistoryExtractionRequest",
"ContentFieldNames": [
"File Code",
"RIC",
"Trade Date",
"Last Trade Price",
"Universal Close Price",
"Alternate Close Price",
"High Price",
"Low Price",
"Open Price",
"Volume Weighted Average Price",
"Turnover",
"Volume",
"Accumulated Volume Unscaled",
"Bid Price",
"Asset Type",
"Quote ID",
"Bid Yield",
"Exchange Code",
"Currency Code"
],
"IdentifierList": {
"@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
"InstrumentIdentifiers": [
{ "Identifier": "438516AC0", "IdentifierType": "Cusip" },
{ "Identifier": "ALVG.DE", "IdentifierType": "Ric" },
{ "Identifier": "IBM.N", "IdentifierType": "Ric" }
]
},
"Condition": {
"AdjustedPrices": true,
"QueryStartDate": "2006-05-24T00:00:00.000Z",
"QueryEndDate": "2006-05-31T00:00:00.000Z"
}
}
}
By default, historical instruments (i.e. those that are no longer quoted, for instance RIC RTR.L) will be ignored, and return a "Not found" error.
The setting to allow historical instruments can be set in the GUI preferences screen, but that only applies to instruments imported into lists, that are then used in scheduled requests.
For on demand requests, if you want results for historical instruments, you need to specify that you allow them in the query itself, using parameter ValidationOptions:
"IdentifierList": {
"@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
"InstrumentIdentifiers": [
{ "Identifier": "438516AC0", "IdentifierType": "Cusip" },
{ "Identifier": "ALVG.DE", "IdentifierType": "Ric" },
{ "Identifier": "IBM.N", "IdentifierType": "Ric" }
],
"ValidationOptions": { "AllowHistoricalInstruments": true },
"UseUserPreferencesForValidationOptions": false
},
Content-Type: application/json; charset=utf-8
Body:
{
"@odata.context": "https://selectapi.datascope.refinitiv.com/RestApi/v1/$metadata#DataScope.Select.Api.Extractions.ExtractionRequests.ExtractionResult",
"Contents": [
{
"IdentifierType": "Cusip",
"Identifier": "438516AC0",
"File Code": null,
"RIC": null,
"Trade Date": "2006-05-24",
"Last Trade Price": 125.319,
"Universal Close Price": 125.53822,
"Alternate Close Price": null,
"High Price": null,
"Low Price": null,
"Open Price": null,
"Volume Weighted Average Price": null,
"Turnover": null,
"Volume": null,
"Accumulated Volume Unscaled": null,
"Bid Price": 125.53822,
"Asset Type": "CORP",
"Quote ID": "0x000405000002c5c6",
"Bid Yield": 6.058,
"Exchange Code": "EJV",
"Currency Code": "USD"
},
{
"IdentifierType": "Cusip",
"Identifier": "438516AC0",
"File Code": null,
"RIC": null,
"Trade Date": "2006-05-25",
"Last Trade Price": 125.185,
"Universal Close Price": 125.18459,
"Alternate Close Price": null,
"High Price": null,
"Low Price": null,
"Open Price": null,
"Volume Weighted Average Price": null,
"Turnover": null,
"Volume": null,
"Accumulated Volume Unscaled": null,
"Bid Price": 125.18459,
"Asset Type": "CORP",
"Quote ID": "0x000405000002c5c6",
"Bid Yield": 6.096,
"Exchange Code": "EJV",
"Currency Code": "USD"
},
{
"IdentifierType": "Cusip",
"Identifier": "438516AC0",
"File Code": null,
"RIC": null,
"Trade Date": "2006-05-26",
"Last Trade Price": 125.397,
"Universal Close Price": 125.39704,
"Alternate Close Price": null,
"High Price": null,
"Low Price": null,
"Open Price": null,
"Volume Weighted Average Price": null,
"Turnover": null,
"Volume": null,
"Accumulated Volume Unscaled": null,
"Bid Price": 125.39704,
"Asset Type": "CORP",
"Quote ID": "0x000405000002c5c6",
"Bid Yield": 6.074,
"Exchange Code": "EJV",
"Currency Code": "USD"
},
{
"IdentifierType": "Cusip",
"Identifier": "438516AC0",
"File Code": null,
"RIC": null,
"Trade Date": "2006-05-30",
"Last Trade Price": 125.099,
"Universal Close Price": 125.0985,
"Alternate Close Price": null,
"High Price": null,
"Low Price": null,
"Open Price": null,
"Volume Weighted Average Price": null,
"Turnover": null,
"Volume": null,
"Accumulated Volume Unscaled": null,
"Bid Price": 125.0985,
"Asset Type": "CORP",
"Quote ID": "0x000405000002c5c6",
"Bid Yield": 6.108,
"Exchange Code": "EJV",
"Currency Code": "USD"
},
{
"IdentifierType": "Cusip",
"Identifier": "438516AC0",
"File Code": null,
"RIC": null,
"Trade Date": "2006-05-31",
"Last Trade Price": 124.841,
"Universal Close Price": 124.84088,
"Alternate Close Price": null,
"High Price": null,
"Low Price": null,
"Open Price": null,
"Volume Weighted Average Price": null,
"Turnover": null,
"Volume": null,
"Accumulated Volume Unscaled": null,
"Bid Price": 124.84088,
"Asset Type": "CORP",
"Quote ID": "0x000405000002c5c6",
"Bid Yield": 6.137,
"Exchange Code": "EJV",
"Currency Code": "USD"
},
{
"IdentifierType": "Ric",
"Identifier": "ALVG.DE",
"File Code": "62",
"RIC": "ALVG.DE",
"Trade Date": "2006-05-24",
"Last Trade Price": null,
"Universal Close Price": 119.8,
"Alternate Close Price": null,
"High Price": 122.49,
"Low Price": 118.88,
"Open Price": 122,
"Volume Weighted Average Price": 120.216,
"Turnover": 662040330,
"Volume": null,
"Accumulated Volume Unscaled": 5507087,
"Bid Price": 119.98,
"Asset Type": "EQTY",
"Quote ID": "0x0003dc004aeb7d03",
"Bid Yield": null,
"Exchange Code": "GER",
"Currency Code": "EUR"
},
{
"IdentifierType": "Ric",
"Identifier": "ALVG.DE",
"File Code": "62",
"RIC": "ALVG.DE",
"Trade Date": "2006-05-25",
"Last Trade Price": null,
"Universal Close Price": 121.54,
"Alternate Close Price": null,
"High Price": 121.54,
"Low Price": 118.26,
"Open Price": 120.3,
"Volume Weighted Average Price": 120.387,
"Turnover": 463782030,
"Volume": null,
"Accumulated Volume Unscaled": 3852434,
"Bid Price": 121.11,
"Asset Type": "EQTY",
"Quote ID": "0x0003dc004aeb7d03",
"Bid Yield": null,
"Exchange Code": "GER",
"Currency Code": "EUR"
},
{
"IdentifierType": "Ric",
"Identifier": "ALVG.DE",
"File Code": "62",
"RIC": "ALVG.DE",
"Trade Date": "2006-05-26",
"Last Trade Price": null,
"Universal Close Price": 123.01,
"Alternate Close Price": null,
"High Price": 123.3,
"Low Price": 121.1,
"Open Price": 122.42,
"Volume Weighted Average Price": 122.248,
"Turnover": 440984040,
"Volume": null,
"Accumulated Volume Unscaled": 3607296,
"Bid Price": 123.06,
"Asset Type": "EQTY",
"Quote ID": "0x0003dc004aeb7d03",
"Bid Yield": null,
"Exchange Code": "GER",
"Currency Code": "EUR"
},
{
"IdentifierType": "Ric",
"Identifier": "ALVG.DE",
"File Code": "62",
"RIC": "ALVG.DE",
"Trade Date": "2006-05-29",
"Last Trade Price": null,
"Universal Close Price": 122,
"Alternate Close Price": null,
"High Price": 122.88,
"Low Price": 121.5,
"Open Price": 122.4,
"Volume Weighted Average Price": 122.037,
"Turnover": 153837790,
"Volume": null,
"Accumulated Volume Unscaled": 1260579,
"Bid Price": 122.3,
"Asset Type": "EQTY",
"Quote ID": "0x0003dc004aeb7d03",
"Bid Yield": null,
"Exchange Code": "GER",
"Currency Code": "EUR"
},
{
"IdentifierType": "Ric",
"Identifier": "ALVG.DE",
"File Code": "62",
"RIC": "ALVG.DE",
"Trade Date": "2006-05-30",
"Last Trade Price": null,
"Universal Close Price": 118.44,
"Alternate Close Price": null,
"High Price": 122,
"Low Price": 117.42,
"Open Price": 121.95,
"Volume Weighted Average Price": 119.479,
"Turnover": 563870180,
"Volume": null,
"Accumulated Volume Unscaled": 4719395,
"Bid Price": 117.85,
"Asset Type": "EQTY",
"Quote ID": "0x0003dc004aeb7d03",
"Bid Yield": null,
"Exchange Code": "GER",
"Currency Code": "EUR"
},
{
"IdentifierType": "Ric",
"Identifier": "ALVG.DE",
"File Code": "62",
"RIC": "ALVG.DE",
"Trade Date": "2006-05-31",
"Last Trade Price": null,
"Universal Close Price": 121.4,
"Alternate Close Price": null,
"High Price": 121.49,
"Low Price": 115.52,
"Open Price": 116.21,
"Volume Weighted Average Price": 119.304,
"Turnover": 683155310,
"Volume": null,
"Accumulated Volume Unscaled": 5726174,
"Bid Price": 121.11,
"Asset Type": "EQTY",
"Quote ID": "0x0003dc004aeb7d03",
"Bid Yield": null,
"Exchange Code": "GER",
"Currency Code": "EUR"
},
{
"IdentifierType": "Ric",
"Identifier": "IBM.N",
"File Code": "77",
"RIC": "IBM.N",
"Trade Date": "2006-05-24",
"Last Trade Price": null,
"Universal Close Price": 76.202984,
"Alternate Close Price": null,
"High Price": 76.451327,
"Low Price": 75.515266,
"Open Price": 75.792263,
"Volume Weighted Average Price": 75.996095,
"Turnover": null,
"Volume": null,
"Accumulated Volume Unscaled": 5627000,
"Bid Price": 76.193432,
"Asset Type": "EQTY",
"Quote ID": "0x0003dc004a024fd8",
"Bid Yield": null,
"Exchange Code": "NYS",
"Currency Code": "USD"
},
{
"IdentifierType": "Ric",
"Identifier": "IBM.N",
"File Code": "77",
"RIC": "IBM.N",
"Trade Date": "2006-05-25",
"Last Trade Price": null,
"Universal Close Price": 76.546843,
"Alternate Close Price": null,
"High Price": 76.58505,
"Low Price": 76.088364,
"Open Price": 76.308052,
"Volume Weighted Average Price": 76.332122,
"Turnover": null,
"Volume": null,
"Accumulated Volume Unscaled": 3049700,
"Bid Price": 76.537291,
"Asset Type": "EQTY",
"Quote ID": "0x0003dc004a024fd8",
"Bid Yield": null,
"Exchange Code": "NYS",
"Currency Code": "USD"
},
{
"IdentifierType": "Ric",
"Identifier": "IBM.N",
"File Code": "77",
"RIC": "IBM.N",
"Trade Date": "2006-05-26",
"Last Trade Price": null,
"Universal Close Price": 77.129493,
"Alternate Close Price": null,
"High Price": 77.234561,
"Low Price": 76.126571,
"Open Price": 76.565946,
"Volume Weighted Average Price": 76.826515,
"Turnover": null,
"Volume": null,
"Accumulated Volume Unscaled": 2783200,
"Bid Price": 77.081735,
"Asset Type": "EQTY",
"Quote ID": "0x0003dc004a024fd8",
"Bid Yield": null,
"Exchange Code": "NYS",
"Currency Code": "USD"
},
{
"IdentifierType": "Ric",
"Identifier": "IBM.N",
"File Code": "77",
"RIC": "IBM.N",
"Trade Date": "2006-05-30",
"Last Trade Price": null,
"Universal Close Price": 76.565946,
"Alternate Close Price": null,
"High Price": 77.330077,
"Low Price": 76.556395,
"Open Price": 76.747427,
"Volume Weighted Average Price": 76.891371,
"Turnover": null,
"Volume": null,
"Accumulated Volume Unscaled": 3471000,
"Bid Price": 76.556395,
"Asset Type": "EQTY",
"Quote ID": "0x0003dc004a024fd8",
"Bid Yield": null,
"Exchange Code": "NYS",
"Currency Code": "USD"
},
{
"IdentifierType": "Ric",
"Identifier": "IBM.N",
"File Code": "77",
"RIC": "IBM.N",
"Trade Date": "2006-05-31",
"Last Trade Price": null,
"Universal Close Price": 76.317604,
"Alternate Close Price": null,
"High Price": 77.205906,
"Low Price": 76.040606,
"Open Price": 76.556395,
"Volume Weighted Average Price": 76.41398,
"Turnover": null,
"Volume": null,
"Accumulated Volume Unscaled": 4762200,
"Bid Price": 76.308052,
"Asset Type": "EQTY",
"Quote ID": "0x0003dc004a024fd8",
"Bid Yield": null,
"Exchange Code": "NYS",
"Currency Code": "USD"
}
],
"Notes": [
"Extraction Services Version 16.0.43633 (806c08a4ae8f), Built May 9 2022 17:21:07\r\nProcessing started at 05/30/2022 08:41:08.\r\nUser ID: 9008895\r\nExtraction ID: 2000000402711130\r\nCorrelation ID: CiD/9008895/AAAAAA.080832fb79bdf0a1/RA\r\nSchedule: 0x080832fb79cdf0a1 (ID = 0x0000000000000000)\r\nInput List (3 items): (ID = 0x080832fb79cdf0a1) Created: 05/30/2022 08:41:06 Last Modified: 05/30/2022 08:41:06\r\nReport Template (25 fields): _OnD_0x080832fb79cdf0a1 (ID = 0x080832fb79ddf0a1) Created: 05/30/2022 08:41:03 Last Modified: 05/30/2022 08:41:03\r\nSchedule dispatched via message queue (0x080832fb79cdf0a1)\r\nSchedule Time: 05/30/2022 08:41:04\r\nTimeseries Date Range: 05/24/2006 to 05/31/2006\r\nProcessing completed successfully at 05/30/2022 08:41:08, taking 2.013 Secs.\r\nExtraction finished at 05/30/2022 07:41:08 UTC, with servers: x01q16, ETS (0.2 secs), QSDHA1 (0.0 secs), QSHC11 (0.1 secs)\r\nUsage Summary for User 9008895, Client 65508, Template Type Price History\r\nBase Usage\r\n Instrument Instrument Terms Price\r\n Count Type Subtype Source Source\r\n------- ----------------------------------- ---------------------------- -------------- ----------------------------------------\r\n 1 Corporate N/A N/A\r\n 2 Equities N/A N/A\r\n-------\r\n 3 Total instruments charged.\r\n 0 Instruments with no reported data.\r\n=======\r\n 3 Instruments in the input list.\r\nNo Evaluated Pricing Service complex usage to report -- 3 Instruments in the input list had no reported data.\r\nWriting RIC maintenance report.\r\n",
"Identifier,IdentType,Source,RIC,RecordDate,MaintType,OldValue,NewValue,Factor,FactorType\r\n"
]
}
Note: returned results will not necessarily include data for all dates you requested, it could be missing on some days, and this could vary depending on the instrument. Possible reasons:
In the example above, for the 29th May 2006 there is a returned record for the american bond and german stock, but none for the UK stock. This special case is due to the fact that the 29th May 2006 was Spring Bank holiday in the UK, the LSE was not trading but other venues were.