FA-61066 / Bond day-count conventions / Open access
Irregular first coupon accrued by quasi-coupon periods: the annual coupon is applied to each quasi-period fraction · case 01
Accrued interest is freq times too large.
ROOT CAUSE
The periodic coupon omits division by the payment frequency.
THE FAILURE
The periodic coupon omits division by the payment frequency.
Unsuccessful approach: Dividing by the number of quasi periods confuses irregular period count with frequency.
Case contract
Inputs issue, first coupon and settlement [y,m,d], annual rate and months per period. Settlement must lie in [issue, first] else return "settlement outside first period". Quasi-coupon dates are generated back from the first coupon in steps of months (day clamped to month length) until one is on or before issue. For each quasi period [start, end), accrued days are those in [max(start, issue), min(end, settle)) and are divided by that quasi period length. Accrued = 100*rate/freq*sum, rounded 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(issue, first, settle, rate, months):
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
I = datetime.date(*issue)
Fc = datetime.date(*first)
S = datetime.date(*settle)
if not (I <= S <= Fc):
return 'settlement outside first period'
freq = 12 // months
def back(k):
t = Fc.year * 12 + Fc.month - 1 - k * months
y, m = t // 12, t % 12 + 1
return datetime.date(y, m, min(Fc.day, mlen(y, m)))
q = [Fc]
k = 1
while q[-1] > I:
q.append(back(k))
k += 1
frac = Fraction(0)
for j in range(len(q) - 1):
end, start = q[j], q[j + 1]
lo = max(start, I)
hi = min(end, S)
if hi > lo:
frac += Fraction((hi - lo).days, (end - start).days)
return round(float(100 * Fraction(str(rate)) * frac), 6)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression coupon per quasi period 1', [[2005, 9, 29], [2005, 10, 31], [2005, 9, 30], 0.02, 3], 0.005435], ['regression coupon per quasi period 2', [[2041, 9, 29], [2042, 3, 31], [2041, 10, 18], 0.05, 6], 0.260914], ['partial repair probe 1', [[2030, 8, 6], [2031, 11, 1], [2031, 4, 19], 0.0675, 12], 4.734247], ['partial repair probe 2', [[2031, 8, 7], [2033, 2, 28], [2031, 10, 22], 0.02, 12], 0.416438], ['boundary control 1', [[2024, 1, 10], [2024, 9, 15], [2024, 9, 16], 0.05, 6], 'settlement outside first period'], ['normal control 1', [[2035, 2, 3], [2035, 5, 4], [2035, 2, 3], 0.045, 3], 0.0], ['normal control 2', [[2019, 11, 10], [2020, 3, 3], [2019, 11, 7], 0.045, 6], 'settlement outside first period'], ['normal control 3', [[2007, 12, 27], [2008, 1, 1], [2007, 12, 27], 0.05, 1], 0.0]], [['regression coupon per quasi period 1', [[2040, 8, 29], [2040, 9, 6], [2040, 8, 31], 0.03, 3], 0.016304], ['regression coupon per quasi period 2', [[2030, 7, 25], [2030, 9, 15], [2030, 9, 15], 0.05, 3], 0.706522], ['partial repair probe 1', [[2015, 7, 5], [2018, 1, 31], [2017, 9, 10], 0.02, 12], 4.367123], ['partial repair probe 2', [[2023, 11, 5], [2025, 4, 30], [2025, 4, 30], 0.03, 12], 4.45082], ['boundary control 1', [[2024, 1, 10], [2024, 9, 15], [2024, 9, 16], 0.05, 6], 'settlement outside first period'], ['normal control 1', [[2038, 1, 19], [2038, 3, 31], [2038, 1, 19], 0.03, 6], 0.0], ['normal control 2', [[2012, 6, 22], [2012, 7, 20], [2012, 6, 22], 0.0675, 1], 0.0], ['normal control 3', [[2000, 6, 21], [2001, 1, 22], [2000, 12, 7], 0.02, 12], 0.923497]], [['regression coupon per quasi period 1', [[2003, 9, 19], [2003, 9, 30], [2003, 9, 22], 0.03, 1], 0.024194], ['regression coupon per quasi period 2', [[2014, 12, 1], [2014, 12, 28], [2014, 12, 27], 0.03, 1], 0.216667], ['partial repair probe 1', [[2034, 4, 21], [2035, 9, 1], [2035, 6, 28], 0.05, 12], 5.931507], ['partial repair probe 2', [[2007, 7, 11], [2008, 11, 28], [2008, 1, 9], 0.0675, 12], 3.363631], ['boundary control 1', [[2024, 1, 10], [2024, 9, 15], [2024, 9, 16], 0.05, 6], 'settlement outside first period'], ['normal control 1', [[2001, 12, 2], [2003, 4, 13], [2001, 12, 2], 0.05, 12], 0.0], ['normal control 2', [[2012, 10, 11], [2014, 5, 30], [2012, 10, 8], 0.05, 12], 'settlement outside first period'], ['normal control 3', [[2009, 2, 26], [2009, 11, 12], [2009, 2, 26], 0.05, 3], 0.0]], [['regression coupon per quasi period 1', [[2029, 8, 10], [2029, 9, 30], [2029, 9, 30], 0.0675, 1], 0.925403], ['regression coupon per quasi period 2', [[2014, 9, 3], [2014, 11, 30], [2014, 9, 15], 0.045, 1], 0.145161], ['partial repair probe 1', [[2003, 6, 28], [2006, 2, 11], [2005, 1, 15], 0.0675, 12], 10.468488], ['partial repair probe 2', [[2014, 1, 8], [2016, 8, 1], [2014, 9, 23], 0.0675, 12], 4.771233], ['boundary control 1', [[2024, 1, 10], [2024, 9, 15], [2024, 9, 16], 0.05, 6], 'settlement outside first period'], ['normal control 1', [[2020, 3, 5], [2021, 2, 28], [2020, 6, 30], 0.03, 12], 0.959016], ['normal control 2', [[2007, 2, 26], [2007, 12, 16], [2007, 2, 23], 0.05, 12], 'settlement outside first period'], ['normal control 3', [[2003, 4, 30], [2003, 7, 31], [2003, 5, 22], 0.05, 12], 0.30137]], [['regression coupon per quasi period 1', [[2034, 6, 17], [2034, 7, 16], [2034, 6, 27], 0.045, 1], 0.125], ['regression coupon per quasi period 2', [[2010, 7, 5], [2010, 8, 1], [2010, 7, 14], 0.03, 6], 0.074586], ['partial repair probe 1', [[2032, 8, 31], [2034, 4, 30], [2032, 12, 30], 0.03, 12], 0.994521], ['partial repair probe 2', [[2026, 2, 25], [2027, 4, 30], [2027, 2, 11], 0.045, 12], 4.327397], ['boundary control 1', [[2024, 1, 10], [2024, 9, 15], [2024, 9, 16], 0.05, 6], 'settlement outside first period'], ['normal control 1', [[2029, 1, 21], [2029, 5, 29], [2029, 1, 21], 0.02, 6], 0.0], ['normal control 2', [[2019, 5, 3], [2019, 7, 29], [2019, 4, 30], 0.08, 3], 'settlement outside first period'], ['normal control 3', [[2001, 12, 9], [2002, 5, 1], [2001, 12, 6], 0.08, 6], 'settlement outside first period']]]
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 coupon per quasi period 1 | 0.021739 | 0.005435 | Failed |
| regression coupon per quasi period 2 | 0.521828 | 0.260914 | Failed |
| partial repair probe 1 | 4.734247 | 4.734247 | Passed |
| partial repair probe 2 | 0.416438 | 0.416438 | Passed |
| boundary control 1 | settlement outside first period | settlement outside first period | Passed |
| normal control 1 | 0.0 | 0.0 | Passed |
| normal control 2 | settlement outside first period | settlement outside first period | Passed |
| normal control 3 | 0.0 | 0.0 | Passed |
SHA-256 / a7b4bd5f79c40fcfa5d61c8403f9172262ab48f81a60403a41ab67ac6eb45f8f
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(issue, first, settle, rate, months):
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
I = datetime.date(*issue)
Fc = datetime.date(*first)
S = datetime.date(*settle)
if not (I <= S <= Fc):
return 'settlement outside first period'
freq = 12 // months
def back(k):
t = Fc.year * 12 + Fc.month - 1 - k * months
y, m = t // 12, t % 12 + 1
return datetime.date(y, m, min(Fc.day, mlen(y, m)))
q = [Fc]
k = 1
while q[-1] > I:
q.append(back(k))
k += 1
frac = Fraction(0)
for j in range(len(q) - 1):
end, start = q[j], q[j + 1]
lo = max(start, I)
hi = min(end, S)
if hi > lo:
frac += Fraction((hi - lo).days, (end - start).days)
return round(float(100 * Fraction(str(rate)) / (len(q) - 1) * frac), 6)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression coupon per quasi period 1', [[2005, 9, 29], [2005, 10, 31], [2005, 9, 30], 0.02, 3], 0.005435], ['regression coupon per quasi period 2', [[2041, 9, 29], [2042, 3, 31], [2041, 10, 18], 0.05, 6], 0.260914], ['partial repair probe 1', [[2030, 8, 6], [2031, 11, 1], [2031, 4, 19], 0.0675, 12], 4.734247], ['partial repair probe 2', [[2031, 8, 7], [2033, 2, 28], [2031, 10, 22], 0.02, 12], 0.416438], ['boundary control 1', [[2024, 1, 10], [2024, 9, 15], [2024, 9, 16], 0.05, 6], 'settlement outside first period'], ['normal control 1', [[2035, 2, 3], [2035, 5, 4], [2035, 2, 3], 0.045, 3], 0.0], ['normal control 2', [[2019, 11, 10], [2020, 3, 3], [2019, 11, 7], 0.045, 6], 'settlement outside first period'], ['normal control 3', [[2007, 12, 27], [2008, 1, 1], [2007, 12, 27], 0.05, 1], 0.0]], [['regression coupon per quasi period 1', [[2040, 8, 29], [2040, 9, 6], [2040, 8, 31], 0.03, 3], 0.016304], ['regression coupon per quasi period 2', [[2030, 7, 25], [2030, 9, 15], [2030, 9, 15], 0.05, 3], 0.706522], ['partial repair probe 1', [[2015, 7, 5], [2018, 1, 31], [2017, 9, 10], 0.02, 12], 4.367123], ['partial repair probe 2', [[2023, 11, 5], [2025, 4, 30], [2025, 4, 30], 0.03, 12], 4.45082], ['boundary control 1', [[2024, 1, 10], [2024, 9, 15], [2024, 9, 16], 0.05, 6], 'settlement outside first period'], ['normal control 1', [[2038, 1, 19], [2038, 3, 31], [2038, 1, 19], 0.03, 6], 0.0], ['normal control 2', [[2012, 6, 22], [2012, 7, 20], [2012, 6, 22], 0.0675, 1], 0.0], ['normal control 3', [[2000, 6, 21], [2001, 1, 22], [2000, 12, 7], 0.02, 12], 0.923497]], [['regression coupon per quasi period 1', [[2003, 9, 19], [2003, 9, 30], [2003, 9, 22], 0.03, 1], 0.024194], ['regression coupon per quasi period 2', [[2014, 12, 1], [2014, 12, 28], [2014, 12, 27], 0.03, 1], 0.216667], ['partial repair probe 1', [[2034, 4, 21], [2035, 9, 1], [2035, 6, 28], 0.05, 12], 5.931507], ['partial repair probe 2', [[2007, 7, 11], [2008, 11, 28], [2008, 1, 9], 0.0675, 12], 3.363631], ['boundary control 1', [[2024, 1, 10], [2024, 9, 15], [2024, 9, 16], 0.05, 6], 'settlement outside first period'], ['normal control 1', [[2001, 12, 2], [2003, 4, 13], [2001, 12, 2], 0.05, 12], 0.0], ['normal control 2', [[2012, 10, 11], [2014, 5, 30], [2012, 10, 8], 0.05, 12], 'settlement outside first period'], ['normal control 3', [[2009, 2, 26], [2009, 11, 12], [2009, 2, 26], 0.05, 3], 0.0]], [['regression coupon per quasi period 1', [[2029, 8, 10], [2029, 9, 30], [2029, 9, 30], 0.0675, 1], 0.925403], ['regression coupon per quasi period 2', [[2014, 9, 3], [2014, 11, 30], [2014, 9, 15], 0.045, 1], 0.145161], ['partial repair probe 1', [[2003, 6, 28], [2006, 2, 11], [2005, 1, 15], 0.0675, 12], 10.468488], ['partial repair probe 2', [[2014, 1, 8], [2016, 8, 1], [2014, 9, 23], 0.0675, 12], 4.771233], ['boundary control 1', [[2024, 1, 10], [2024, 9, 15], [2024, 9, 16], 0.05, 6], 'settlement outside first period'], ['normal control 1', [[2020, 3, 5], [2021, 2, 28], [2020, 6, 30], 0.03, 12], 0.959016], ['normal control 2', [[2007, 2, 26], [2007, 12, 16], [2007, 2, 23], 0.05, 12], 'settlement outside first period'], ['normal control 3', [[2003, 4, 30], [2003, 7, 31], [2003, 5, 22], 0.05, 12], 0.30137]], [['regression coupon per quasi period 1', [[2034, 6, 17], [2034, 7, 16], [2034, 6, 27], 0.045, 1], 0.125], ['regression coupon per quasi period 2', [[2010, 7, 5], [2010, 8, 1], [2010, 7, 14], 0.03, 6], 0.074586], ['partial repair probe 1', [[2032, 8, 31], [2034, 4, 30], [2032, 12, 30], 0.03, 12], 0.994521], ['partial repair probe 2', [[2026, 2, 25], [2027, 4, 30], [2027, 2, 11], 0.045, 12], 4.327397], ['boundary control 1', [[2024, 1, 10], [2024, 9, 15], [2024, 9, 16], 0.05, 6], 'settlement outside first period'], ['normal control 1', [[2029, 1, 21], [2029, 5, 29], [2029, 1, 21], 0.02, 6], 0.0], ['normal control 2', [[2019, 5, 3], [2019, 7, 29], [2019, 4, 30], 0.08, 3], 'settlement outside first period'], ['normal control 3', [[2001, 12, 9], [2002, 5, 1], [2001, 12, 6], 0.08, 6], 'settlement outside first period']]]
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 coupon per quasi period 1 | 0.021739 | 0.005435 | Failed |
| regression coupon per quasi period 2 | 0.260914 | 0.260914 | Passed |
| partial repair probe 1 | 2.367123 | 4.734247 | Failed |
| partial repair probe 2 | 0.208219 | 0.416438 | Failed |
| boundary control 1 | settlement outside first period | settlement outside first period | Passed |
| normal control 1 | 0.0 | 0.0 | Passed |
| normal control 2 | settlement outside first period | settlement outside first period | Passed |
| normal control 3 | 0.0 | 0.0 | Passed |
SHA-256 / 2f88fa8d62b1dee1ce5f923429665f1c62e100c4b0dc5ed2ab03fc2f579ab759
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:51.684115+00:00.
Case digest / efd52d0a353e6823333144a573b0a01cf7a4a6735f7c2978c34d6f2ba1f55de0