Hi! I'm using DAtascope and this API for chainrics:
def get_chain_ric_market_depth(futures_ric, query_start_date, query_end_date):
"""
Example futures ric: 0#1YM:
"""
json_blob = {
"ExtractionRequest": {
"@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.TickHistoryMarketDepthExtractionRequest",
"IdentifierList": {
"@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
"InstrumentIdentifiers": [{"Identifier": futures_ric, "IdentifierType": "ChainRIC"}],
},
"Condition": {
"View": "RawMarketByPrice",
"MessageTimeStampIn": "GmtUtc",
"ReportDateRangeType": "Range",
"QueryStartDate": query_start_date,
"QueryEndDate": query_end_date,
"DisplaySourceRIC": True,
},
}
}
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
# Example usage:
if __name__ == "__main__":
start_date = "2025-03-27T09:30:00Z"
end_date = "2025-03-28T09:30:00Z"
tick_data_chain_ric = get_chain_ric_market_depth("0#TY:", start_date, end_date)
preview_response(tick_data_chain_ric)
I want order book data for ZN, ZB, ZT, ZF. What can I do? What am I doing wrong? Is this right?
ZB | us treasures bond | 0#US: |
---|
ZF | us treasuries 5 year t notes | 0#FV: |
ZN | us treasuries 10 year t notes | 0#TY: |
ZT | us treasuries 2 year t note | 0#TU: |
Why do none of them return data?