question

Upvotes
Accepted
1 0 0 0

Tick History Relative Query

Hello,


We have a Tick History client trying to extract data using Relative query but they get an error message and need your help to fix the code.

{

"@odata.type": "#DataScope.Select.Api.Extractions.ReportTemplates.TickHistoryTimeAndSalesReportTemplate",

"Name": "Test Report",

"ContentFields": [

{

"FieldName": "Quote - Ask Price",

"Format": null

},

{

"FieldName": "Quote - Ask Size",

"Format": null

}

],

"Condition": {

"MessageTimeStampIn": "GmtUtc",

"ApplyCorrectionsAndCancellations": true,

"ReportDateRangeType": "Relative",

"RelativeStartDaysAgo": 1,

"RelativeEndDaysAgo": 0,

"RelativeStartTime": "10:00:00.000",

"RelativeEndTime": "23:59:59.999",

"DateRangeTimeZone": "Local Exchange Time Zone",

"DisplaySourceRIC": false

}

}

And when I do this I get back a 201 status code indicating it worked, but if I then query the report that I just created (via /RestApi/v1/Extractions/ReportTemplateGetByName), the returned condition looks like this:

{

"@odata.context": "https://selectapi.datascope.refinitiv.com/RestApi/v1/$metadata#ReportTemplates/DataScope.Select.Api.Extractions.ReportTemplates.TickHistoryTimeAndSalesReportTemplate/$entity",

"@odata.type": "#DataScope.Select.Api.Extractions.ReportTemplates.TickHistoryTimeAndSalesReportTemplate",

"ReportTemplateId": "0x07c951e55cdd4f12",

"ShowColumnHeaders": true,

"CompressionType": "GZip",

"CreateDate": "2021-11-15T10:33:24.006Z",

"LastChangedDate": "2021-11-15T10:33:24.006Z",

"Name": "Test Report",

"OutputFormat": "CommaSeparatedValues",

"ReportFieldCount": 2,

"Delimiter": "None",

"DeliveryType": "None",

"Destination": "",

"TemplateTypeCode": "THT",

"Headers": [],

"Trailers": [],

"ContentFields": [

{

"FieldName": "Quote - Ask Price",

"Justification": "Center",

"Label": "",

"WidthStyle": "VariableWidth",

"Format": {

"@odata.type": "#DataScope.Select.Api.Extractions.ReportTemplates.ContentFieldNumberFormat",

"DecimalPlaces": 9,

"DecimalSeparator": "Period",

"IntegerPlaces": 18,

"UseLeadingZero": false,

"NegativeSignPosition": "Before",

"ThousandSeparator": "Comma",

"UseThousandSeparator": true,

"UseTrailingZero": false

}

},

{

"FieldName": "Quote - Ask Size",

"Justification": "Center",

"Label": "",

"WidthStyle": "VariableWidth",

"Format": {

"@odata.type": "#DataScope.Select.Api.Extractions.ReportTemplates.ContentFieldNumberFormat",

"DecimalPlaces": 9,

"DecimalSeparator": "Period",

"IntegerPlaces": 18,

"UseLeadingZero": false,

"NegativeSignPosition": "Before",

"ThousandSeparator": "Comma",

"UseThousandSeparator": true,

"UseTrailingZero": false

}

}

],

"Condition": {

"SortBy": "SingleByRic",

"MessageTimeStampIn": "LocalExchangeTime",

"TimeRangeMode": "",

"ApplyCorrectionsAndCancellations": false,

"ReportDateRangeType": "NoRange",

"Preview": "None",

"ExtractBy": "Ric",

"DisplaySourceRIC": false

}

}

tick-datatrth-rest-api
icon clock
10 |1500

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

Upvotes
Accepted
38.1k 71 35 53

@praveen.rangaiah0

The request message in the question is used to create a report template on the DSS server.

The 201 HTTP status indicates that the report template was created on the DSS server.

1637113833254.png

The response contains a ReportTemplateId and descriptions of the report template.

The created report template can be used with an instrument list to create a schedule extraction.

For more information on scheduling an immediate extraction, please refer to REST API Tutorial 12: GUI control calls: immediate extract.

Otherwise, you can use the on-demand extraction as mentioned by my colleague.



1637113833254.png (44.2 KiB)
icon clock
10 |1500

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

Upvotes
23k 22 9 14

Hello @praveen.rangaiah0 ,

From my testing, submitting the request exactly as in the question, first, has resulted in Status = 400 (Bad Request).

The valid statuses are 200 (completed) and 202 (accepted for execution).

The request appears to have several issues, does not appear to have instruments included.

You may wish to try the following request as a working starting point, and can be tuned to your requirements:

{
  "ExtractionRequest": {
    "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.TickHistoryTimeAndSalesExtractionRequest",
    "ContentFieldNames": [
"Quote - Ask Price",
"Quote - Ask Size"
],
 "IdentifierList": {
      "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",  
      "InstrumentIdentifiers": [{
        "Identifier": "CARR.PA",
        "IdentifierType": "Ric"
      }]
    },
"Condition": {
"MessageTimeStampIn": "GmtUtc",

"ApplyCorrectionsAndCancellations": true,

"ReportDateRangeType": "Relative",

"RelativeStartDaysAgo": 1,

"RelativeEndDaysAgo": 0,

"RelativeStartTime": "10:00:00.000",

"RelativeEndTime": "23:59:59.999",

"DateRangeTimeZone": "Local Exchange Time Zone",

"DisplaySourceRIC": false

}

} }

I would like to suggest reviewing and working through a step-by-step tutorial on how to retrieve TickHistoryTimeAndSales data REST API Tutorial 4: On Demand tick data extraction

If you get status = 202 back, you can harvest ExtractionID from the response header and check the status of the job as shown in tutorial until status becomes 200 and the results are ready to be retrieved.

I hope this information helps.

icon clock
10 |1500

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

Click below to post an Idea Post Idea