FAILURE MAP
← Case archive

FA-61116 / Bond day-count conventions / Open access

Discount-basis bill price and bond-equivalent yield: the short-dated yield ignores the price discount · case 01

Bond-equivalent yields for short bills are understated.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The simple formula divides by 360 instead of 360 - d*t.

VERIFIED REPAIR

Use B*d/(360 - d*t).

Unsuccessful approach: Adding d*t in the denominator moves the error in the other direction.

Case contract

Inputs settlement and maturity [y,m,d] (1 to 364 days apart) and discount rate d. t = days. Price = 100*(1 - d*t/360). Year basis B is 366 if a 29 February lies in (settle, settle+365 days], else 365. For t <= B/2, BEY = B*d/(360 - d*t); otherwise BEY solves the quadratic with a = t/(2B) - 0.25, b = t/B, c = (price-100)/price, taking (-b + sqrt(b^2 - 4ac))/(2a). Return [price rounded 6, BEY rounded 8].

Why this case matters

Bond accrual and pricing systems depend on exact day-count arithmetic; a single-day error changes settlement cash.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
import math
N = 1
observations = []
def solve(settle, maturity, d):
    S = datetime.date(*settle)
    M = datetime.date(*maturity)
    t = (M - S).days
    def leap(y):
        return (y % 4 == 0 and y % 100 != 0) or y % 400 == 0
    horizon = S + datetime.timedelta(days=365)
    basis = 366 if any(leap(y) and S < datetime.date(y, 2, 29) <= horizon for y in (S.year, S.year + 1)) else 365
    price = 100 * (1 - d * t / 360)
    if t <= basis / 2:
        bey = basis * d / 360
    else:
        a = t / (2 * basis) - 0.25
        b = t / basis
        c = (price - 100) / price
        bey = (-b + math.sqrt(b * b - 4 * a * c)) / (2 * a)
    return [round(price, 6), round(bey, 8)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression short bill yield denominator 1', [[2008, 4, 28], [2008, 10, 27], 0.025], [98.736111, 0.02567168]], ['regression short bill yield denominator 2', [[2100, 11, 3], [2101, 2, 2], 0.001], [99.974722, 0.00101415]], ['partial repair probe 1', [[2001, 8, 5], [2002, 2, 3], 0.01], [99.494444, 0.01019041]], ['partial repair probe 2', [[2008, 12, 1], [2009, 5, 31], 0.0525], [97.360417, 0.05467229]], ['boundary control 1', [[2023, 3, 1], [2024, 2, 28], 0.05], [94.944444, 0.05284575]], ['normal control 1', [[2099, 1, 15], [2099, 7, 19], 0.0525], [97.302083, 0.05468486]], ['normal control 2', [[2077, 2, 21], [2078, 2, 20], 0.08], [91.911111, 0.08638888]], ['normal control 3', [[2021, 6, 30], [2021, 12, 30], 0.0435], [97.78875, 0.04509869]]], [['regression short bill yield denominator 1', [[2018, 8, 17], [2019, 2, 12], 0.025], [98.756944, 0.02566627]], ['regression short bill yield denominator 2', [[2066, 12, 28], [2067, 6, 21], 0.001], [99.951389, 0.00101438]], ['partial repair probe 1', [[2001, 4, 12], [2001, 10, 11], 0.08], [95.955556, 0.08452987]], ['partial repair probe 2', [[2011, 6, 12], [2011, 9, 11], 0.08], [97.977778, 0.08301202]], ['boundary control 1', [[2023, 3, 1], [2024, 2, 28], 0.05], [94.944444, 0.05284575]], ['normal control 1', [[2028, 2, 1], [2028, 10, 13], 0.0435], [96.91875, 0.04534078]], ['normal control 2', [[2091, 2, 28], [2091, 9, 1], 0.025], [98.715278, 0.02567265]], ['normal control 3', [[2062, 2, 28], [2062, 8, 30], 0.01], [99.491667, 0.01019055]]], [['regression short bill yield denominator 1', [[2035, 5, 30], [2035, 8, 29], 0.025], [99.368056, 0.02557831]], ['regression short bill yield denominator 2', [[2056, 4, 1], [2056, 7, 1], 0.01], [99.747222, 0.01016458]], ['partial repair probe 1', [[2060, 12, 28], [2061, 6, 21], 0.08], [96.111111, 0.08439306]], ['partial repair probe 2', [[2048, 7, 14], [2048, 10, 13], 0.0525], [98.672917, 0.05394506]], ['boundary control 1', [[2023, 3, 1], [2024, 2, 28], 0.05], [94.944444, 0.05284575]], ['normal control 1', [[2037, 6, 21], [2038, 6, 20], 0.0525], [94.691667, 0.05544668]], ['normal control 2', [[2013, 6, 28], [2013, 12, 28], 0.08], [95.933333, 0.08453969]], ['normal control 3', [[2028, 3, 15], [2028, 9, 18], 0.001], [99.948056, 0.0010144]]], [['regression short bill yield denominator 1', [[2023, 1, 15], [2023, 3, 27], 0.0435], [99.142083, 0.04448582]], ['regression short bill yield denominator 2', [[2085, 8, 28], [2086, 2, 25], 0.025], [98.743056, 0.02566988]], ['partial repair probe 1', [[2012, 9, 28], [2013, 3, 28], 0.0525], [97.360417, 0.05467229]], ['partial repair probe 2', [[2013, 1, 12], [2013, 4, 13], 0.01], [99.747222, 0.01016458]], ['boundary control 1', [[2023, 3, 1], [2024, 2, 28], 0.05], [94.944444, 0.05284575]], ['normal control 1', [[2033, 2, 28], [2033, 8, 30], 0.001], [99.949167, 0.0010144]], ['normal control 2', [[2053, 2, 1], [2053, 8, 3], 0.0435], [97.78875, 0.04509869]], ['normal control 3', [[2078, 1, 23], [2078, 8, 5], 0.025], [98.652778, 0.02567383]]], [['regression short bill yield denominator 1', [[2096, 5, 22], [2096, 8, 21], 0.001], [99.974722, 0.00101415]], ['regression short bill yield denominator 2', [[2053, 1, 13], [2053, 7, 14], 0.0525], [97.345833, 0.05468048]], ['partial repair probe 1', [[2057, 1, 1], [2057, 6, 25], 0.0525], [97.447917, 0.0546232]], ['partial repair probe 2', [[2100, 9, 30], [2101, 3, 31], 0.0435], [97.800833, 0.0450959]], ['boundary control 1', [[2023, 3, 1], [2024, 2, 28], 0.05], [94.944444, 0.05284575]], ['normal control 1', [[2023, 12, 15], [2024, 12, 13], 0.01], [98.988889, 0.01024442]], ['normal control 2', [[2056, 10, 9], [2057, 4, 10], 0.001], [99.949167, 0.0010144]], ['normal control 3', [[2099, 3, 15], [2100, 3, 14], 0.0525], [94.691667, 0.05544668]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression short bill yield denominator 1[98.736111, 0.02534722][98.736111, 0.02567168]Failed
regression short bill yield denominator 2[99.974722, 0.00101389][99.974722, 0.00101415]Failed
partial repair probe 1[99.494444, 0.01013889][99.494444, 0.01019041]Failed
partial repair probe 2[97.360417, 0.05322917][97.360417, 0.05467229]Failed
boundary control 1[94.944444, 0.05284575][94.944444, 0.05284575]Passed
normal control 1[97.302083, 0.05468486][97.302083, 0.05468486]Passed
normal control 2[91.911111, 0.08638888][91.911111, 0.08638888]Passed
normal control 3[97.78875, 0.04509869][97.78875, 0.04509869]Passed

SHA-256 / 9275213e45806437e8a5a90c2fa1597abb159967464fe1547ebdb082cecf19bb

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
import math
N = 1
observations = []
def solve(settle, maturity, d):
    S = datetime.date(*settle)
    M = datetime.date(*maturity)
    t = (M - S).days
    def leap(y):
        return (y % 4 == 0 and y % 100 != 0) or y % 400 == 0
    horizon = S + datetime.timedelta(days=365)
    basis = 366 if any(leap(y) and S < datetime.date(y, 2, 29) <= horizon for y in (S.year, S.year + 1)) else 365
    price = 100 * (1 - d * t / 360)
    if t <= basis / 2:
        bey = basis * d / (360 + d * t)
    else:
        a = t / (2 * basis) - 0.25
        b = t / basis
        c = (price - 100) / price
        bey = (-b + math.sqrt(b * b - 4 * a * c)) / (2 * a)
    return [round(price, 6), round(bey, 8)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression short bill yield denominator 1', [[2008, 4, 28], [2008, 10, 27], 0.025], [98.736111, 0.02567168]], ['regression short bill yield denominator 2', [[2100, 11, 3], [2101, 2, 2], 0.001], [99.974722, 0.00101415]], ['partial repair probe 1', [[2001, 8, 5], [2002, 2, 3], 0.01], [99.494444, 0.01019041]], ['partial repair probe 2', [[2008, 12, 1], [2009, 5, 31], 0.0525], [97.360417, 0.05467229]], ['boundary control 1', [[2023, 3, 1], [2024, 2, 28], 0.05], [94.944444, 0.05284575]], ['normal control 1', [[2099, 1, 15], [2099, 7, 19], 0.0525], [97.302083, 0.05468486]], ['normal control 2', [[2077, 2, 21], [2078, 2, 20], 0.08], [91.911111, 0.08638888]], ['normal control 3', [[2021, 6, 30], [2021, 12, 30], 0.0435], [97.78875, 0.04509869]]], [['regression short bill yield denominator 1', [[2018, 8, 17], [2019, 2, 12], 0.025], [98.756944, 0.02566627]], ['regression short bill yield denominator 2', [[2066, 12, 28], [2067, 6, 21], 0.001], [99.951389, 0.00101438]], ['partial repair probe 1', [[2001, 4, 12], [2001, 10, 11], 0.08], [95.955556, 0.08452987]], ['partial repair probe 2', [[2011, 6, 12], [2011, 9, 11], 0.08], [97.977778, 0.08301202]], ['boundary control 1', [[2023, 3, 1], [2024, 2, 28], 0.05], [94.944444, 0.05284575]], ['normal control 1', [[2028, 2, 1], [2028, 10, 13], 0.0435], [96.91875, 0.04534078]], ['normal control 2', [[2091, 2, 28], [2091, 9, 1], 0.025], [98.715278, 0.02567265]], ['normal control 3', [[2062, 2, 28], [2062, 8, 30], 0.01], [99.491667, 0.01019055]]], [['regression short bill yield denominator 1', [[2035, 5, 30], [2035, 8, 29], 0.025], [99.368056, 0.02557831]], ['regression short bill yield denominator 2', [[2056, 4, 1], [2056, 7, 1], 0.01], [99.747222, 0.01016458]], ['partial repair probe 1', [[2060, 12, 28], [2061, 6, 21], 0.08], [96.111111, 0.08439306]], ['partial repair probe 2', [[2048, 7, 14], [2048, 10, 13], 0.0525], [98.672917, 0.05394506]], ['boundary control 1', [[2023, 3, 1], [2024, 2, 28], 0.05], [94.944444, 0.05284575]], ['normal control 1', [[2037, 6, 21], [2038, 6, 20], 0.0525], [94.691667, 0.05544668]], ['normal control 2', [[2013, 6, 28], [2013, 12, 28], 0.08], [95.933333, 0.08453969]], ['normal control 3', [[2028, 3, 15], [2028, 9, 18], 0.001], [99.948056, 0.0010144]]], [['regression short bill yield denominator 1', [[2023, 1, 15], [2023, 3, 27], 0.0435], [99.142083, 0.04448582]], ['regression short bill yield denominator 2', [[2085, 8, 28], [2086, 2, 25], 0.025], [98.743056, 0.02566988]], ['partial repair probe 1', [[2012, 9, 28], [2013, 3, 28], 0.0525], [97.360417, 0.05467229]], ['partial repair probe 2', [[2013, 1, 12], [2013, 4, 13], 0.01], [99.747222, 0.01016458]], ['boundary control 1', [[2023, 3, 1], [2024, 2, 28], 0.05], [94.944444, 0.05284575]], ['normal control 1', [[2033, 2, 28], [2033, 8, 30], 0.001], [99.949167, 0.0010144]], ['normal control 2', [[2053, 2, 1], [2053, 8, 3], 0.0435], [97.78875, 0.04509869]], ['normal control 3', [[2078, 1, 23], [2078, 8, 5], 0.025], [98.652778, 0.02567383]]], [['regression short bill yield denominator 1', [[2096, 5, 22], [2096, 8, 21], 0.001], [99.974722, 0.00101415]], ['regression short bill yield denominator 2', [[2053, 1, 13], [2053, 7, 14], 0.0525], [97.345833, 0.05468048]], ['partial repair probe 1', [[2057, 1, 1], [2057, 6, 25], 0.0525], [97.447917, 0.0546232]], ['partial repair probe 2', [[2100, 9, 30], [2101, 3, 31], 0.0435], [97.800833, 0.0450959]], ['boundary control 1', [[2023, 3, 1], [2024, 2, 28], 0.05], [94.944444, 0.05284575]], ['normal control 1', [[2023, 12, 15], [2024, 12, 13], 0.01], [98.988889, 0.01024442]], ['normal control 2', [[2056, 10, 9], [2057, 4, 10], 0.001], [99.949167, 0.0010144]], ['normal control 3', [[2099, 3, 15], [2100, 3, 14], 0.0525], [94.691667, 0.05544668]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression short bill yield denominator 1[98.736111, 0.02503086][98.736111, 0.02567168]Failed
regression short bill yield denominator 2[99.974722, 0.00101363][99.974722, 0.00101415]Failed
partial repair probe 1[99.494444, 0.01008789][99.494444, 0.01019041]Failed
partial repair probe 2[97.360417, 0.05186027][97.360417, 0.05467229]Failed
boundary control 1[94.944444, 0.05284575][94.944444, 0.05284575]Passed
normal control 1[97.302083, 0.05468486][97.302083, 0.05468486]Passed
normal control 2[91.911111, 0.08638888][91.911111, 0.08638888]Passed
normal control 3[97.78875, 0.04509869][97.78875, 0.04509869]Passed

SHA-256 / 90f350b318b970ab3217209afc84edd832c06c808e30da3e179dcbcd54b111e6

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
import math
N = 1
observations = []
def solve(settle, maturity, d):
    S = datetime.date(*settle)
    M = datetime.date(*maturity)
    t = (M - S).days
    def leap(y):
        return (y % 4 == 0 and y % 100 != 0) or y % 400 == 0
    horizon = S + datetime.timedelta(days=365)
    basis = 366 if any(leap(y) and S < datetime.date(y, 2, 29) <= horizon for y in (S.year, S.year + 1)) else 365
    price = 100 * (1 - d * t / 360)
    if t <= basis / 2:
        bey = basis * d / (360 - d * t)
    else:
        a = t / (2 * basis) - 0.25
        b = t / basis
        c = (price - 100) / price
        bey = (-b + math.sqrt(b * b - 4 * a * c)) / (2 * a)
    return [round(price, 6), round(bey, 8)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression short bill yield denominator 1', [[2008, 4, 28], [2008, 10, 27], 0.025], [98.736111, 0.02567168]], ['regression short bill yield denominator 2', [[2100, 11, 3], [2101, 2, 2], 0.001], [99.974722, 0.00101415]], ['partial repair probe 1', [[2001, 8, 5], [2002, 2, 3], 0.01], [99.494444, 0.01019041]], ['partial repair probe 2', [[2008, 12, 1], [2009, 5, 31], 0.0525], [97.360417, 0.05467229]], ['boundary control 1', [[2023, 3, 1], [2024, 2, 28], 0.05], [94.944444, 0.05284575]], ['normal control 1', [[2099, 1, 15], [2099, 7, 19], 0.0525], [97.302083, 0.05468486]], ['normal control 2', [[2077, 2, 21], [2078, 2, 20], 0.08], [91.911111, 0.08638888]], ['normal control 3', [[2021, 6, 30], [2021, 12, 30], 0.0435], [97.78875, 0.04509869]]], [['regression short bill yield denominator 1', [[2018, 8, 17], [2019, 2, 12], 0.025], [98.756944, 0.02566627]], ['regression short bill yield denominator 2', [[2066, 12, 28], [2067, 6, 21], 0.001], [99.951389, 0.00101438]], ['partial repair probe 1', [[2001, 4, 12], [2001, 10, 11], 0.08], [95.955556, 0.08452987]], ['partial repair probe 2', [[2011, 6, 12], [2011, 9, 11], 0.08], [97.977778, 0.08301202]], ['boundary control 1', [[2023, 3, 1], [2024, 2, 28], 0.05], [94.944444, 0.05284575]], ['normal control 1', [[2028, 2, 1], [2028, 10, 13], 0.0435], [96.91875, 0.04534078]], ['normal control 2', [[2091, 2, 28], [2091, 9, 1], 0.025], [98.715278, 0.02567265]], ['normal control 3', [[2062, 2, 28], [2062, 8, 30], 0.01], [99.491667, 0.01019055]]], [['regression short bill yield denominator 1', [[2035, 5, 30], [2035, 8, 29], 0.025], [99.368056, 0.02557831]], ['regression short bill yield denominator 2', [[2056, 4, 1], [2056, 7, 1], 0.01], [99.747222, 0.01016458]], ['partial repair probe 1', [[2060, 12, 28], [2061, 6, 21], 0.08], [96.111111, 0.08439306]], ['partial repair probe 2', [[2048, 7, 14], [2048, 10, 13], 0.0525], [98.672917, 0.05394506]], ['boundary control 1', [[2023, 3, 1], [2024, 2, 28], 0.05], [94.944444, 0.05284575]], ['normal control 1', [[2037, 6, 21], [2038, 6, 20], 0.0525], [94.691667, 0.05544668]], ['normal control 2', [[2013, 6, 28], [2013, 12, 28], 0.08], [95.933333, 0.08453969]], ['normal control 3', [[2028, 3, 15], [2028, 9, 18], 0.001], [99.948056, 0.0010144]]], [['regression short bill yield denominator 1', [[2023, 1, 15], [2023, 3, 27], 0.0435], [99.142083, 0.04448582]], ['regression short bill yield denominator 2', [[2085, 8, 28], [2086, 2, 25], 0.025], [98.743056, 0.02566988]], ['partial repair probe 1', [[2012, 9, 28], [2013, 3, 28], 0.0525], [97.360417, 0.05467229]], ['partial repair probe 2', [[2013, 1, 12], [2013, 4, 13], 0.01], [99.747222, 0.01016458]], ['boundary control 1', [[2023, 3, 1], [2024, 2, 28], 0.05], [94.944444, 0.05284575]], ['normal control 1', [[2033, 2, 28], [2033, 8, 30], 0.001], [99.949167, 0.0010144]], ['normal control 2', [[2053, 2, 1], [2053, 8, 3], 0.0435], [97.78875, 0.04509869]], ['normal control 3', [[2078, 1, 23], [2078, 8, 5], 0.025], [98.652778, 0.02567383]]], [['regression short bill yield denominator 1', [[2096, 5, 22], [2096, 8, 21], 0.001], [99.974722, 0.00101415]], ['regression short bill yield denominator 2', [[2053, 1, 13], [2053, 7, 14], 0.0525], [97.345833, 0.05468048]], ['partial repair probe 1', [[2057, 1, 1], [2057, 6, 25], 0.0525], [97.447917, 0.0546232]], ['partial repair probe 2', [[2100, 9, 30], [2101, 3, 31], 0.0435], [97.800833, 0.0450959]], ['boundary control 1', [[2023, 3, 1], [2024, 2, 28], 0.05], [94.944444, 0.05284575]], ['normal control 1', [[2023, 12, 15], [2024, 12, 13], 0.01], [98.988889, 0.01024442]], ['normal control 2', [[2056, 10, 9], [2057, 4, 10], 0.001], [99.949167, 0.0010144]], ['normal control 3', [[2099, 3, 15], [2100, 3, 14], 0.0525], [94.691667, 0.05544668]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression short bill yield denominator 1[98.736111, 0.02567168][98.736111, 0.02567168]Passed
regression short bill yield denominator 2[99.974722, 0.00101415][99.974722, 0.00101415]Passed
partial repair probe 1[99.494444, 0.01019041][99.494444, 0.01019041]Passed
partial repair probe 2[97.360417, 0.05467229][97.360417, 0.05467229]Passed
boundary control 1[94.944444, 0.05284575][94.944444, 0.05284575]Passed
normal control 1[97.302083, 0.05468486][97.302083, 0.05468486]Passed
normal control 2[91.911111, 0.08638888][91.911111, 0.08638888]Passed
normal control 3[97.78875, 0.04509869][97.78875, 0.04509869]Passed

SHA-256 / 3d8dd46d1e1f05a3aef22a81beeeffc6f4e579e0066a7b1d385e104fece3ec6d

Verification & scope

A deterministic toy contract stated explicitly in the contract field; no claim of conformance to any published convention text. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:46:52.133705+00:00.

Case digest / 7b6f4f7aefc053a28d8dd2288dc9f99d31e4198d123510b5d299ee90ed44e1ae