DSS Tick History REST API. Get RIC historial price, java

HI,
I'm trying to create a request to get historical price from RIC with java, how to get bid/ask price and filter by date? any idea?
JSONObject searchJSONObject = new JSONObject()
.put("SearchRequest", new JSONObject()
.put("IdentifierType", "Ric")
//.put("Identifier", "US10YT=RRPS")
.put("Identifier", "JPY=")
.put("InstrumentTypeGroups", new JSONArray()
.put("CollatetizedMortgageObligations")
.put("Equities")
.put("FuturesAndOptions")
.put("GovCorp")
.put("MortgageBackedSecurities")
.put("Money")
.put("Municipals")
.put("Funds"))
.put("PreferredIdentifierType", "Ric")
);
Thanks,
Regards
Best Answer
-
Hi @jasequeirosa,
If you are trying to get the historical price of an instrument, I recommend that you look at the Java sample for TickHistory which is available in the downloads section of the Dev Portal - specifically DSSOnDemandTicksRTH sample. There are whole bunch of example snippets which include performing on-demand extraction, to search for a Historical Instrument.
If you have any specific question, you can ask it here.
0
Answers
-
Hi!,
Thanks for your answer,
I tried this example "DSSOnDemandTicksRTH", but got an error as a response:
try {
HttpPost httppost = new HttpPost(urlHost + "/Search/InstrumentSearch");
httppost.addHeader("content-type", "application/json;odata.metadata=minimal");
httppost.addHeader("Authorization", "Token " + sessionToken);
JSONOrderedObject searchJSONObject = (JSONOrderedObject) new JSONOrderedObject()
.put("ExtractionRequest", new JSONOrderedObject()
.put("@odata.type", "#DataScope.Select.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", "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList")
.put("InstrumentIdentifiers", new JSONArray()
.put(new JSONObject()
.put("Identifier", "438516AC0")
.put("IdentifierType", "Cusip"))
.put(new JSONObject()
.put("Identifier", "CARR.PA")
.put("IdentifierType", "Ric"))
.put(new JSONObject()
.put("Identifier", "INVALID")
.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", "2016-09-29T15:15:00.000Z")
.put("QueryEndDate", "2016-09-29T15:16:00.000Z")
.put("DisplaySourceRIC", true)));
System.out.println("Search JSON request content:\n"+ searchJSONObject.toString());
StringEntity requestBody = new StringEntity(searchJSONObject.toString());10:25:19.185 [main] DEBUG org.apache.http.wire - http-outgoing-1 << "{"error":{"message":"Malformed request payload: Syntax error at Line 1, Char 22: expected valid json value {\"ExtractionRequest"}}"
10:25:19.185 [main] DEBUG org.apache.http.headers - http-outgoing-1 << HTTP/1.1 400 Bad Request
Any idea?
Regards
0 -
The example uses the "/Extractions/ExtractRaw" endpoint.
It is better to try the RTH REST Tutorials Postman collection example to verify the endpoint and the request message that can be used to get the required data.
0 -
Hi,
Thanks!
I tried this request in the postman but no get a reponse.
host:
https://selectapi.datascope.refinitiv.com/RestApi/v1/Extractions/ExtractRaw
{
"ExtractionRequest": {
"@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.TickHistoryRawExtractionRequest",
"IdentifierList": {
"@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
"InstrumentIdentifiers": [{
"Identifier": "EUR=",
"IdentifierType": "Ric"
}],
"ValidationOptions": null,
"UseUserPreferencesForValidationOptions": false
},
"Condition": {
"MessageTimeStampIn": "GmtUtc",
"ReportDateRangeType": "Range",
"QueryStartDate": "2023-10-09T00:00:00.000Z",
"QueryEndDate": "2023-10-09T00:01:00.000Z",
"DisplaySourceRIC": true
}
}
}any idea?
Regards
0 -
You may try to change the QueryEndDate to "2023-10-09T05:00:00.000Z".
0 -
Hi,
Can you try this request?{
"ExtractionRequest": {
"@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.TickHistoryRawExtractionRequest",
"IdentifierList": {
"@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
"InstrumentIdentifiers": [{
"Identifier": "EUR=",
"IdentifierType": "Ric"
}],
"UseUserPreferencesForValidationOptions": false
},
"Condition": {
"MessageTimeStampIn": "GmtUtc",
"ReportDateRangeType": "Range",
"QueryStartDate": "2023-10-09T00:00:00.000Z",
"QueryEndDate": "2023-10-09T05:00:00.000Z",
"DisplaySourceRIC": true
}
}
}For me, not works...
Regards
0 -
@jasequeirosa
Please share the HTTP Status code and the HTTP response message or the Postman screenshot that shows the HTTP response message.
0 -
Hi,
I attach response message and the Postman screenshot
Request
POST https://selectapi.datascope.refinitiv.com/RestApi/v1/Extractions/ExtractRaw
202
30.88 s
POST /RestApi/v1/Extractions/ExtractRaw HTTP/1.1
Prefer: respond-async
Content-Type: application/json
Authorization: Token _W8yLgY1y2IXAIJIGGjbCx6Oz7x3COId8bJY0qYLHk9l3axi7uy6CAN-KTp3HHbxKTUhhsqHNxigaqrYM-5MV7_7WhUioEEXnMCtdTZ6psznDh3oPHNTYK8oowu_CFPvuZkVh4nSnPHMGpuVUCqvPqMsueM8SQM2lclgRcK_7mTHeNX0-n4KiFWdpB19_JwVl3gVffHQpcl8F16MLpAYpPOy4nWFar3PHRSXxViSqdGslPANOfFBe1zyNo2aiqzxFaAJ-w0Md5CLDdhjueHN2lwFc2uENfJVW4FmNAWUoLXI
User-Agent: PostmanRuntime/7.33.0
Accept: */*
Postman-Token: 97763e92-c854-468e-b5e8-f63c1a0a3d36
Host: selectapi.datascope.refinitiv.com
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 689
{
"ExtractionRequest": {
"@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.TickHistoryRawExtractionRequest",
"IdentifierList": {
"@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
"InstrumentIdentifiers": [{
"Identifier": "EUR=",
"IdentifierType": "Ric"
}],
"UseUserPreferencesForValidationOptions": false
},
"Condition": {
"MessageTimeStampIn": "GmtUtc",
"ReportDateRangeType": "Range",
"QueryStartDate": "2023-10-09T00:00:00.000Z",
"QueryEndDate": "2023-10-09T05:00:00.000Z",
"DisplaySourceRIC": true
}
}
}
HTTP/1.1 202 Accepted
Cache-Control: no-cache
Pragma: no-cache
Expires: -1
Location: https://selectapi.datascope.refinitiv.com/RestApi/v1/Extractions/ExtractRawResult(ExtractionId='0x08a986c834892bf9')
Server: Microsoft-IIS/10.0
BeginRequestTime: 06:52:39.0643228
BeginRequestDate: 2023-10-13
Status: InProgress
Progress:
X-Request-Execution-Correlation-Id: CiD/9035378/AAAAAA.08a986c834792bf9/RA
X-App-Id: Custom.RestApi
X-App-Version: 17.3.161.64
CPUUtilization: 49.96478
RequestsPerSec: 0
W3WP-PrivateBytes: 2622080
Date: Fri, 13 Oct 2023 06:53:08 GMT
Content-Length: 0Regards
0 -
The 202 Accepted means that the extraction is sill in progress.
Please refer to the Refinitiv Tick History tutorials regading how to process the 202 Accepted response.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 684 Datastream
- 1.4K DSS
- 615 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 249 ETA
- 554 WebSocket API
- 37 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 643 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 192 TREP Infrastructure
- 228 TRKD
- 915 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