FA-61226 / Bond day-count conventions / Open access
Irregular final coupon amount: a long final period is pro-rated against one notional period · case 01
The final coupon of a long last period is too large by the day-count mismatch of the extension.
ROOT CAUSE
The long branch reuses the short-stub formula days(prev, mat)/days(prev, q1).
THE FAILURE
The long branch reuses the short-stub formula days(prev, mat)/days(prev, q1).
Unsuccessful approach: Scaling days over two notional periods by two ignores their differing lengths.
Case contract
Inputs the last regular coupon date prev, maturity (prev < maturity <= prev + 2 periods), months per period and annual rate. Quasi dates are prev shifted forward k*months with the prev day clamped to month length. c = 100*rate/freq. Short final period (maturity <= q1): c*days(prev,mat)/days(prev,q1). Long final period: c*(1 + days(q1,mat)/days(q1,q2)). Round 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, maturity, months, rate):
def mlen(y, m):
if m == 2:
return 29 if (y % 4 == 0 and y % 100 != 0) or y % 400 == 0 else 28
return 30 if m in (4, 6, 9, 11) else 31
P = datetime.date(*prev)
M = datetime.date(*maturity)
freq = 12 // months
def fwd(k):
t = P.year * 12 + P.month - 1 + k * months
y, m = t // 12, t % 12 + 1
return datetime.date(y, m, min(P.day, mlen(y, m)))
c = 100 * Fraction(str(rate)) / freq
q1 = fwd(1)
if M <= q1:
frac = Fraction((M - P).days, (q1 - P).days)
else:
q2 = fwd(2)
frac = Fraction((M - P).days, (q1 - P).days)
return round(float(c * frac), 6)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression long stub single fraction 1', [[2035, 6, 25], [2037, 5, 16], 12, 0.05], 9.452055], ['regression long stub single fraction 2', [[2013, 7, 11], [2014, 5, 2], 6, 0.045], 3.629834], ['partial repair probe 1', [[2005, 2, 20], [2006, 2, 13], 6, 0.05], 4.904891], ['partial repair probe 2', [[2040, 1, 21], [2040, 2, 28], 1, 0.05], 0.517241], ['boundary control 1', [[2024, 1, 31], [2024, 7, 31], 6, 0.05], 2.5], ['boundary control 2', [[2024, 1, 31], [2024, 4, 30], 6, 0.05], 1.236264], ['normal control 1', [[2008, 9, 30], [2008, 12, 30], 3, 0.0725], 1.8125], ['normal control 2', [[2025, 9, 27], [2025, 10, 9], 3, 0.03], 0.098901]], [['regression long stub single fraction 1', [[2038, 10, 31], [2039, 10, 28], 6, 0.05], 4.959239], ['regression long stub single fraction 2', [[2025, 11, 30], [2026, 1, 20], 1, 0.045], 0.629032], ['partial repair probe 1', [[2041, 2, 27], [2041, 6, 6], 3, 0.045], 1.247283], ['partial repair probe 2', [[2030, 7, 31], [2031, 10, 5], 12, 0.045], 5.311475], ['boundary control 1', [[2024, 1, 31], [2024, 7, 31], 6, 0.05], 2.5], ['boundary control 2', [[2024, 1, 31], [2024, 4, 30], 6, 0.05], 1.236264], ['normal control 1', [[2024, 9, 16], [2025, 1, 19], 6, 0.0725], 2.503453], ['normal control 2', [[2014, 9, 6], [2014, 9, 25], 6, 0.045], 0.236188]], [['regression long stub single fraction 1', [[2022, 4, 15], [2022, 5, 30], 1, 0.045], 0.556452], ['regression long stub single fraction 2', [[2013, 8, 31], [2014, 4, 8], 6, 0.0725], 4.393342], ['partial repair probe 1', [[2014, 3, 31], [2015, 2, 11], 6, 0.0725], 6.293956], ['partial repair probe 2', [[2033, 12, 30], [2034, 11, 30], 6, 0.045], 4.131148], ['boundary control 1', [[2024, 1, 31], [2024, 4, 30], 6, 0.05], 1.236264], ['boundary control 2', [[2024, 1, 31], [2024, 7, 31], 6, 0.05], 2.5], ['normal control 1', [[2034, 2, 20], [2034, 5, 6], 6, 0.045], 0.93232], ['normal control 2', [[2024, 7, 29], [2024, 10, 3], 6, 0.0725], 1.300272]], [['regression long stub single fraction 1', [[2021, 3, 9], [2022, 3, 8], 6, 0.045], 4.487569], ['regression long stub single fraction 2', [[2039, 11, 25], [2040, 10, 27], 6, 0.045], 4.14538], ['partial repair probe 1', [[2042, 4, 1], [2042, 7, 18], 3, 0.0725], 2.147418], ['partial repair probe 2', [[2028, 1, 17], [2028, 9, 11], 6, 0.045], 2.934783], ['boundary control 1', [[2024, 1, 31], [2024, 7, 31], 6, 0.05], 2.5], ['boundary control 2', [[2024, 1, 31], [2024, 4, 30], 6, 0.05], 1.236264], ['normal control 1', [[2014, 8, 7], [2015, 1, 10], 6, 0.0725], 3.07337], ['normal control 2', [[2037, 6, 29], [2037, 8, 31], 3, 0.045], 0.77038]], [['regression long stub single fraction 1', [[2028, 2, 29], [2028, 8, 29], 3, 0.0725], 3.625], ['regression long stub single fraction 2', [[2027, 4, 28], [2027, 9, 25], 3, 0.045], 1.846467], ['partial repair probe 1', [[2023, 10, 31], [2025, 9, 7], 12, 0.0725], 13.427397], ['partial repair probe 2', [[2030, 9, 30], [2031, 5, 15], 6, 0.05], 3.125], ['boundary control 1', [[2024, 1, 31], [2024, 4, 30], 6, 0.05], 1.236264], ['boundary control 2', [[2024, 1, 31], [2024, 7, 31], 6, 0.05], 2.5], ['normal control 1', [[2005, 3, 31], [2005, 7, 28], 12, 0.0725], 2.363699], ['normal control 2', [[2036, 3, 31], [2037, 12, 28], 12, 0.03], 5.235616]]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression long stub single fraction 1 | 9.439891 | 9.452055 | Failed |
| regression long stub single fraction 2 | 3.607337 | 3.629834 | Failed |
| partial repair probe 1 | 4.944751 | 4.904891 | Failed |
| partial repair probe 2 | 0.510753 | 0.517241 | Failed |
| boundary control 1 | 2.5 | 2.5 | Passed |
| boundary control 2 | 1.236264 | 1.236264 | Passed |
| normal control 1 | 1.8125 | 1.8125 | Passed |
| normal control 2 | 0.098901 | 0.098901 | Passed |
SHA-256 / cdebbb548da9c16e40d4f57029c21fef64e8aba87309e2245998eeae0e494810
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, maturity, months, rate):
def mlen(y, m):
if m == 2:
return 29 if (y % 4 == 0 and y % 100 != 0) or y % 400 == 0 else 28
return 30 if m in (4, 6, 9, 11) else 31
P = datetime.date(*prev)
M = datetime.date(*maturity)
freq = 12 // months
def fwd(k):
t = P.year * 12 + P.month - 1 + k * months
y, m = t // 12, t % 12 + 1
return datetime.date(y, m, min(P.day, mlen(y, m)))
c = 100 * Fraction(str(rate)) / freq
q1 = fwd(1)
if M <= q1:
frac = Fraction((M - P).days, (q1 - P).days)
else:
q2 = fwd(2)
frac = Fraction((M - P).days, (q2 - P).days) * 2
return round(float(c * frac), 6)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression long stub single fraction 1', [[2035, 6, 25], [2037, 5, 16], 12, 0.05], 9.452055], ['regression long stub single fraction 2', [[2013, 7, 11], [2014, 5, 2], 6, 0.045], 3.629834], ['partial repair probe 1', [[2005, 2, 20], [2006, 2, 13], 6, 0.05], 4.904891], ['partial repair probe 2', [[2040, 1, 21], [2040, 2, 28], 1, 0.05], 0.517241], ['boundary control 1', [[2024, 1, 31], [2024, 7, 31], 6, 0.05], 2.5], ['boundary control 2', [[2024, 1, 31], [2024, 4, 30], 6, 0.05], 1.236264], ['normal control 1', [[2008, 9, 30], [2008, 12, 30], 3, 0.0725], 1.8125], ['normal control 2', [[2025, 9, 27], [2025, 10, 9], 3, 0.03], 0.098901]], [['regression long stub single fraction 1', [[2038, 10, 31], [2039, 10, 28], 6, 0.05], 4.959239], ['regression long stub single fraction 2', [[2025, 11, 30], [2026, 1, 20], 1, 0.045], 0.629032], ['partial repair probe 1', [[2041, 2, 27], [2041, 6, 6], 3, 0.045], 1.247283], ['partial repair probe 2', [[2030, 7, 31], [2031, 10, 5], 12, 0.045], 5.311475], ['boundary control 1', [[2024, 1, 31], [2024, 7, 31], 6, 0.05], 2.5], ['boundary control 2', [[2024, 1, 31], [2024, 4, 30], 6, 0.05], 1.236264], ['normal control 1', [[2024, 9, 16], [2025, 1, 19], 6, 0.0725], 2.503453], ['normal control 2', [[2014, 9, 6], [2014, 9, 25], 6, 0.045], 0.236188]], [['regression long stub single fraction 1', [[2022, 4, 15], [2022, 5, 30], 1, 0.045], 0.556452], ['regression long stub single fraction 2', [[2013, 8, 31], [2014, 4, 8], 6, 0.0725], 4.393342], ['partial repair probe 1', [[2014, 3, 31], [2015, 2, 11], 6, 0.0725], 6.293956], ['partial repair probe 2', [[2033, 12, 30], [2034, 11, 30], 6, 0.045], 4.131148], ['boundary control 1', [[2024, 1, 31], [2024, 4, 30], 6, 0.05], 1.236264], ['boundary control 2', [[2024, 1, 31], [2024, 7, 31], 6, 0.05], 2.5], ['normal control 1', [[2034, 2, 20], [2034, 5, 6], 6, 0.045], 0.93232], ['normal control 2', [[2024, 7, 29], [2024, 10, 3], 6, 0.0725], 1.300272]], [['regression long stub single fraction 1', [[2021, 3, 9], [2022, 3, 8], 6, 0.045], 4.487569], ['regression long stub single fraction 2', [[2039, 11, 25], [2040, 10, 27], 6, 0.045], 4.14538], ['partial repair probe 1', [[2042, 4, 1], [2042, 7, 18], 3, 0.0725], 2.147418], ['partial repair probe 2', [[2028, 1, 17], [2028, 9, 11], 6, 0.045], 2.934783], ['boundary control 1', [[2024, 1, 31], [2024, 7, 31], 6, 0.05], 2.5], ['boundary control 2', [[2024, 1, 31], [2024, 4, 30], 6, 0.05], 1.236264], ['normal control 1', [[2014, 8, 7], [2015, 1, 10], 6, 0.0725], 3.07337], ['normal control 2', [[2037, 6, 29], [2037, 8, 31], 3, 0.045], 0.77038]], [['regression long stub single fraction 1', [[2028, 2, 29], [2028, 8, 29], 3, 0.0725], 3.625], ['regression long stub single fraction 2', [[2027, 4, 28], [2027, 9, 25], 3, 0.045], 1.846467], ['partial repair probe 1', [[2023, 10, 31], [2025, 9, 7], 12, 0.0725], 13.427397], ['partial repair probe 2', [[2030, 9, 30], [2031, 5, 15], 6, 0.05], 3.125], ['boundary control 1', [[2024, 1, 31], [2024, 4, 30], 6, 0.05], 1.236264], ['boundary control 2', [[2024, 1, 31], [2024, 7, 31], 6, 0.05], 2.5], ['normal control 1', [[2005, 3, 31], [2005, 7, 28], 12, 0.0725], 2.363699], ['normal control 2', [[2036, 3, 31], [2037, 12, 28], 12, 0.03], 5.235616]]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression long stub single fraction 1 | 9.452804 | 9.452055 | Failed |
| regression long stub single fraction 2 | 3.636986 | 3.629834 | Failed |
| partial repair probe 1 | 4.90411 | 4.904891 | Failed |
| partial repair probe 2 | 0.527778 | 0.517241 | Failed |
| boundary control 1 | 2.5 | 2.5 | Passed |
| boundary control 2 | 1.236264 | 1.236264 | Passed |
| normal control 1 | 1.8125 | 1.8125 | Passed |
| normal control 2 | 0.098901 | 0.098901 | Passed |
SHA-256 / 6d61c55a218358f1c7ae02acd4b4cea475e4d99269fadf9656d0b2bb79081bfb
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:53.209834+00:00.
Case digest / e205c8606402a455f6a3a40ac6c70bb79a5f5dc18a6714dbf71b246db10da270