Why am not seeing anything in the response.text for this TickHistoryMarketDepthExtractionRequest
def get_futures_tick_data(ticker, query_start_date, query_end_date): """ Fetches historical tick-by-tick futures data from Refinitiv. :param ticker: The specific futures contract RIC (e.g., "BTCJ4" for April 2024 Bitcoin Futures) :param query_start_date: Start date in ISO format (e.g., "2025-03-01T09:30:00Z") :param query_end_date: End date in ISO format (e.g., "2025-03-16T16:00:00Z") :return: JSON response containing futures tick data """ json_blob = { "ExtractionRequest": { "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.TickHistoryMarketDepthExtractionRequest", "IdentifierList": { "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList", "InstrumentIdentifiers": [{ "Identifier": ticker, "IdentifierType": "Ric", }], "ValidationOptions": None, "UseUserPreferencesForValidationOptions": False }, "Condition": { "View": "RawMarketByPrice", "MessageTimeStampIn": "GmtUtc", "ReportDateRangeType": "Range", "DisplaySourceRIC": "true", "DateRangeTimeZone": "UTC", "QueryStartDate": query_start_date, "QueryEndDate": query_end_date, } } } post_url = URL_BASE + "/Extractions/ExtractRaw" response = requests.post(post_url, headers = { "Authorization": f"Token {REFINITIV_AUTH_TOKEN}", "Content-Type": "application/json" }, json = json_blob) if response.status_code != 200: raise ValueError(f"Failed to fetch tick data: {response.status_code} - {response.text}") job_id = response.json().get("JobId") if not job_id: raise ValueError("No JobId returned. Check request parameters.") # Fetch extracted data data_url = f"{URL_BASE}/Extractions/RawExtractionResults('{job_id}')/$value" data_response = requests.get(data_url, headers = { "Authorization": f"Token {REFINITIV_AUTH_TOKEN}" }, stream = True) data_response.raise_for_status() return data_response def preview_response(response, num_lines=5): """ Prints the first few lines of a streamed Refinitiv API response. :param response: The streamed API response. :param num_lines: Number of lines to preview. """ print("Previewing first few lines of response:...") for i, line in enumerate(response.iter_lines(decode_unicode=True)): if line: print(line) # Print each line of data if i >= num_lines - 1: # Stop after num_lines break # Example usage: if __name__ == "__main__": # intraday_data = get_embargo_info("FCX") # if intraday_data: # print(json.dumps(intraday_data, indent=4)) # get_sp500() # tick_history = get_tick_history("CORZ.NYO", "2025-03-03T09:30:00Z", "2025-03-04T09:30:00Z") # preview_response(tick_history) tick_data = get_futures_tick_data("0#BTC:", "2025-03-01T09:30:00Z", "2025-03-05T16:00:00Z") preview_response(tick_data)
It doen'st work for futures. I want BTC and the ES mini and the Nasdaq. If I put in "AAPL.ARC" it works and I see the data. What can I do to see order book data for these futures? Please show me. I want the order book data updates for futures.
Answers
-
Thank you for reaching out to us.
The 0#BTC: is a chain RIC so the request should use the "ChainRIC" as an identifierType.
"InstrumentIdentifiers": [{
"Identifier": "0#BTC:",
"IdentifierType": "ChainRIC"
}],0 -
@Jirapongse What is a chain ric? I think I know what it is but… how do I get all the underlying rics of a chain ric? Is there any way for me to get a list of all the rics in a chainric?
0 -
Typically. chain RICs are prefixed with "0#". A "chain RIC" refers to a collection of individual RICs that are linked together,
Some requests support the "IdentifierType": "ChainRIC" so you can use chain RICs directly in the request messages.
To expand it, you can use the TermsAndConditionsExtractionRequest with the Extractions/ExtractWithNotes endpoint
{
"ExtractionRequest": {
"@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.TermsAndConditionsExtractionRequest",
"ContentFieldNames": [
"RIC"
],
"IdentifierList": {
"@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
"InstrumentIdentifiers": [
{
"Identifier": "0#BTC:",
"IdentifierType": "ChainRIC"
}
],
"ValidationOptions": {
"AllowHistoricalInstruments": true
}
}
}
}Otherwise, you can also use the Historical Chain Constituents Search.
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
- 685 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
- 252 ETA
- 556 WebSocket API
- 38 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
- 652 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
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 228 TRKD
- 917 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 中文论坛