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
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