DataScope Select - REST API

Close Menu
Expand All Collapse All
Introductory Tutorials Tutorials Introduction Programming without SDK Tutorial REST API Tutorials REST API Tutorials Introduction REST API Tutorial 1: Connecting to the DSS server REST API Tutorial 2: On Demand End of Day Extraction REST API Tutorial 3: On Demand intraday extraction, embargo REST API Tutorial 4: On Demand price history extraction REST API Tutorial 5: On Demand corporate actions extraction REST API Tutorial 6: On Demand ownership data extraction REST API Tutorial 7: On Demand T&C extraction REST API Tutorial 8: On Demand composite extraction REST API Tutorial 9: On Demand extraction: instrument list REST API Tutorial 10: GUI control calls: immediate extract REST API Tutorial 11: Search by Instrument REST API Tutorial 12: Search for an Equity REST API Tutorial 13: Search for a Future or Option REST API Tutorial 14: On Demand price history extraction raw .Net SDK Tutorials .Net SDK Tutorial 1: Connecting to the DSS server .Net SDK Tutorial 2: GUI control calls: List, report, sched .Net SDK Tutorial 3: GUI control calls: Validate, extraction .Net SDK Tutorial 4: GUI control calls: Embargo, note files .Net SDK Tutorial 5: On Demand: EoD extraction .Net SDK Tutorial 6: On Demand: EoD extraction, file I/O .Net SDK Tutorial 7: On Demand: large instrument lists .Net SDK Tutorial 8: On Demand: Terms & Conditions .Net SDK Tutorial 9: On Demand: Composite extraction .Net SDK Tutorial 10: Search by Instrument .Net SDK Tutorial 11: Search for Equity .Net SDK Tutorial 12: Search for Future or Option

REST API Tutorial 3: On Demand intraday extraction, embargo

Last update November 2019
Environment Any
Language Any HTTP is supported
Compilers None
Prerequisites DSS login, internet access
Source code Below

Tutorial purpose

This tutorial explains how to:

  • Retrieve the available field list from the DSS server. This is only required if you do not know the exact names of the data fields you want to retrieve.
  • Retrieve intraday data from the DSS server, using an on demand request. Intraday data is data from the current day.
  • Handle embargoes on intraday datai.e. when you are not permissioned for intraday data. Embargoes are a complex topic. To understand embargoes, and how DSS handles them, study the entire .Net SDK Tutorial 4, in particular (but not only) this section.

 

Table of contents

 

Get available field list for intraday - HTTP request

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 intraday data we set a value of IntradayPricing. The preceding and following tutorials show other possibilities.

See here for more information on report templates and corresponding field lists.

Note: for all requests we need a user token. This was retrieved in Tutorial 1.

URL:               

https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/GetValidContentFieldTypes(ReportTemplateType=ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ReportTemplateTypes'IntradayPricing')

Method:          GET

Headers:

Prefer: respond-async
Authorization: Token F0ABE9A3FFF2E02E10AE2765ED872C59B8CC3B40EBB61B30E295E71DE31C254B8648DB9434C2DF9299FDC668AA123501F322D99D45C8B93438063C912BC936C7B87062B0CF812138863F5D836A7B31A32DCA67EF07B3B50B2FC4978DF6F76784FDF35FCB523A8430DA93613BC5730CDC310D4D241718F9FC3F2E55465A24957CC287BDEC79046B31AD642606275AEAD76318CB221BD843348E1483670DA13968D8A242AAFCF9E13E23240C905AE46DED9EDCA9BB316B4C5C767B18DB2EA7ADD100817ADF059D01394BC6375BECAF6138C25DBA57577F0061

 

Get available field list for intraday - HTTP response

If the token is valid, this is the response we get:

Status:                        200 OK

Relevant headers:

Content-Type: application/json; charset=utf-8

Body:

There are more than 500 values in the response. Here is the beginning of the response:

