Record Class InterestRateSwap
java.lang.Object
java.lang.Record
com.quantfinlib.rates.InterestRateSwap
- All Implemented Interfaces:
CurveInstrument
public record InterestRateSwap(LocalDate start, LocalDate end, double fixedRate, int fixedPerYear, DayCount fixedDayCount, int floatPerYear, DayCount floatDayCount, BusinessCalendar calendar, BusinessCalendar.Roll roll)
extends Record
implements CurveInstrument
A vanilla fixed-for-floating interest rate swap in the multi-curve
framework: the floating coupons are projected off a projection curve
(for example 3M) and both legs are discounted on the OIS curve
(collateralised pricing; Bianchetti 2010, "Two curves, one price", Risk
23(8); Ametrano and Bianchetti 2013, "Everything you always wanted to
know about multiple interest rate curve bootstrapping but were afraid to
ask", SSRN 2219548).
annuity A = sum_i tau_i P_d(t_i) fixed leg, per unit rate
float V_flt = sum_j tau_j F_j P_d(t_j), F_j = (P_p(t_{j-1})/P_p(t_j) - 1)/tau_j
par K_par = V_flt / A
payer PV = V_flt - K A
Simplifications stated: the index fixes on the accrual period itself
(no fixing lag or index-tenor mismatch), payment on the accrual end date,
and both legs share the calendar and roll. When the projection curve is
the discount curve and both legs share a schedule and day count, the float
leg telescopes to P(start) - P(end) (the single-curve identity).
-
Constructor Summary
ConstructorsConstructorDescriptionInterestRateSwap(LocalDate start, LocalDate end, double fixedRate, int fixedPerYear, DayCount fixedDayCount, int floatPerYear, DayCount floatDayCount, BusinessCalendar calendar, BusinessCalendar.Roll roll) Creates an instance of aInterestRateSwaprecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoubleannuity(DiscountCurve discount) Fixed-leg annuity on the discount curve, per unit notional and unit rate.calendar()Returns the value of thecalendarrecord component.end()Returns the value of theendrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefixedDayCountrecord component.intReturns the value of thefixedPerYearrecord component.doubleReturns the value of thefixedRaterecord component.Returns the value of thefloatDayCountrecord component.doublefloatLegPv(DiscountCurve discount, DiscountCurve projection) PV of the floating leg per unit notional.intReturns the value of thefloatPerYearrecord component.final inthashCode()Returns a hash code value for this object.doubleimpliedQuote(DiscountCurve discount, DiscountCurve projection) The quote implied by the curves, in the units ofCurveInstrument.quote().doubleparRate(DiscountCurve discount, DiscountCurve projection) Par fixed rate.doublepayerPv(DiscountCurve discount, DiscountCurve projection) PV per unit notional of payingfixedRate()and receiving floating.The last date the instrument depends on; the bootstrap places a pillar there.doublequote()The market quote as a decimal rate (0.03 = 3%).roll()Returns the value of therollrecord component.start()Returns the value of thestartrecord component.final StringtoString()Returns a string representation of this record class.withQuote(double quote) The same instrument with a different quote (used for bump-and-rebuild risk).
-
Constructor Details
-
InterestRateSwap
public InterestRateSwap(LocalDate start, LocalDate end, double fixedRate, int fixedPerYear, DayCount fixedDayCount, int floatPerYear, DayCount floatDayCount, BusinessCalendar calendar, BusinessCalendar.Roll roll) Creates an instance of aInterestRateSwaprecord class.- Parameters:
start- the value for thestartrecord componentend- the value for theendrecord componentfixedRate- the value for thefixedRaterecord componentfixedPerYear- the value for thefixedPerYearrecord componentfixedDayCount- the value for thefixedDayCountrecord componentfloatPerYear- the value for thefloatPerYearrecord componentfloatDayCount- the value for thefloatDayCountrecord componentcalendar- the value for thecalendarrecord componentroll- the value for therollrecord component
-
-
Method Details
-
fixedPaymentDates
-
floatPaymentDates
-
annuity
Fixed-leg annuity on the discount curve, per unit notional and unit rate. -
floatLegPv
PV of the floating leg per unit notional. -
parRate
Par fixed rate. -
payerPv
PV per unit notional of payingfixedRate()and receiving floating. -
pillarDate
Description copied from interface:CurveInstrumentThe last date the instrument depends on; the bootstrap places a pillar there.- Specified by:
pillarDatein interfaceCurveInstrument
-
quote
public double quote()Description copied from interface:CurveInstrumentThe market quote as a decimal rate (0.03 = 3%).- Specified by:
quotein interfaceCurveInstrument
-
withQuote
Description copied from interface:CurveInstrumentThe same instrument with a different quote (used for bump-and-rebuild risk).- Specified by:
withQuotein interfaceCurveInstrument
-
impliedQuote
Description copied from interface:CurveInstrumentThe quote implied by the curves, in the units ofCurveInstrument.quote().- Specified by:
impliedQuotein interfaceCurveInstrument
-
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
Returns the value of thestartrecord component.- Returns:
- the value of the
startrecord component
-
end
Returns the value of theendrecord component.- Returns:
- the value of the
endrecord component
-
fixedRate
public double fixedRate()Returns the value of thefixedRaterecord component.- Returns:
- the value of the
fixedRaterecord component
-
fixedPerYear
public int fixedPerYear()Returns the value of thefixedPerYearrecord component.- Returns:
- the value of the
fixedPerYearrecord component
-
fixedDayCount
Returns the value of thefixedDayCountrecord component.- Returns:
- the value of the
fixedDayCountrecord component
-
floatPerYear
public int floatPerYear()Returns the value of thefloatPerYearrecord component.- Returns:
- the value of the
floatPerYearrecord component
-
floatDayCount
Returns the value of thefloatDayCountrecord component.- Returns:
- the value of the
floatDayCountrecord component
-
calendar
Returns the value of thecalendarrecord component.- Returns:
- the value of the
calendarrecord component
-
roll
Returns the value of therollrecord component.- Returns:
- the value of the
rollrecord component
-