Class KnownAmountSwapLeg
- java.lang.Object
-
- com.opengamma.strata.product.swap.KnownAmountSwapLeg
-
- All Implemented Interfaces:
Resolvable<ResolvedSwapLeg>,ScheduledSwapLeg,SwapLeg,Serializable,org.joda.beans.Bean,org.joda.beans.ImmutableBean
public final class KnownAmountSwapLeg extends Object implements ScheduledSwapLeg, org.joda.beans.ImmutableBean, Serializable
A fixed swap leg defined in terms of known amounts.Most fixed swap legs are calculated based on a fixed rate of interest. By contrast, this leg defines a known payment amount for each period.
Each payment occurs relative to a payment period. The payment periods are calculated relative to the accrual periods. While the model allows the frequency of the accrual and payment periods to differ, this will have no effect, as the amounts to be paid at each payment date are known. This design is intended to match FpML.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classKnownAmountSwapLeg.BuilderThe bean-builder forKnownAmountSwapLeg.static classKnownAmountSwapLeg.MetaThe meta-bean forKnownAmountSwapLeg.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static KnownAmountSwapLeg.Builderbuilder()Returns a builder used to create an instance of the bean.voidcollectCurrencies(ImmutableSet.Builder<Currency> builder)Collects all the currencies referred to by this leg.voidcollectIndices(ImmutableSet.Builder<Index> builder)Collects all the indices referred to by this leg.booleanequals(Object obj)PeriodicSchedulegetAccrualSchedule()Gets the accrual period schedule.ValueSchedulegetAmount()Gets the known amount schedule.CurrencygetCurrency()Gets the currency of the swap leg.AdjustableDategetEndDate()Gets the accrual end date of the leg.PaymentSchedulegetPaymentSchedule()Gets the payment period schedule.PayReceivegetPayReceive()Gets whether the leg is pay or receive.AdjustableDategetStartDate()Gets the accrual start date of the leg.SwapLegTypegetType()Gets the type of the leg, such as Fixed or Ibor.inthashCode()static KnownAmountSwapLeg.Metameta()The meta-bean forKnownAmountSwapLeg.KnownAmountSwapLeg.MetametaBean()KnownAmountSwapLegreplaceStartDate(LocalDate adjustedStartDate)Returns an instance based on this leg with the start date replaced.ResolvedSwapLegresolve(ReferenceData refData)Converts this swap leg to the equivalentResolvedSwapLeg.KnownAmountSwapLeg.BuildertoBuilder()Returns a builder that allows this bean to be mutated.StringtoString()-
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:SwapLegGets 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:SwapLegGets 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:
getStartDatein interfaceSwapLeg- Returns:
- the start date of the leg
-
getEndDate
public AdjustableDate getEndDate()
Description copied from interface:SwapLegGets 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:
getEndDatein interfaceSwapLeg- Returns:
- the end date of the leg
-
collectCurrencies
public void collectCurrencies(ImmutableSet.Builder<Currency> builder)
Description copied from interface:SwapLegCollects 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:
collectCurrenciesin interfaceSwapLeg- Parameters:
builder- the builder to populate
-
collectIndices
public void collectIndices(ImmutableSet.Builder<Index> builder)
Description copied from interface:SwapLegCollects 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:
collectIndicesin interfaceSwapLeg- Parameters:
builder- the builder to populate
-
replaceStartDate
public KnownAmountSwapLeg replaceStartDate(LocalDate adjustedStartDate)
Returns an instance based on this leg with the start date replaced.This uses
PeriodicSchedule.replaceStartDate(LocalDate).- Specified by:
replaceStartDatein 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
ResolvedSwapLegrepresents the same data as this leg, but with a complete schedule of dates defined usingKnownAmountSwapPaymentPeriod.- Specified by:
resolvein interfaceResolvable<ResolvedSwapLeg>- Specified by:
resolvein 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 KnownAmountSwapLeg.Meta meta()
The meta-bean forKnownAmountSwapLeg.- Returns:
- the meta-bean, not null
-
builder
public static KnownAmountSwapLeg.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public KnownAmountSwapLeg.Meta metaBean()
- Specified by:
metaBeanin 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:
getPayReceivein interfaceSwapLeg- Returns:
- the value of the property, not null
-
getAccrualSchedule
public PeriodicSchedule getAccrualSchedule()
Gets the accrual period schedule.This is used to define the accrual periods. These are used directly or indirectly to determine other dates in the swap.
- Specified by:
getAccrualSchedulein interfaceScheduledSwapLeg- Returns:
- the value of the property, not null
-
getPaymentSchedule
public PaymentSchedule getPaymentSchedule()
Gets the payment period schedule.This is used to define the payment periods, including any compounding. The payment period dates are based on the accrual schedule.
- Specified by:
getPaymentSchedulein interfaceScheduledSwapLeg- Returns:
- the value of the property, not null
-
getAmount
public ValueSchedule getAmount()
Gets the known amount schedule.This defines the schedule of known amounts, relative to the payment schedule. The schedule is defined as an initial amount, with optional changes during the tenor of the swap. The amount is only permitted to change at payment period boundaries.
Note that the date of the payment is implied by the payment schedule. Any dates in the known amount schedule refer to the payment schedule, not the payment date.
For example, consider a two year swap where each payment period is 3 months long. This schedule could define two entries, one that defines the payment amounts as GBP 1000 for the first year and one that defines the amount as GBP 500 for the second year. In this case there will be eight payments in total, four payments of GBP 1000 in the first year and four payments of GBP 500 in the second year. Each payment will occur on the date specified using the offset in
PaymentSchedule.- Returns:
- the value of the property, not null
-
getCurrency
public Currency getCurrency()
Gets the currency of the swap leg.This is the currency of the known payments.
- Specified by:
getCurrencyin interfaceSwapLeg- Returns:
- the value of the property, not null
-
toBuilder
public KnownAmountSwapLeg.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-