ex-dividend-and-rebate-interestlisted
Install: claude install-skill howard-lynn-ye/fin-skills
# Ex-dividend and rebate interest
**A gilt bought inside its ex-dividend window does not receive the coupon that is about to be
paid, so accrued interest is NEGATIVE.** Most fixed-income code has no branch for this. The code
that does can have the sign backwards and never fail.
Every figure below is printed by `scripts/ex_dividend.py` (runs in **0.15 s**; QuantLib optional).
✅ Measured means this file produced it on 2026-09-09 with QuantLib 1.43, Python 3.11.3. The
worked bond is a **4% gilt, coupons 7 Jun / 7 Dec, maturity 2035-06-07, y = 4.20%**, and the
coupon in question is **2026-12-07 (a Monday)**, whose ex-dividend date is **2026-11-26**.
> **The rule: inside the window `AI = (t/s − 1)·d1`, which is negative — and QuantLib's
> `exCouponPeriod` counts days BACK from the coupon, so it takes `Period(7, Days)` and never
> `Period(-7, Days)`.**
## 1. ✅ The rule, from the source
✅ **UK DMO, "Formulae for Calculating Gilt Prices from Yields", 4th edition, 18 December 2024,
Note 5** (read 2026-09-09): the ex-dividend date for all gilts is currently the date **seven
business days** before the dividend date.
✅ Section Three (1)(i), the accrued-interest formula, verbatim in structure:
```
AI = (t/s) * d1 if the settlement date occurs on or before the ex-dividend date
AI = (t/s - 1) * d1 if the settlement date occurs after the ex-dividend date
```
with `t` = calendar days from the previous quasi-coupon date to settlement, `s` = calendar days
in the full quasi-c