Function Carry within with keys returns the at-the-money carry C of the referenced swap between the T₀ and a horizon date Tʰ, with T₀ < Tʰ in a given market environment defined by a discounting and forecasting curve represented as objects of type
Web blog examples here and here
C is defined like in Bloomberg, as this screenshot shows:
Accordingly, C is calculated as the par swap rate from horizon date to maturity minus the par rate from swap start to maturity, in bps per annum.
C = rʰ - r₀
r₀ is the swap's fair rate as of T₀ using the supplied yield curves, which is defined as the rate the swap's fixed leg ought to have so that its PV at T₀ to equal 0.
rʰ is the fair rate as of T₀ of a forward swap that starts at the horizon date Tʰ, which is defined as the rate the forward swap's fixed leg ought to have so that its PV at T₀ to equal 0.
There exist two different methods for calculating the rate rʰ that can be selected through the optional key
Download the workbooks irs-carryroll.xlsx and ois-carryroll.xlsx that demonstrate both methods described here.
The first method is the default and corresponds to the key set to , whereby the swap is kept as it is and the fair rate rʰ is calculated by using a modified discounting curve produced by forcing all discount factors of the initial discounting curve maturing before Tʰ to equal 0.
The second method corresponds to the key set to , whereby the swap is replaced by one that starts at Tʰ
The Bloomberg phrase par swap rate from horizon date to maturity allows some room to ambiguity in those cases where the date Tʰ falls inside an accrual period of either the fixed or the floating leg of the swap.
It alludes to a swap extending from Tʰ to Tᵐ, where Tᵐ is the maturity of the original swap.
But in the mentioned case, it is not clear what the first cash flow - the one that occurs at the end of the broken accrual period - should be!
Deriscope supports two treatments specified through the key
In the same case, there is also ambiguity regarding how the floating index of the first cash flow is defined.
Then the key can be used to select the desired definition.