## Class ResolvedSwapLeg

• java.lang.Object
• com.opengamma.strata.product.swap.ResolvedSwapLeg
• All Implemented Interfaces:
java.io.Serializable, Bean, ImmutableBean

public final class ResolvedSwapLeg
extends java.lang.Object
implements ImmutableBean, java.io.Serializable
A resolved swap leg, with dates calculated ready for pricing.

A swap is a financial instrument that represents the exchange of streams of payments. The swap is formed of legs, where each leg typically represents the obligations of the seller or buyer of the swap.

This class defines a single swap leg in the form of a list of payment periods. Each payment period typically consists of one or more accrual periods.

Any combination of payment and accrual periods is supported in the data model, however there is no guarantee that exotic combinations will price sensibly.

All periods and events must be in the same currency.

A ResolvedSwapLeg contains information based on holiday calendars. If a holiday calendar changes, the adjusted dates may no longer be correct. Care must be taken when placing the resolved form in a cache or persistence layer.

Serialized Form
• ### Nested Class Summary

Nested Classes
Modifier and Type Class Description
static class  ResolvedSwapLeg.Builder
The bean-builder for ResolvedSwapLeg.
static class  ResolvedSwapLeg.Meta
The meta-bean for ResolvedSwapLeg.
• ### Method Summary

All Methods
Modifier and Type Method Description
static ResolvedSwapLeg.Builder builder()
Returns a builder used to create an instance of the bean.
void collectIndices​(com.google.common.collect.ImmutableSet.Builder<Index> builder)
Collects all the indices referred to by this leg.
boolean equals​(java.lang.Object obj)
java.util.Optional<CurrencyAmount> findNotional​(java.time.LocalDate date)
Finds the notional on the specified date.
java.util.Optional<SwapPaymentPeriod> findPaymentPeriod​(java.time.LocalDate date)
Finds the payment period applicable for the specified accrual date.
Currency getCurrency()
Gets the primary currency of the swap leg.
java.time.LocalDate getEndDate()
Gets the accrual end date of the leg.
com.google.common.collect.ImmutableList<SwapPaymentEvent> getPaymentEvents()
Gets the payment events that are associated with the swap leg.
com.google.common.collect.ImmutableList<SwapPaymentPeriod> getPaymentPeriods()
Gets the payment periods that combine to form the swap leg.
PayReceive getPayReceive()
Gets whether the leg is pay or receive.
java.time.LocalDate 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 ResolvedSwapLeg.Meta meta()
The meta-bean for ResolvedSwapLeg.
ResolvedSwapLeg.Meta metaBean()
ResolvedSwapLeg.Builder toBuilder()
Returns a builder that allows this bean to be mutated.
java.lang.String toString()
• ### Methods inherited from class java.lang.Object

clone, finalize, getClass, notify, notifyAll, wait, wait, wait
• ### Methods inherited from interface org.joda.beans.Bean

property, propertyNames
• ### Method Detail

• #### getStartDate

public java.time.LocalDate getStartDate()
Gets the accrual start date of the leg.

This is the first accrual date in the leg, often known as the effective date. This date has typically been adjusted to be a valid business day.

Returns:
the start date of the leg
• #### getEndDate

public java.time.LocalDate getEndDate()
Gets the accrual end date of the leg.

This is the last accrual date in the leg, often known as the termination date. This date has typically been adjusted to be a valid business day.

Returns:
the end date of the leg
• #### getCurrency

public Currency getCurrency()
Gets the primary currency of the swap leg.

Any currency associated with FX reset is not included.

Returns:
the currency
• #### findPaymentPeriod

public java.util.Optional<SwapPaymentPeriod> findPaymentPeriod​(java.time.LocalDate date)
Finds the payment period applicable for the specified accrual date.

Each payment period contains one or more accrual periods. This method finds the matching accrual period and returns the payment period that holds it. Periods are considered to contain the end date but not the start date If no accrual period contains the date, an empty optional is returned.

Parameters:
date - the date to find
Returns:
the payment period applicable at the date
• #### collectIndices

public void collectIndices​(com.google.common.collect.ImmutableSet.Builder<Index> builder)
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.

Parameters:
builder - the builder to use
• #### findNotional

public java.util.Optional<CurrencyAmount> findNotional​(java.time.LocalDate date)
Finds the notional on the specified date.

If the date falls before the start, the initial notional will be returned. If the date falls after the end, the final notional will be returned.

An empty optional is returned if the leg has no notional, for example if the payment amount is known and explicitly specified.

Parameters:
date - the date on which the notional is required
Returns:
the notional on the specified date, if available
• #### meta

public static ResolvedSwapLeg.Meta meta()
The meta-bean for ResolvedSwapLeg.
Returns:
the meta-bean, not null
• #### builder

public static ResolvedSwapLeg.Builder builder()
Returns a builder used to create an instance of the bean.
Returns:
the builder, not null
• #### metaBean

public ResolvedSwapLeg.Meta metaBean()
Specified by:
metaBean in interface Bean
• #### getType

public SwapLegType getType()
Gets the type of the leg, such as Fixed or Ibor.

This provides a high level categorization of the swap leg.

Returns:
the value of the property, not null

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.

The value of this flag should match the signs of the payment period notionals.

Returns:
the value of the property, not null
• #### getPaymentPeriods

public com.google.common.collect.ImmutableList<SwapPaymentPeriod> getPaymentPeriods()
Gets the payment periods that combine to form the swap leg.

Each payment period represents part of the life-time of the leg. In most cases, the periods do not overlap. However, since each payment period is essentially independent the data model allows overlapping periods.

The start date and end date of the leg are determined from the first and last period. As such, the periods should be sorted.

Returns:
the value of the property, not empty
• #### getPaymentEvents

public com.google.common.collect.ImmutableList<SwapPaymentEvent> getPaymentEvents()
Gets the payment events that are associated with the swap leg.

Payment events include notional exchange and fees.

Returns:
the value of the property, not null
• #### toBuilder

public ResolvedSwapLeg.Builder toBuilder()
Returns a builder that allows this bean to be mutated.
Returns:
the mutable builder, not null
• #### equals

public boolean equals​(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
• #### hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
• #### toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object