Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lookback and lockout to the overnight coupon #1985

Merged

Conversation

marcin-rybacki
Copy link
Contributor

@marcin-rybacki marcin-rybacki commented May 31, 2024

In this PR I would like to add new functionality allowing to handle lookbacks, with and without observation shifts, and lockouts in the overnight indexed coupon.

The methodology for lookbacks and lockouts is outlined in a document by NY FED (pages 16-22).
Excel examples, based on which the unit tests were created, can also be found on the NY FED website.

Lookback days do not need to define a separate member in the OvernightIndexedCoupon class, instead utilize the fixingDays_ member, because it already serves that purpose. It should be noted however that applying a lookback (with or without observation shift) might make it not possible to apply the telescopic formula and each fixing within the compounded coupon will have to be projected separately. This has to do with the fact that the value dates (and their accrual) over which the fixing is projected will no longer cancel out with the accrual of the interest period for that fixing.

To further elaborate on this, we can define a single SOFR rate projection $F(T_{i}^{V}, T_{i+1}^{V})$ as:

$$ F(T_{i}^{V}, T_{i+1}^{V}) = \left [ \frac{P(t,T_{i}^{V})}{P(t,T_{i+1}^{V})} - 1 \right ]\frac{1}{\alpha (T_{i}^{V}T_{i+1}^{V})}, $$

where $P(t,T)$ is a discount factor at time $T$, and $\alpha (T_{i}^{V},T_{i+1}^{V})$ is a time fraction between value dates $T_{i}^{V}$ and $T_{i+1}^{V}$.

Now, if we consider the formula for the compounded rate $FC(T_{J},T_{K})$ over the coupon period $T_{J},T_{K}$:

$$ FC(T_{J},T_{K}) = \left [ \prod_{k=J}^{K-1} \left ( 1+\alpha(T_{k}^{I},T_{k+1}^{I})F(T_{k}^{V},T_{k+1}^{V}) \right ) - 1 \right ] \frac{1}{\alpha (T_{J},T_{K})},$$

we can see that each fixing in the compounded rate is accrued at $\alpha(T_{i}^{I},T_{i+1}^{I})$. In case where there's lookback the interest $T_{i}^{I},T_{i+1}^{I}$ and value date periods $T_{i}^{V},T_{i+1}^{V}$ will not be the same and the telescopic formula will not be applicable. Also in case of an observation shift these periods might not be the same. This has to do with the fact that value dates are defined relative to the fixing date based on the fixing delay of an interest rate index. When the lookback period in the coupon is different than the fixing delay in the index, even the observation shift will not align value dates with interest dates.

It can be shown that the same applies to lockout periods. Value dates (at which the projection is calculated) correspond to the locked-out fixing, while the interest dates (at which the interest over that fixing is accrued) are not fixed at lockout, hence they do not cancel out.

Where possible, I tried to enrich the comments in the code addressing those issues.

The changes to the coupon pricer are quite significant, so I would appreciate any feedback - also given the complexity of the calculations, especially for coupon projections. I implemented unit tests that should address the corner cases, but I might have omitted/overlooked something.

This PR addresses #1422.

@coveralls
Copy link

coveralls commented May 31, 2024

Coverage Status

coverage: 72.571% (+0.02%) from 72.55%
when pulling aada199 on marcin-rybacki:overnight-coupon-lookback-lockout
into b9d94ca on lballabio:master.

@lballabio
Copy link
Owner

Thanks! When the index has 0 intrinsic fixings days and observation shift is used, do you think it would be possible to use the telescopic property?

@marcin-rybacki
Copy link
Contributor Author

Thanks! When the index has 0 intrinsic fixings days and observation shift is used, do you think it would be possible to use the telescopic property?

I would say that is a corner case where telescopic property can be applied. Thank you for pointing that out. I will add a proper check.

@lballabio
Copy link
Owner

Thanks! I assume all we need to give the same features to overnight interest swaps is to add the new parameters to the constructor and forward them to OvernightLeg, right? If so, I can do it if you're busy.

@marcin-rybacki
Copy link
Contributor Author

Thanks! I assume all we need to give the same features to overnight interest swaps is to add the new parameters to the constructor and forward them to OvernightLeg, right? If so, I can do it if you're busy.

Yes, I think that is all we need to do. I can do it still in this PR, if that's ok.

@lballabio
Copy link
Owner

That would be great, thanks.

@lballabio lballabio merged commit da4560c into lballabio:master Jun 24, 2024
41 checks passed
@lballabio lballabio added this to the Release 1.35 milestone Jun 24, 2024
@lballabio
Copy link
Owner

I'm guessing that quoted swaps can have these features, too, meaning that we'll need to support them in OISRateHelper as well—is this correct?

@lballabio
Copy link
Owner

If that's the case, please have a look at #1998 and tell me if you think it's ok.

@marcin-rybacki
Copy link
Contributor Author

I'm guessing that quoted swaps can have these features, too, meaning that we'll need to support them in OISRateHelper as well—is this correct?

Good idea!
Those features would be mostly added to issued bonds or loans, depending on the requirements of treasury departments. There could be some swaps offered to hedge those. Still, it's nice to have the helper support it.

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.

None yet

3 participants