FAILURE MAP
← Case archive

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

ICMA regular-period accrued with ex-coupon: a settlement exactly exdays before the coupon is not ex-coupon · case 01

Trades settling on the first ex-coupon day receive positive accrued interest.

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

ROOT CAUSE

The ex-coupon test uses a strict comparison with the ex-coupon day count.

THE FAILURE

The ex-coupon test uses a strict comparison with the ex-coupon day count.

Unsuccessful approach: Widening the window by one extra day now marks the day before the window as ex-coupon.

Case contract

Inputs prev, nxt, settle ([y,m,d]), annual rate, frequency and ex-coupon days. Settlement outside [prev, nxt] returns "settlement outside period"; settlement on nxt returns 0.0. If the settlement is within ex-coupon days of nxt (days to nxt <= exdays), accrued is negative: -coupon*days(settle,nxt)/days(prev,nxt). Otherwise accrued = coupon*days(prev,settle)/days(prev,nxt). coupon=100*rate/freq; round the final value to 6 decimals.

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
from fractions import Fraction
N = 1
observations = []
def solve(prev, nxt, settle, rate, freq, exdays):
    P = datetime.date(*prev)
    Q = datetime.date(*nxt)
    S = datetime.date(*settle)
    if not (P <= S <= Q):
        return 'settlement outside period'
    if S == Q:
        return 0.0
    period = (Q - P).days
    coupon = 100 * rate / freq
    if (Q - S).days < exdays:
        return round(-coupon * (Q - S).days / period, 6)
    days = (S - P).days
    return round(coupon * days / period, 6)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ex-coupon window boundary 1', [[2053, 5, 28], [2053, 6, 28], [2053, 6, 25], 0.0625, 12, 3], -0.050403], ['regression ex-coupon window boundary 2', [[2012, 7, 31], [2012, 10, 31], [2012, 10, 21], 0.05, 4, 10], -0.13587], ['partial repair probe 1', [[2005, 7, 31], [2006, 7, 31], [2006, 7, 30], 0.0275, 1, 0], 2.742466], ['partial repair probe 2', [[2022, 7, 31], [2022, 8, 31], [2022, 8, 23], 0.04125, 12, 7], 0.25504], ['boundary control 1', [[2024, 1, 15], [2024, 7, 15], [2024, 7, 15], 0.05, 2, 7], 0.0], ['boundary control 2', [[2024, 1, 15], [2024, 7, 15], [2024, 1, 15], 0.05, 2, 7], 0.0], ['normal control 1', [[2059, 1, 30], [2059, 4, 30], [2059, 3, 16], 0.04125, 4, 0], 0.515625], ['normal control 2', [[2005, 12, 29], [2006, 12, 29], [2006, 2, 13], 0.0125, 1, 3], 0.157534]], [['regression ex-coupon window boundary 1', [[2043, 3, 31], [2043, 4, 30], [2043, 4, 25], 0.0625, 12, 5], -0.086806], ['regression ex-coupon window boundary 2', [[2010, 7, 5], [2010, 8, 5], [2010, 7, 29], 0.0275, 12, 7], -0.051747], ['partial repair probe 1', [[2012, 1, 31], [2012, 7, 31], [2012, 7, 27], 0.0625, 2, 3], 3.056319], ['partial repair probe 2', [[2040, 12, 31], [2041, 1, 31], [2041, 1, 30], 0.02, 12, 0], 0.16129], ['boundary control 1', [[2024, 1, 15], [2024, 7, 15], [2024, 7, 15], 0.05, 2, 7], 0.0], ['boundary control 2', [[2024, 1, 15], [2024, 7, 15], [2024, 1, 15], 0.05, 2, 7], 0.0], ['normal control 1', [[2005, 4, 9], [2005, 5, 9], [2005, 5, 8], 0.0625, 12, 7], -0.017361], ['normal control 2', [[2059, 5, 31], [2059, 6, 30], [2059, 6, 25], 0.0275, 12, 3], 0.190972]], [['regression ex-coupon window boundary 1', [[2024, 1, 15], [2024, 7, 15], [2024, 7, 8], 0.05, 2, 7], -0.096154], ['regression ex-coupon window boundary 2', [[2014, 10, 10], [2014, 11, 10], [2014, 11, 3], 0.0125, 12, 7], -0.023522], ['partial repair probe 1', [[2007, 8, 26], [2008, 2, 26], [2008, 2, 25], 0.0125, 2, 0], 0.621603], ['partial repair probe 2', [[2057, 6, 30], [2057, 7, 30], [2057, 7, 22], 0.07, 12, 7], 0.427778], ['boundary control 1', [[2024, 1, 15], [2024, 7, 15], [2024, 7, 15], 0.05, 2, 7], 0.0], ['boundary control 2', [[2024, 1, 15], [2024, 7, 15], [2024, 7, 16], 0.05, 2, 7], 'settlement outside period'], ['normal control 1', [[2027, 5, 9], [2027, 6, 9], [2027, 6, 9], 0.035, 12, 7], 0.0], ['normal control 2', [[2052, 5, 31], [2052, 8, 31], [2052, 8, 30], 0.035, 4, 10], -0.009511]], [['regression ex-coupon window boundary 1', [[2029, 8, 8], [2029, 9, 8], [2029, 8, 29], 0.05, 12, 10], -0.134409], ['regression ex-coupon window boundary 2', [[2009, 4, 13], [2009, 7, 13], [2009, 7, 6], 0.02, 4, 7], -0.038462], ['partial repair probe 1', [[2024, 1, 15], [2024, 7, 15], [2024, 7, 7], 0.05, 2, 7], 2.39011], ['partial repair probe 2', [[2020, 6, 28], [2020, 12, 28], [2020, 12, 22], 0.0125, 2, 5], 0.604508], ['boundary control 1', [[2024, 1, 15], [2024, 7, 15], [2024, 7, 15], 0.05, 2, 7], 0.0], ['boundary control 2', [[2024, 1, 15], [2024, 7, 15], [2024, 1, 15], 0.05, 2, 7], 0.0], ['normal control 1', [[2018, 2, 18], [2018, 3, 18], [2018, 3, 11], 0.0625, 12, 3], 0.390625], ['normal control 2', [[2033, 3, 9], [2033, 6, 9], [2033, 4, 3], 0.0125, 4, 7], 0.084918]], [['regression ex-coupon window boundary 1', [[2024, 1, 15], [2024, 7, 15], [2024, 7, 8], 0.05, 2, 7], -0.096154], ['regression ex-coupon window boundary 2', [[2057, 4, 30], [2057, 10, 30], [2057, 10, 20], 0.02, 2, 10], -0.054645], ['partial repair probe 1', [[2015, 7, 30], [2015, 10, 30], [2015, 10, 29], 0.0275, 4, 0], 0.680027], ['partial repair probe 2', [[2046, 11, 10], [2047, 5, 10], [2047, 5, 2], 0.0275, 2, 7], 1.314227], ['boundary control 1', [[2024, 1, 15], [2024, 7, 15], [2024, 1, 15], 0.05, 2, 7], 0.0], ['boundary control 2', [[2024, 1, 15], [2024, 7, 15], [2024, 7, 16], 0.05, 2, 7], 'settlement outside period'], ['normal control 1', [[2001, 2, 3], [2001, 3, 3], [2001, 2, 3], 0.0275, 12, 0], 0.0], ['normal control 2', [[2000, 10, 29], [2001, 10, 29], [2001, 9, 13], 0.05, 1, 7], 4.369863]]]
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 ex-coupon window boundary 10.47043-0.050403Failed
regression ex-coupon window boundary 21.11413-0.13587Failed
partial repair probe 12.7424662.742466Passed
partial repair probe 20.255040.25504Passed
boundary control 10.00.0Passed
boundary control 20.00.0Passed
normal control 10.5156250.515625Passed
normal control 20.1575340.157534Passed

