For a deeper look into our DataScope Select REST API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
1 1 1 1

historical bond prices via DSS Python (REST) API

I want to extract historical bond prices (clean, and dirty), yields and bpv for US treasury bonds, (example RIC='9128286H8=') via the DSS Python API - using the Elektron Time Series template:

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

I have browsed through the different fields, and tried: "Ask", "Bid", "Universal Ask", "Universal Bid", "Yield", "Close Yield", "Last". But all these fields returns None.

Question 1: Is it possible to extract historical bond prices (clean, and dirty), yields and bpv for US treasury bonds via DSS Python API?

Question 2: If yes, which fields do I need to request?

Question 3:If no, can I use another DSS template to obtain these data?

pythonelektron-sdkdss-rest-apidssdatascope-selecthistoricalbonds
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Upvotes
Accepted
31.8k 37 11 19

Hello @lhougaard1,

I have tested ElektronTimeSeries via on-demand request via Postman (quickest to test, but should yield exact same result in Python):

{
   "ExtractionRequest": {
    "@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.ElektronTimeseriesExtractionRequest",
    "ContentFieldNames": [ "RIC", "Ask", "Bid", "Trade Date" ],
    "IdentifierList": {
      "@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.InstrumentIdentifierList", 
      "InstrumentIdentifiers": [
        { "Identifier": "9128286H8=", "IdentifierType": "Ric" }
      ]
    },
   "Condition": {
            "ReportDateRangeType": "Range",
            "QueryStartDate": "2020-10-01T00:00:00.000Z",
            "QueryEndDate": "2020-12-02T00:00:00.000Z"
        }
  }
}

My response contained valid data points:

...
{
    "@odata.context": "https://hosted.datascopeapi.reuters.com/RestApi/v1/$metadata#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.ExtractionResult",
    "Contents": [
        {
            "IdentifierType": "Ric",
            "Identifier": "9128286H8=",
            "RIC": "9128286H8=",
            "Ask": 103.26953125,
            "Bid": 103.24609375,
            "Trade Date": "2020-10-01"
        },
        {
            "IdentifierType": "Ric",
            "Identifier": "9128286H8=",
            "RIC": "9128286H8=",
            "Ask": 103.24609375,
            "Bid": 103.22265625,
            "Trade Date": "2020-10-02"
        },
...

Yes, using Python you should get the exact same result, if your user id is permissioned to request this template. Please try the above on-demand request, you can download RTH Python Code Examples and replace the request in OnDemand example with this request or your required request.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.