How to get Treasury Order Book History data? TY not working, neither is ZN

Jwan622
Jwan622 Newcomer
edited April 16 in Refinitiv Data Platform

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?

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @Jwan622

    Thank you for reaching out to us.

    Not all RICs can provide RawMarketByPrice. I checked that the TYM25 which is a RIC in 0#TY: doesn't support the raw market by price data.

    You need to use other views instead.

    image.png
  • Jwan622
    Jwan622 Newcomer

    @Jirapongse So I found it. It works with 0#1TY:. Can you explain why I need the 1?

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @Jwan622

    1TYM25 in 0#1TY: supports Market Price and Market By Price data.

    Please contact the content support team directly via MyAccount to verify how they are different.