question

Upvotes
Accepted
1 2 2 2

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 512.0 KiB each and 1.0 MiB total.

hi @praveen.rangaiah0 ,

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?
If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,
AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,
AHS

Upvotes
Accepted
78.8k 250 52 74

@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 512.0 KiB each and 1.0 MiB total.

Upvotes
32.2k 40 11 20

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 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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