question

Upvotes
Accepted
5 2 1 4

Not able to extract time and sale data

This is my json request:

HttpPost httppost = new HttpPost(urlHost + "/Extractions/ExtractRaw");
httppost.addHeader("content-type", "application/json;odata.metadata=minimal");
httppost.addHeader("Authorization", "Token " + sessionToken);
            // Use the 1st line for your program, the 2nd line to test a timeout (HTTP status 202):
httppost.addHeader("Prefer", "respond-async");
            //httppost.addHeader("Prefer", "respond-async, wait=5");
JSONOrderedObject TicksExtractionRequest = new JSONOrderedObject()
    .put("ExtractionRequest", new JSONOrderedObject()
        .put("@odata.type", "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.TickHistoryTimeAndSalesExtractionRequest")
.put("ContentFieldNames", new JSONArray()
           .put("Trade - Price")
            .put("Trade - Volume")
            .put("Trade - Exchange Time"))
            .put("IdentifierList", new JSONOrderedObject()
                .put("@odata.type", "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.InstrumentIdentifierList")
            .put("InstrumentIdentifiers", new JSONArray()
                .put(new JSONObject()
                    .put("Identifier", "BMG0094B1054")
                    .put("IdentifierType", "Isin"))
                .put(new JSONObject()
                    .put("Identifier", "HKG")
                    .put("IdentifierType", "Exchange Code"))
                .put(new JSONObject()
                    .put("Identifier", "0616.HS")
                    .put("IdentifierType", "Ric")))
            .put("ValidationOptions", JSONObject.NULL)
            .put("UseUserPreferencesForValidationOptions", false))
            .put("Condition", new JSONOrderedObject()
                .put("MessageTimeStampIn", "GmtUtc")
                .put("ApplyCorrectionsAndCancellations", true )
                .put("ReportDateRangeType", "Range")
                .put("QueryStartDate", "2017-10-12T23:59:59.000Z")
                .put("QueryEndDate", "2017-10-13T23:59:59.000Z")
                .put("DisplaySourceRIC", true)));

I am getting the following error message:

ERROR: HTTP status: 400 (Bad Request).  Request content is malformed and cannot be parsed.

This piece of code works fine when I just have the ISIN and RIC identifier types in my InstrumentIdentifiers list. However when I add the exchange code type, it fails with the above error message. Does this request not support extraction of data based on Exchange codes or have I actually malformed my request?

tick-history-rest-apijava
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

· Write an Answer
Upvote
Accepted
79.4k 253 52 74

Refer to Extraction metadata, "Exchange Code" is not a valid IdentifierType. Typically, "Exchange Code" is used in search requests.

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.