Function Z Spread within with keys returns the Z-spread(s) of the referenced bond(s) as of a given reference date Tˢ
Here the Z-spread is defined as the single rate z that when added to the time-dependent "risk-free" rate r, produces the time-dependent rate r+z, which when used to discount all future bond cash flows down to time Tˢ, the resulting present value equals the given dirty bond price at the same time Tˢ
This function requires the input of a "risk-free" curve - a treasury or swap curve - that is used to imply the time-dependent rate r
It also needs the bond as of time Tˢ, so that the respective dirty price can be calculated.
If the settlement date Tˢ is not explicitly given, it will be set to the bond's settlement date as implied by a trade transaction assumed to occur on the T₀ (typically today).
PRECAUTION: This function treats the referenced bond as if it were a fixed rate bond even if this is not the case!
All index-linked cash flows are treated as fixed cash flows that pay the amount forecasted by the corresponding curve.