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 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 a InterestRateSwap record class.
      Parameters:
      start - the value for the start record component
      end - the value for the end record component
      fixedRate - the value for the fixedRate record component
      fixedPerYear - the value for the fixedPerYear record component
      fixedDayCount - the value for the fixedDayCount record component
      floatPerYear - the value for the floatPerYear record component
      floatDayCount - the value for the floatDayCount record component
      calendar - the value for the calendar record component
      roll - the value for the roll record component
  • Method Details

    • fixedPaymentDates

      public List<LocalDate> fixedPaymentDates()
    • floatPaymentDates

      public List<LocalDate> floatPaymentDates()
    • annuity

      public double annuity(DiscountCurve discount)
      Fixed-leg annuity on the discount curve, per unit notional and unit rate.
    • floatLegPv

      public double floatLegPv(DiscountCurve discount, DiscountCurve projection)
      PV of the floating leg per unit notional.
    • parRate

      public double parRate(DiscountCurve discount, DiscountCurve projection)
      Par fixed rate.
    • payerPv

      public double payerPv(DiscountCurve discount, DiscountCurve projection)
      PV per unit notional of paying fixedRate() and receiving floating.
    • pillarDate

      public LocalDate pillarDate()
      Description copied from interface: CurveInstrument
      The last date the instrument depends on; the bootstrap places a pillar there.
      Specified by:
      pillarDate in interface CurveInstrument
    • quote

      public double quote()
      Description copied from interface: CurveInstrument
      The market quote as a decimal rate (0.03 = 3%).
      Specified by:
      quote in interface CurveInstrument
    • withQuote

      public InterestRateSwap withQuote(double quote)
      Description copied from interface: CurveInstrument
      The same instrument with a different quote (used for bump-and-rebuild risk).
      Specified by:
      withQuote in interface CurveInstrument
    • impliedQuote

      public double impliedQuote(DiscountCurve discount, DiscountCurve projection)
      Description copied from interface: CurveInstrument
      The quote implied by the curves, in the units of CurveInstrument.quote().
      Specified by:
      impliedQuote in interface CurveInstrument
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • start

      public LocalDate start()
      Returns the value of the start record component.
      Returns:
      the value of the start record component
    • end

      public LocalDate end()
      Returns the value of the end record component.
      Returns:
      the value of the end record component
    • fixedRate

      public double fixedRate()
      Returns the value of the fixedRate record component.
      Returns:
      the value of the fixedRate record component
    • fixedPerYear

      public int fixedPerYear()
      Returns the value of the fixedPerYear record component.
      Returns:
      the value of the fixedPerYear record component
    • fixedDayCount

      public DayCount fixedDayCount()
      Returns the value of the fixedDayCount record component.
      Returns:
      the value of the fixedDayCount record component
    • floatPerYear

      public int floatPerYear()
      Returns the value of the floatPerYear record component.
      Returns:
      the value of the floatPerYear record component
    • floatDayCount

      public DayCount floatDayCount()
      Returns the value of the floatDayCount record component.
      Returns:
      the value of the floatDayCount record component
    • calendar

      public BusinessCalendar calendar()
      Returns the value of the calendar record component.
      Returns:
      the value of the calendar record component
    • roll

      public BusinessCalendar.Roll roll()
      Returns the value of the roll record component.
      Returns:
      the value of the roll record component