SHA-256 / 108f1a0d8a13a414bebc778a16304cffc6e255f3001d7cfa1818d438999ea3f4

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
from fractions import Fraction
N = 1
observations = []
def solve(prev, nxt, settle, rate, freq, exdays):
    P = datetime.date(*prev)
    Q = datetime.date(*nxt)
    S = datetime.date(*settle)
    if not (P <= S <= Q):
        return 'settlement outside period'
    if S == Q:
        return 0.0
    period = (Q - P).days
    coupon = 100 * rate / freq
    if (Q - S).days <= exdays + 1:
        return round(-coupon * (Q - S).days / period, 6)
    days = (S - P).days
    return round(coupon * days / period, 6)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ex-coupon window boundary 1', [[2053, 5, 28], [2053, 6, 28], [2053, 6, 25], 0.0625, 12, 3], -0.050403], ['regression ex-coupon window boundary 2', [[2012, 7, 31], [2012, 10, 31], [2012, 10, 21], 0.05, 4, 10], -0.13587], ['partial repair probe 1', [[2005, 7, 31], [2006, 7, 31], [2006, 7, 30], 0.0275, 1, 0], 2.742466], ['partial repair probe 2', [[2022, 7, 31], [2022, 8, 31], [2022, 8, 23], 0.04125, 12, 7], 0.25504], ['boundary control 1', [[2024, 1, 15], [2024, 7, 15], [2024, 7, 15], 0.05, 2, 7], 0.0], ['boundary control 2', [[2024, 1, 15], [2024, 7, 15], [2024, 1, 15], 0.05, 2, 7], 0.0], ['normal control 1', [[2059, 1, 30], [2059, 4, 30], [2059, 3, 16], 0.04125, 4, 0], 0.515625], ['normal control 2', [[2005, 12, 29], [2006, 12, 29], [2006, 2, 13], 0.0125, 1, 3], 0.157534]], [['regression ex-coupon window boundary 1', [[2043, 3, 31], [2043, 4, 30], [2043, 4, 25], 0.0625, 12, 5], -0.086806], ['regression ex-coupon window boundary 2', [[2010, 7, 5], [2010, 8, 5], [2010, 7, 29], 0.0275, 12, 7], -0.051747], ['partial repair probe 1', [[2012, 1, 31], [2012, 7, 31], [2012, 7, 27], 0.0625, 2, 3], 3.056319], ['partial repair probe 2', [[2040, 12, 31], [2041, 1, 31], [2041, 1, 30], 0.02, 12, 0], 0.16129], ['boundary control 1', [[2024, 1, 15], [2024, 7, 15], [2024, 7, 15], 0.05, 2, 7], 0.0], ['boundary control 2', [[2024, 1, 15], [2024, 7, 15], [2024, 1, 15], 0.05, 2, 7], 0.0], ['normal control 1', [[2005, 4, 9], [2005, 5, 9], [2005, 5, 8], 0.0625, 12, 7], -0.017361], ['normal control 2', [[2059, 5, 31], [2059, 6, 30], [2059, 6, 25], 0.0275, 12, 3], 0.190972]], [['regression ex-coupon window boundary 1', [[2024, 1, 15], [2024, 7, 15], [2024, 7, 8], 0.05, 2, 7], -0.096154], ['regression ex-coupon window boundary 2', [[2014, 10, 10], [2014, 11, 10], [2014, 11, 3], 0.0125, 12, 7], -0.023522], ['partial repair probe 1', [[2007, 8, 26], [2008, 2, 26], [2008, 2, 25], 0.0125, 2, 0], 0.621603], ['partial repair probe 2', [[2057, 6, 30], [2057, 7, 30], [2057, 7, 22], 0.07, 12, 7], 0.427778], ['boundary control 1', [[2024, 1, 15], [2024, 7, 15], [2024, 7, 15], 0.05, 2, 7], 0.0], ['boundary control 2', [[2024, 1, 15], [2024, 7, 15], [2024, 7, 16], 0.05, 2, 7], 'settlement outside period'], ['normal control 1', [[2027, 5, 9], [2027, 6, 9], [2027, 6, 9], 0.035, 12, 7], 0.0], ['normal control 2', [[2052, 5, 31], [2052, 8, 31], [2052, 8, 30], 0.035, 4, 10], -0.009511]], [['regression ex-coupon window boundary 1', [[2029, 8, 8], [2029, 9, 8], [2029, 8, 29], 0.05, 12, 10], -0.134409], ['regression ex-coupon window boundary 2', [[2009, 4, 13], [2009, 7, 13], [2009, 7, 6], 0.02, 4, 7], -0.038462], ['partial repair probe 1', [[2024, 1, 15], [2024, 7, 15], [2024, 7, 7], 0.05, 2, 7], 2.39011], ['partial repair probe 2', [[2020, 6, 28], [2020, 12, 28], [2020, 12, 22], 0.0125, 2, 5], 0.604508], ['boundary control 1', [[2024, 1, 15], [2024, 7, 15], [2024, 7, 15], 0.05, 2, 7], 0.0], ['boundary control 2', [[2024, 1, 15], [2024, 7, 15], [2024, 1, 15], 0.05, 2, 7], 0.0], ['normal control 1', [[2018, 2, 18], [2018, 3, 18], [2018, 3, 11], 0.0625, 12, 3], 0.390625], ['normal control 2', [[2033, 3, 9], [2033, 6, 9], [2033, 4, 3], 0.0125, 4, 7], 0.084918]], [['regression ex-coupon window boundary 1', [[2024, 1, 15], [2024, 7, 15], [2024, 7, 8], 0.05, 2, 7], -0.096154], ['regression ex-coupon window boundary 2', [[2057, 4, 30], [2057, 10, 30], [2057, 10, 20], 0.02, 2, 10], -0.054645], ['partial repair probe 1', [[2015, 7, 30], [2015, 10, 30], [2015, 10, 29], 0.0275, 4, 0], 0.680027], ['partial repair probe 2', [[2046, 11, 10], [2047, 5, 10], [2047, 5, 2], 0.0275, 2, 7], 1.314227], ['boundary control 1', [[2024, 1, 15], [2024, 7, 15], [2024, 1, 15], 0.05, 2, 7], 0.0], ['boundary control 2', [[2024, 1, 15], [2024, 7, 15], [2024, 7, 16], 0.05, 2, 7], 'settlement outside period'], ['normal control 1', [[2001, 2, 3], [2001, 3, 3], [2001, 2, 3], 0.0275, 12, 0], 0.0], ['normal control 2', [[2000, 10, 29], [2001, 10, 29], [2001, 9, 13], 0.05, 1, 7], 4.369863]]]
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 ex-coupon window boundary 1-0.050403-0.050403Passed
regression ex-coupon window boundary 2-0.13587-0.13587Passed
partial repair probe 1-0.0075342.742466Failed
partial repair probe 2-0.088710.25504Failed
boundary control 10.00.0Passed
boundary control 20.00.0Passed
normal control 10.5156250.515625Passed
normal control 20.1575340.157534Passed

SHA-256 / b0d5f3eb66a979f92560a291124c54d38fc818ef676030c84f7ebd1c69726445

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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:49.972421+00:00.

Case digest / 3e2c40f446cfcea3c00c16d496e26be085e37e7ea3f0c91a68b6948238a5c054