Repository navigation
Choose the coupons in BondFuture.implied_repo_rate the way Bond.forward_price does - #490
Open
QuantIntellect wants to merge 1 commit into
Open
QuantIntellect wants to merge 1 commit into
QuantIntellect wants to merge 1 commit into
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A follow-up to #487, as offered there.
implied_repo_ratecounts 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: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:
implied_repo_ratealso no longer invertsforward_price, whichtest_implied_repo_inverts_forward_pricechecks, becauseforward_pricehas chosen the coupons withBond._cpns_heldsince #487.Change
implied_repo_ratenow takes the coupons frombond._cpns_held(settle_dt, delivery_dt)and weights each one from its payment date, asforward_pricedoes. A coupon kept in an ex-dividend period at delivery is paid after delivery, so its weight is negative, like its carry inforward_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_datesrepeats 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.