{
  "@odata.context": "https://hosted.datascopeapi.reuters.com/RestApi/v1/$metadata#ContentFieldTypes",
  "value": [
    {
      "Code": "IDP.30-Day Implied Volatility - Call",
      "Name": "30-Day Implied Volatility - Call",
      "Description": "Volatility implied by the market price of a call option contract based on a theoretical pricing model on a 60 days period",
      "FormatType": "Number",
      "FieldGroup": " "
    },
    {
      "Code": "IDP.30-Day Implied Volatility - Put",
      "Name": "30-Day Implied Volatility - Put",
      "Description": "Volatility implied by the market price of a put option contract based on a theoretical pricing model on a 60 days period",
      "FormatType": "Number",
      "FieldGroup": " "
    },
    {
      "Code": "IDP.60-Day Implied Volatility - Call",
      "Name": "60-Day Implied Volatility - Call",
      "Description": "Volatility implied by the market price of a call option contract based on a theoretical pricing model on a 60 days period",
      "FormatType": "Number",
      "FieldGroup": " "
    },
    {
      "Code": "IDP.60-Day Implied Volatility - Put",
      "Name": "60-Day Implied Volatility - Put",
      "Description": "Volatility implied by the market price of a put option contract based on a theoretical pricing model on a 60 days period",
      "FormatType": "Number",
      "FieldGroup": " "
    },
    {
      "Code": "IDP.90-Day Implied Volatility - Call",
      "Name": "90-Day Implied Volatility - Call",
      "Description": "Volatility implied by the market price of a call option contract based on a theoretical pricing model on a 90 days period",
      "FormatType": "Number",
      "FieldGroup": " "
    },

This goes on with all the other available fields. Here is the last part:

    {
      "Code": "IDP.Yield Net Change",
      "Name": "Yield Net Change",
      "Description": "Net change of the current real-time yield from the historic closing yield",
      "FormatType": "Number",
      "FieldGroup": " "
    },
    {
      "Code": "IDP.Yield to Maturity",
      "Name": "Yield to Maturity",
      "Description": "Yield taking into account the price discount or premium over face value",
      "FormatType": "Number",
      "FieldGroup": " "
    },
    {
      "Code": "IDP.Z Spread",
      "Name": "Z Spread",
      "Description": "Constant spread in basis points that will make the price equal to the present value of the cash flows when added to each relevant point of the yield curve",
      "FormatType": "Number",
      "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.

 

Get intraday data - HTTP request

Like the previous tutorial, this is an On Demand extraction request. The path is the same, and the body of the request follows the same structure.

The body of the request must mention it is an extraction request. It contains several parts:

  • The type of extraction: as we want intraday data we set a value of IntradayPricingExtractionRequest. The preceding and following tutorials show other possibilities.
  • The list of field names: these were determined in the previous step of this tutorial.
  • The list of instrument identifiers, each one with its type. Similar to the previous tutorial, below we define one instrument using a CUSIP code and another one using a RIC.
  • The conditions: in this example we select ScalableCurrency.

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://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ExtractWithNotes

Method:          POST

Headers:

Prefer: respond-async
Content-Type: application/json
Authorization: Token F0ABE9A3FFF2E02E10AE2765ED872C59B8CC3B40EBB61B30E295E71DE31C254B8648DB9434C2DF9299FDC668AA123501F322D99D45C8B93438063C912BC936C7B87062B0CF812138863F5D836A7B31A32DCA67EF07B3B50B2FC4978DF6F76784FDF35FCB523A8430DA93613BC5730CDC310D4D241718F9FC3F2E55465A24957CC287BDEC79046B31AD642606275AEAD76318CB221BD843348E1483670DA13968D8A242AAFCF9E13E23240C905AE46DED9EDCA9BB316B4C5C767B18DB2EA7ADD100817ADF059D01394BC6375BECAF6138C25DBA57577F0061

Body:

{
  "ExtractionRequest": {
    "@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.IntradayPricingExtractionRequest",
    "ContentFieldNames": [
      "RIC",
      "Ask Price",
      "Asset Type",
      "Bid Price",
      "Currency Code",
      "Exchange Code",
      "High Price",
      "Instrument ID",
      "Instrument ID Type",
      "Low Price",
      "Open Price",
      "Previous Close Date",
      "Previous Close Price",
      "Security Description",
      "Settlement Price",
      "Trade Date",
      "User Defined Identifier",
      "Volume"
    ],
    "IdentifierList": {
      "@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",  
      "InstrumentIdentifiers": [
      	{ "Identifier": "438516AC0", "IdentifierType": "Cusip" },
      	{ "Identifier": "IBM.N", "IdentifierType": "Ric" }
      ]
    },
    "Condition": { "ScalableCurrency": true }
  }
}

 

Get intraday data - HTTP response

No embargo

If the token is valid, if there is no timeout, and we are permissioned for intraday data for all instrument identifiers in the list, the data will be delivered.

This is the response we get:

Status:                        200 OK

Relevant headers:

Content-Type: application/json; charset=utf-8

Body:

{
  "@odata.context": "https://hosted.datascopeapi.reuters.com/RestApi/v1/$metadata#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.ExtractionResult",
  "Contents": [
    {
      "IdentifierType": "Cusip",
      "Identifier": "438516AC0",
      "RIC": null,
      "Ask Price": null,
      "Asset Type": "CORP",
      "Bid Price": null,
      "Currency Code": "USD",
      "Exchange Code": "CPN",
      "High Price": null,
      "Instrument ID": "438516AC0",
      "Instrument ID Type": "CSP",
      "Low Price": null,
      "Open Price": null,
      "Previous Close Date": null,
      "Previous Close Price": null,
      "Security Description": "HON  9.500 06/01/16 MATd",
      "Settlement Price": null,
      "Trade Date": null,
      "Volume": null
    },
    {
      "IdentifierType": "Ric",
      "Identifier": "IBM.N",
      "RIC": "IBM.N",
      "Ask Price": 134.78,
      "Asset Type": "EQTY",
      "Bid Price": 134.72,
      "Currency Code": "USD",
      "Exchange Code": "NYS",
      "High Price": 135.25,
      "Instrument ID": "IBM.N",
      "Instrument ID Type": "RIC",
      "Low Price": 134.7,
      "Open Price": 135,
      "Previous Close Date": "2019-11-18",
      "Previous Close Price": 134.31,
      "Security Description": "INTERNATIONAL BUSINESS MACHINES ORD",
      "Settlement Price": null,
      "Trade Date": "2019-11-19",
      "Volume": 94438
    }
  ],
  "Notes": [
    "Extraction Services Version 13.2.41189 (85522a4c8b22), Built Nov 11 2019 22:27:09\r\nUser has overridden estimates broker entitlements.\r\nProcessing started at 19112019 15:55:11.\r\nUser ID: 33314\r\nExtraction ID: 398257832\r\nSchedule: _OnD_0x06df5ec3bfe12ba5 (ID = 0x06df5ec3ce712ba5)\r\nInput List (2 items): _OnD_0x06df5ec3bfe12ba5 (ID = 06df5ec3c8a12ba5) Created: 19112019 15:55:07 Last Modified: 19112019 15:55:09\r\nSchedule Time: 19112019 15:55:10\r\nReport Template (23 fields): _OnD_0x06df5ec3bfe12ba5 (ID = 0x06df5ec3c0412ba5) Created: 19112019 15:55:07 Last Modified: 19112019 15:55:07\r\nWARNING: No Pricing for instrument (CSP,438516AC0,CPN), segment 'G' due to instrument not being traded.\r\nNo prices needed currency scaling.\r\nReal-time data was snapped at 19112019 15:55:12, it was scheduled to snap at 19112019 15:55:10.\r\nNo embargo required for this report.\r\nProcessing completed successfully at 19112019 15:55:12, taking 1.38 Secs.\r\nExtraction finished at 19112019 14:55:12 UTC, with servers: x09I18, QSHC20 (0.1 secs), QSSHA1 (0.2 secs)\r\nUsage Summary for User 33314, Client 11122, Template Type Intraday Pricing\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    1 Equities                             N/A      N/A\r\n-------\r\n    2 Total instruments charged.\r\n    0 Instruments with no reported data.\r\n=======\r\n    2 Instruments in the input list.\r\nNo TRPS complex usage to report -- 2 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"
  ]
}

Notes on null prices:

  • The first instrument is an expired bond, that is why there is no pricing data.
  • Usually one makes intraday requests during market open. But if an intraday request is done outside of market open, then some prices will be null.

 

Embargo

The permissioning of the account used to create this tutorial does not include real-time for the German exchange Xetra, so by adding to our request an instrument from that exchange (like ALVG.DE) we were able to generate an embargo.

In the case where an embargo applies to at least one instrument identifier, this is the response we get:

Status:                        202 Accepted

Relevant headers:

Location: https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ExtractResult(ExtractionId='0x053b22a3986b5821')

Body:                          Response does not contain any data.

You must wait at least for the duration of the embargo before sending another HTTP GET request to retrieve the result, using the location URL that was delivered in the HTTP 202 Response header. In this example the embargo duration is 15 minutes for Xetra, but this value could be different, depending on which exchange(s) were embargoed.

Note that, as of version 13.0, it is possible to limit an extraction to only non-embargoed data. To exclude embargoed instruments from the resulting extraction, use the following condition:

"OnlyNonEmbargoedData": true

Eventual embargoed instruments will be identified in the corresponding notes file.

 

Get intraday data, subsequent request after an embargo - HTTP request

After waiting for the duration of the embargo, we can request our data.

This is how we resend our request. Note the path, taken from the 202 response header:

URL:               

https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ExtractResult(ExtractionId='0x053b22a3986b5821')

Method:          GET

Headers:

Prefer: respond-async
Content-Type: application/json
Authorization: Token F0ABE9A3FFF2E02E10AE2765ED872C59B8CC3B40EBB61B30E295E71DE31C254B8648DB9434C2DF9299FDC668AA123501F322D99D45C8B93438063C912BC936C7B87062B0CF812138863F5D836A7B31A32DCA67EF07B3B50B2FC4978DF6F76784FDF35FCB523A8430DA93613BC5730CDC310D4D241718F9FC3F2E55465A24957CC287BDEC79046B31AD642606275AEAD76318CB221BD843348E1483670DA13968D8A242AAFCF9E13E23240C905AE46DED9EDCA9BB316B4C5C767B18DB2EA7ADD100817ADF059D01394BC6375BECAF6138C25DBA57577F0061

If you send this request before the end of the embargo, the response will be the same as for the original request.

At the end of the embargo period, the data will be made available. You can request the data, you should get the results.

If the request is for a lot of instruments, or the DSS server is under heavy load, the extraction might take longer and you might have to wait a bit more and try again later. The more data is requested, the longer it can take for it to be available.

Tutorial Group: 
REST API Tutorials