Class RateCalculationSwapLeg
- java.lang.Object
-
- com.opengamma.strata.product.swap.RateCalculationSwapLeg
-
- All Implemented Interfaces:
Resolvable<ResolvedSwapLeg>
,ScheduledSwapLeg
,SwapLeg
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class RateCalculationSwapLeg extends Object implements ScheduledSwapLeg, org.joda.beans.ImmutableBean, Serializable
A rate swap leg defined using a parameterized schedule and calculation.This defines a single swap leg paying a rate, such as an interest rate. The rate may be fixed or floating, see
FixedRateCalculation
,IborRateCalculation
andOvernightRateCalculation
.Interest is calculated based on accrual periods which follow a regular schedule with optional initial and final stubs. Coupon payments are based on payment periods which are typically the same as the accrual periods. If the payment period is longer than the accrual period then compounding may apply. The schedule of periods is defined using
PeriodicSchedule
,PaymentSchedule
,NotionalSchedule
andResetSchedule
.If the schedule needs to be manually specified, or there are other unusual calculation rules then the
RatePeriodSwapLeg
class should be used instead.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RateCalculationSwapLeg.Builder
The bean-builder forRateCalculationSwapLeg
.static class
RateCalculationSwapLeg.Meta
The meta-bean forRateCalculationSwapLeg
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RateCalculationSwapLeg.Builder
builder()
Returns a builder used to create an instance of the bean.void
collectCurrencies(ImmutableSet.Builder<Currency> builder)
Collects all the currencies referred to by this leg.void
collectIndices(ImmutableSet.Builder<Index> builder)
Collects all the indices referred to by this leg.boolean
equals(Object obj)
PeriodicSchedule
getAccrualSchedule()
Gets the accrual schedule.RateCalculation
getCalculation()
Gets the interest rate accrual calculation.Currency
getCurrency()
Gets the payment currency of the leg.AdjustableDate
getEndDate()
Gets the accrual end date of the leg.NotionalSchedule
getNotionalSchedule()
Gets the notional schedule.PaymentSchedule
getPaymentSchedule()
Gets the payment schedule.PayReceive
getPayReceive()
Gets whether the leg is pay or receive.AdjustableDate
getStartDate()
Gets the accrual start date of the leg.SwapLegType
getType()
Gets the type of the leg, such as Fixed or Ibor.int
hashCode()
static RateCalculationSwapLeg.Meta
meta()
The meta-bean forRateCalculationSwapLeg
.RateCalculationSwapLeg.Meta
metaBean()
RateCalculationSwapLeg
replaceStartDate(LocalDate adjustedStartDate)
Returns an instance based on this leg with the start date replaced.ResolvedSwapLeg
resolve(ReferenceData refData)
Converts this swap leg to the equivalentResolvedSwapLeg
.RateCalculationSwapLeg.Builder
toBuilder()
Returns a builder that allows this bean to be mutated.String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.opengamma.strata.product.swap.SwapLeg
allCurrencies, allIndices
-
-
-
-
Method Detail
-
getType
public SwapLegType getType()
Description copied from interface:SwapLeg
Gets the type of the leg, such as Fixed or Ibor.This provides a high level categorization of the swap leg.
-
getStartDate
public AdjustableDate getStartDate()
Description copied from interface:SwapLeg
Gets the accrual start date of the leg.This is the first accrual date in the leg, often known as the effective date.
Defined as the effective date by the 2006 ISDA definitions article 3.2.
- Specified by:
getStartDate
in interfaceSwapLeg
- Returns:
- the start date of the leg
-
getEndDate
public AdjustableDate getEndDate()
Description copied from interface:SwapLeg
Gets the accrual end date of the leg.This is the last accrual date in the leg, often known as the termination date.
Defined as the termination date by the 2006 ISDA definitions article 3.3.
- Specified by:
getEndDate
in interfaceSwapLeg
- Returns:
- the end date of the leg
-
getCurrency
public Currency getCurrency()
Description copied from interface:SwapLeg
Gets the payment currency of the leg.A swap leg has a single payment currency.
- Specified by:
getCurrency
in interfaceSwapLeg
- Returns:
- the payment currency of the leg
-
collectCurrencies
public void collectCurrencies(ImmutableSet.Builder<Currency> builder)
Description copied from interface:SwapLeg
Collects all the currencies referred to by this leg.This collects the complete set of currencies for the leg, not just the payment currencies.
- Specified by:
collectCurrencies
in interfaceSwapLeg
- Parameters:
builder
- the builder to populate
-
collectIndices
public void collectIndices(ImmutableSet.Builder<Index> builder)
Description copied from interface:SwapLeg
Collects all the indices referred to by this leg.A swap leg will typically refer to at least one index, such as 'GBP-LIBOR-3M'. Each index that is referred to must be added to the specified builder.
- Specified by:
collectIndices
in interfaceSwapLeg
- Parameters:
builder
- the builder to populate
-
replaceStartDate
public RateCalculationSwapLeg replaceStartDate(LocalDate adjustedStartDate)
Returns an instance based on this leg with the start date replaced.This uses
PeriodicSchedule.replaceStartDate(LocalDate)
.- Specified by:
replaceStartDate
in interfaceSwapLeg
- Parameters:
adjustedStartDate
- the new adjusted start date- Returns:
- the updated leg
- Throws:
IllegalArgumentException
- if the start date cannot be replaced with the proposed start date
-
resolve
public ResolvedSwapLeg resolve(ReferenceData refData)
Converts this swap leg to the equivalentResolvedSwapLeg
.An
ResolvedSwapLeg
represents the same data as this leg, but with a complete schedule of dates defined usingRatePaymentPeriod
.- Specified by:
resolve
in interfaceResolvable<ResolvedSwapLeg>
- Specified by:
resolve
in interfaceSwapLeg
- Parameters:
refData
- the reference data to use when resolving- Returns:
- the equivalent resolved swap leg
- Throws:
ReferenceDataNotFoundException
- if an identifier cannot be resolved in the reference dataRuntimeException
- if unable to resolve due to an invalid swap schedule or definition
-
meta
public static RateCalculationSwapLeg.Meta meta()
The meta-bean forRateCalculationSwapLeg
.- Returns:
- the meta-bean, not null
-
builder
public static RateCalculationSwapLeg.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public RateCalculationSwapLeg.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getPayReceive
public PayReceive getPayReceive()
Gets whether the leg is pay or receive.A value of 'Pay' implies that the resulting amount is paid to the counterparty. A value of 'Receive' implies that the resulting amount is received from the counterparty. Note that negative interest rates can result in a payment in the opposite direction to that implied by this indicator.
- Specified by:
getPayReceive
in interfaceSwapLeg
- Returns:
- the value of the property, not null
-
getAccrualSchedule
public PeriodicSchedule getAccrualSchedule()
Gets the accrual schedule.This is used to define the accrual periods. These are used directly or indirectly to determine other dates in the swap.
- Specified by:
getAccrualSchedule
in interfaceScheduledSwapLeg
- Returns:
- the value of the property, not null
-
getPaymentSchedule
public PaymentSchedule getPaymentSchedule()
Gets the payment schedule.This is used to define the payment periods, including any compounding. The payment period dates are based on the accrual schedule.
- Specified by:
getPaymentSchedule
in interfaceScheduledSwapLeg
- Returns:
- the value of the property, not null
-
getNotionalSchedule
public NotionalSchedule getNotionalSchedule()
Gets the notional schedule.The notional amount schedule, which can vary during the lifetime of the swap. In most cases, the notional amount is not exchanged, with only the net difference being exchanged. However, in certain cases, initial, final or intermediate amounts are exchanged.
- Returns:
- the value of the property, not null
-
getCalculation
public RateCalculation getCalculation()
Gets the interest rate accrual calculation.Different kinds of swap leg are determined by the subclass used here. See
FixedRateCalculation
,IborRateCalculation
andOvernightRateCalculation
.- Returns:
- the value of the property, not null
-
toBuilder
public RateCalculationSwapLeg.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-