{"id":"tbill-yield-convert","version":"1.0.0","description":"Convert a Treasury bill price, discount rate, investment rate or money-market yield into all four (31 CFR 356 App. B).","supported_operations":["treasury bill discount rate to yield","T-bill price from discount rate","bond equivalent yield of a treasury bill","convert bank discount rate to investment rate","Excel TBILLEQ TBILLYIELD TBILLPRICE equivalent","money market yield of a T-bill","coupon equivalent yield of a bill","what price does a 13 week bill at 5 percent discount cost","המרת ריבית ניכיון של אג\"ח אוצר קצר לתשואה"],"unsupported_operations":["coupon Treasury notes and bonds (use bond-yield-from-price)","auction allotment, non-competitive bidding or live auction results","business-day or holiday adjustment of settlement and maturity","foreign bill conventions (act/365 discount markets) and tax-equivalent yield"],"semantics":["Dates are strict ISO YYYY-MM-DD real dates in years 1900 to 2200. t = days to maturity = actual days from settlement to maturity; settlement must be strictly before maturity and t must be at most 366, else invalid_input.","Exactly one of price (per 100 of face), discount_rate, investment_rate and money_market_yield must be given (none or several is invalid_input). It is used exactly as given and echoed rounded once; the other three outputs come from the exact price. Ranges: 0 < price <= 1000, -1 <= discount_rate <= 1, -1 <= investment_rate <= 10, -1 <= money_market_yield <= 10. Rates are decimal fractions (\"0.05\" is 5 percent); a JSON number for a decimal field is invalid_input.","year_basis y is 366 when a 29 February d satisfies settlement < d <= settlement + 365 days, else 365 (settlement 2024-02-29 gives 365; 2023-03-01 gives 366).","Discount rate (360-day basis): price = 100*(1 - discount_rate*t/360) and discount_rate = ((100 - price)/100)*(360/t). Money-market yield: price = 100/(1 + money_market_yield*t/360) and money_market_yield = ((100 - price)/price)*(360/t).","Investment rate (bond-equivalent, actual/y): when 2t <= y it is ((100 - price)/price)*(y/t) with price = 100/(1 + investment_rate*t/y) and investment_formula simple. When 2t > y, price = 100/(1 + (t/y)*i + (t/(2y) - 1/4)*i^2) with i = investment_rate, and the inverse is i = (-b + sqrt(b^2 - 4ac))/(2a) with a = t/(2y) - 1/4, b = t/y, c = (price - 100)/price (Treasury form); investment_formula is quadratic. At 2t = y the simple formula is used.","A price implied by the input rate that is not positive (discount_rate*t/360 >= 1, or 1 + money_market_yield*t/360 <= 0) is not_computable. Excel TBILLPRICE, TBILLYIELD and TBILLEQ always use a 365-day year and a 182-day half-year cut, so year_basis 366 can differ from TBILLEQ; TBILLYIELD equals money_market_yield and TBILLEQ equals investment_rate.","scale (0 to 12, default 6) sets the digits of price; rate_scale (0 to 12, default 10) sets the digits of the three rates; rounding is half-up (default, half away from zero), half-even, half-down, up, down, ceiling or floor, applied once to each exact value. Exact BigInt arithmetic with a correctly rounded square root; outputs never contain -0.","Any string input over 64 UTF-8 bytes is limit_exceeded, checked before parsing; a lone surrogate is invalid_input.","Disclaimer: arithmetic calculation only; not financial, tax, legal, or investment advice."],"limits":{"max_string_bytes":64},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["settlement","maturity"],"properties":{"settlement":{"type":"string","pattern":"^[0-9]{4}-[0-9]{2}-[0-9]{2}$","maxLength":10},"maturity":{"type":"string","pattern":"^[0-9]{4}-[0-9]{2}-[0-9]{2}$","maxLength":10},"price":{"type":"string","pattern":"^(0|[1-9][0-9]{0,19})(\\.[0-9]{1,20})?$","maxLength":64},"discount_rate":{"type":"string","pattern":"^-?(0|[1-9][0-9]{0,19})(\\.[0-9]{1,20})?$","maxLength":64},"investment_rate":{"type":"string","pattern":"^-?(0|[1-9][0-9]{0,19})(\\.[0-9]{1,20})?$","maxLength":64},"money_market_yield":{"type":"string","pattern":"^-?(0|[1-9][0-9]{0,19})(\\.[0-9]{1,20})?$","maxLength":64},"scale":{"type":"integer","minimum":0,"maximum":12},"rate_scale":{"type":"integer","minimum":0,"maximum":12},"rounding":{"type":"string","enum":["half-up","half-even","half-down","up","down","ceiling","floor"]}}},"output_schema":{"type":"object","additionalProperties":false,"required":["price","discount_rate","investment_rate","money_market_yield","days_to_maturity","year_basis","investment_formula"],"properties":{"price":{"type":"string","pattern":"^(0|[1-9][0-9]*)(\\.[0-9]+)?$"},"discount_rate":{"type":"string","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$"},"investment_rate":{"type":"string","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$"},"money_market_yield":{"type":"string","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$"},"days_to_maturity":{"type":"integer","minimum":1,"maximum":366},"year_basis":{"type":"integer","enum":[365,366]},"investment_formula":{"type":"string","enum":["simple","quadratic"]}}},"examples":[{"input":{"settlement":"2008-03-31","maturity":"2008-06-01","discount_rate":"0.09","scale":2,"rate_scale":6},"output":{"price":"98.45","discount_rate":"0.090000","investment_rate":"0.092687","money_market_yield":"0.091417","days_to_maturity":62,"year_basis":365,"investment_formula":"simple"}},{"input":{"settlement":"2008-03-31","maturity":"2008-06-01","price":"98.45","scale":2,"rate_scale":6},"output":{"price":"98.45","discount_rate":"0.090000","investment_rate":"0.092687","money_market_yield":"0.091417","days_to_maturity":62,"year_basis":365,"investment_formula":"simple"}},{"input":{"settlement":"2023-01-05","maturity":"2023-07-07","discount_rate":"0.05"},"output":{"price":"97.458333","discount_rate":"0.0500000000","investment_rate":"0.0520128355","money_market_yield":"0.0513039761","days_to_maturity":183,"year_basis":365,"investment_formula":"quadratic"}}],"execute_url":"/v1/tools/tbill-yield-convert/versions/1.0.0/execute"}