Record Class OvernightLeg
- Record Components:
start- unadjusted effective dateend- unadjusted maturityspread- spread added to the compounded rate (simple, not compounded)convention- schedule, day count, calendar and payment lagovernight- lookback, shift and lockoutfixings- published fixings of the index
- All Implemented Interfaces:
FloatLeg
The plain idea: each coupon is the daily-compounded overnight rate over
its period plus a spread. Days before the valuation date use the published
fixings in FixingHistory; later days are forecast as the one-day
simple forward of the projection curve, r(f) = (P(f)/P(f+1bd) - 1)/alpha.
Formal statement (ISDA 2021 section 6.9; OvernightConvention
gives the lookback L, shift flag and lockout k): with business days
o_0 < ... < o_n of the observation window ([s, e], or
[s - L, e - L] in business days under a shift), and
alpha_i = dayCount.yearFraction(o_i, o_{i+1}),
R = ( prod_{i<n} (1 + r_i alpha_i) - 1 ) / sum_{i<n} alpha_i
where r_i is the fixing for o_i under a shift, or for
o_i - L business days without one (the weights then stay on the
accrual days); the last k rates are replaced by r_{n-k-1}. The
coupon (R + spread) * tau is paid on the period's payment date.
Worked example: with OvernightConvention.IN_ARREARS, no
spread, no payment lag and projection = discount curve, the leg PV
telescopes to P(start) - P(end), the value OisSwap uses; the
tests pin that to 1e-13 (roundoff over the daily product) and cross-check the conventions against QuantLib
output (golden file golden/quantlib-sofr.csv).
-
Constructor Summary
ConstructorsConstructorDescriptionOvernightLeg(LocalDate start, LocalDate end, double spread, LegConvention convention, OvernightConvention overnight, FixingHistory fixings) Validates the fields. -
Method Summary
Modifier and TypeMethodDescriptiondoublecompoundedRate(LocalDate accrualStart, LocalDate accrualEnd, DiscountCurve projection) The compounded overnight rate (no spread) for an accrual period.Returns the value of theconventionrecord component.doublecouponRate(LegConvention.Period period, DiscountCurve projection) The coupon rate (index rate plus spread) of one period, from published fixings where they exist and the projection curve otherwise.end()Returns the value of theendrecord component.final booleanIndicates whether some other object is "equal to" this one.fixings()Returns the value of thefixingsrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of theovernightrecord component.periods()The leg's accrual periods.doublespread()Returns the value of thespreadrecord component.start()Returns the value of thestartrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
OvernightLeg
public OvernightLeg(LocalDate start, LocalDate end, double spread, LegConvention convention, OvernightConvention overnight, FixingHistory fixings) Validates the fields.
-
-
Method Details
-
periods
Description copied from interface:FloatLegThe leg's accrual periods. -
couponRate
Description copied from interface:FloatLegThe coupon rate (index rate plus spread) of one period, from published fixings where they exist and the projection curve otherwise.- Specified by:
couponRatein interfaceFloatLeg- Parameters:
period- one ofFloatLeg.periods()projection- projection curve (its valuation date is the valuation date)- Returns:
- the annualised coupon rate
-
compoundedRate
public double compoundedRate(LocalDate accrualStart, LocalDate accrualEnd, DiscountCurve projection) The compounded overnight rate (no spread) for an accrual period.- Parameters:
accrualStart- adjusted accrual startaccrualEnd- adjusted accrual endprojection- curve forecasting fixings on or after its valuation date- Returns:
- the annualised compounded rate
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
start
-
end
-
spread
-
convention
Returns the value of theconventionrecord component.- Returns:
- the value of the
conventionrecord component
-
overnight
-
fixings
-