Record Class LegConvention
java.lang.Object
java.lang.Record
com.quantfinlib.rates.LegConvention
- Record Components:
paymentsPerYear- payments per year, a divisor of 12dayCount- accrual day count of the legcalendar- business-day calendar for rolls and the payment lagroll- roll convention for accrual datesstub- where an irregular period goesendOfMonth- end-of-month rule for the unadjusted schedulepaymentLagDays- business days from accrual end to payment,>= 0
public record LegConvention(int paymentsPerYear, DayCount dayCount, BusinessCalendar calendar, BusinessCalendar.Roll roll, BusinessCalendar.StubType stub, boolean endOfMonth, int paymentLagDays)
extends Record
The schedule and accrual conventions of one swap leg: how often it pays,
how a period's year fraction is measured, which calendar and roll adjust
the dates, where a stub goes, and how many business days after the accrual
end the payment is made.
The plain idea: two swaps with the same dates and rates can differ in
value only through these fields, so they are stated once per leg instead
of being assumed (the SwapPricer methods on a
YieldCurve, removed in 4.0, assumed an annual fixed leg with tau = 1).
Formally, the unadjusted period ends come from
BusinessCalendar.unadjustedSchedule(LocalDate, LocalDate, int, BusinessCalendar.StubType, boolean);
accrual dates are those dates rolled with roll (the start
included); the payment date of a period ending at e is
calendar.addBusinessDays(e, paymentLagDays). A SOFR OIS under the
ISDA 2021 / ARRC convention is (1, ACT_360, US calendar,
MODIFIED_FOLLOWING, SHORT_FRONT, false, 2).
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionLegConvention(int paymentsPerYear, DayCount dayCount, BusinessCalendar calendar, BusinessCalendar.Roll roll, BusinessCalendar.StubType stub, boolean endOfMonth, int paymentLagDays) Validates the fields. -
Method Summary
Modifier and TypeMethodDescriptioncalendar()Returns the value of thecalendarrecord component.dayCount()Returns the value of thedayCountrecord component.booleanReturns the value of theendOfMonthrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static LegConventionof(int paymentsPerYear, DayCount dayCount, BusinessCalendar calendar, BusinessCalendar.Roll roll) A convention with a short front stub, no end-of-month rule and no payment lag.intReturns the value of thepaymentLagDaysrecord component.intReturns the value of thepaymentsPerYearrecord component.The accrual periods of a leg fromstarttoend(unadjusted dates), ascending, with adjusted accrual dates and payment dates.roll()Returns the value of therollrecord component.stub()Returns the value of thestubrecord component.final StringtoString()Returns a string representation of this record class.withPaymentLag(int days) The same convention with a different payment lag.withStub(BusinessCalendar.StubType stubType) The same convention with a different stub type.
-
Constructor Details
-
LegConvention
public LegConvention(int paymentsPerYear, DayCount dayCount, BusinessCalendar calendar, BusinessCalendar.Roll roll, BusinessCalendar.StubType stub, boolean endOfMonth, int paymentLagDays) Validates the fields.
-
-
Method Details
-
of
public static LegConvention of(int paymentsPerYear, DayCount dayCount, BusinessCalendar calendar, BusinessCalendar.Roll roll) A convention with a short front stub, no end-of-month rule and no payment lag.- Parameters:
paymentsPerYear- payments per year, a divisor of 12dayCount- accrual day countcalendar- business-day calendarroll- roll convention- Returns:
- the convention
-
withPaymentLag
The same convention with a different payment lag.- Parameters:
days- business days from accrual end to payment- Returns:
- the new convention
-
withStub
The same convention with a different stub type.- Parameters:
stubType- where the irregular period goes- Returns:
- the new convention
-
periods
The accrual periods of a leg fromstarttoend(unadjusted dates), ascending, with adjusted accrual dates and payment dates.- Parameters:
start- unadjusted effective dateend- unadjusted maturity date- Returns:
- the periods, at least one
-
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. -
paymentsPerYear
public int paymentsPerYear()Returns the value of thepaymentsPerYearrecord component.- Returns:
- the value of the
paymentsPerYearrecord component
-
dayCount
-
calendar
-
roll
-
stub
-
endOfMonth
public boolean endOfMonth()Returns the value of theendOfMonthrecord component.- Returns:
- the value of the
endOfMonthrecord component
-
paymentLagDays
public int paymentLagDays()Returns the value of thepaymentLagDaysrecord component.- Returns:
- the value of the
paymentLagDaysrecord component
-