Record Class FixedLeg

java.lang.Object
java.lang.Record
com.quantfinlib.rates.FixedLeg
Record Components:
start - unadjusted effective date
end - unadjusted maturity
rate - fixed rate (decimal)
convention - schedule, day count, calendar and payment lag

public record FixedLeg(LocalDate start, LocalDate end, double rate, LegConvention convention) extends Record
The fixed leg of a VanillaSwap: coupons rate * tau_i paid on each period's payment date, with the schedule, day count, stub and payment lag from a LegConvention. Values are per unit notional.
  annuity = sum_{i: pay_i > valuation} tau_i P_d(pay_i)
  pv      = rate * annuity
  • Constructor Details

  • Method Details

    • periods

      public List<LegConvention.Period> periods()
      The leg's accrual periods.
      Returns:
      the periods, ascending
    • annuity

      public double annuity(DiscountCurve discount)
      Annuity per unit notional and unit rate, over the coupons not yet paid.
      Parameters:
      discount - discount curve
      Returns:
      the annuity
    • pv

      public double pv(DiscountCurve discount)
      PV per unit notional of the unpaid fixed coupons.
      Parameters:
      discount - discount curve
      Returns:
      present value
    • withRate

      public FixedLeg withRate(double newRate)
      The same leg with a different fixed rate.
      Parameters:
      newRate - fixed rate
      Returns:
      the new leg
    • 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
    • rate

      public double rate()
      Returns the value of the rate record component.
      Returns:
      the value of the rate record component
    • convention

      public LegConvention convention()
      Returns the value of the convention record component.
      Returns:
      the value of the convention record component