Skip to content

Choose the coupons in BondFuture.implied_repo_rate the way Bond.forward_price does - #490

Open
QuantIntellect wants to merge 1 commit into
FinancePy-Org:masterfrom
QuantIntellect:fix/implied-repo-coupons
Open

QuantIntellect wants to merge 1 commit into
FinancePy-Org:masterfrom
QuantIntellect:fix/implied-repo-coupons

Conversation

@QuantIntellect

Copy link
Copy Markdown
Contributor

A follow-up to #487, as offered there. implied_repo_rate counts the coupons dated after settlement and on or before delivery. The full price and the invoice amount it starts from follow the ex-dividend rule:

  • A bond settled ex-dividend has negative accrued interest, and its buyer doesn't get the next coupon.
  • A bond delivered ex-dividend has negative accrued interest because the seller keeps the next coupon.

So with ex-dividend days, the implied repo rate jumps when settlement or delivery moves into an ex-dividend window. The example is a 4% bond like a gilt (coupons go ex-dividend 7 UK business days before the coupon date, so the 7 Sep 2026 coupon goes ex on 26 Aug), with a clean price of 100 and a futures price of 100:

on 26 Aug 2026 on 27 Aug 2026
settlement (delivery 29 Sep 2026), master 3.9324% 26.1545%
settlement (delivery 29 Sep 2026), this PR 3.9324% 3.9610%
delivery (settlement 1 Jun 2026), master 3.8768% -4.3224%
delivery (settlement 1 Jun 2026), this PR 3.8768% 3.8671%

implied_repo_rate also no longer inverts forward_price, which test_implied_repo_inverts_forward_price checks, because forward_price has chosen the coupons with Bond._cpns_held since #487.

Change

implied_repo_rate now takes the coupons from bond._cpns_held(settle_dt, delivery_dt) and weights each one from its payment date, as forward_price does. A coupon kept in an ex-dividend period at delivery is paid after delivery, so its weight is negative, like its carry in forward_price. Bonds without ex-dividend days whose coupons are paid on their coupon dates give the same results as before.

Tests

test_implied_repo_inverts_forward_price_around_ex_dividend_dates repeats the inversion test with an ex-dividend bond. Its cases are settlement ex-dividend, delivery ex-dividend, a coupon paid after delivery, ex-dividend at both dates, and a coupon dated on a Sunday and paid on the Monday. On master, 8 of the 10 cases fail. The two that pass are ex-dividend at both dates, where no coupon is held.

With the change, the unit tests pass (2,090), and the bond futures regression test matches its golden file.

…rd_price does

implied_repo_rate counted the coupons dated after settlement and on or
before delivery, by coupon date. The prices it starts from use the
ex-dividend rule: a bond settled ex-dividend has negative accrued
interest and its buyer doesn't get the next coupon, and a bond delivered
ex-dividend keeps the next coupon for the seller. So with ex-dividend
days the implied repo rate jumped by about the coupon over the holding
period when settlement or delivery moved into the ex-dividend window,
and it no longer inverted forward_price, which uses Bond._cpns_held
since the coupon fix there.

Use Bond._cpns_held for the coupons and weight each from its payment
date, as forward_price does. Bonds without ex-dividend days and with
coupons paid on their coupon dates give the same results as before.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant