## Class ResolvedSwap

• All Implemented Interfaces:
ResolvedProduct, Serializable, org.joda.beans.Bean, org.joda.beans.ImmutableBean

public final class ResolvedSwap
extends Object
implements ResolvedProduct, org.joda.beans.ImmutableBean, Serializable
A rate swap, resolved for pricing.

This is the resolved form of Swap and is an input to the pricers. Applications will typically create a ResolvedSwap from a Swap using Swap.resolve(ReferenceData).

A rate 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. In the simplest vanilla interest rate swap, there are two legs, one with a fixed rate and the other a floating rate. Many other more complex swaps can also be represented.

This class defines a swap as a set of legs, each of which contains a list of payment periods. Each payment period typically consists of one or more accrual periods. Additional payment events may also be specified.

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

A ResolvedSwap is bound to data that changes over time, such as holiday calendars. If the data changes, such as the addition of a new holiday, the resolved form will not be updated. 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  ResolvedSwap.Builder
The bean-builder for ResolvedSwap.
static class  ResolvedSwap.Meta
The meta-bean for ResolvedSwap.
• ### Method Summary

All Methods
Modifier and Type Method Description
ImmutableSet<Index> allIndices()
Returns the set of indices referred to by the swap.
ImmutableSet<Currency> allPaymentCurrencies()
Returns the set of payment currencies referred to by the swap.
static ResolvedSwap.Builder builder()
Returns a builder used to create an instance of the bean.
boolean equals​(Object obj)
LocalDate getEndDate()
Gets the accrual end date of the swap.
Optional<ResolvedSwapLeg> getLeg​(PayReceive payReceive)
Gets the first pay or receive leg of the swap.
ImmutableList<ResolvedSwapLeg> getLegs()
Gets the legs of the swap.
ImmutableList<ResolvedSwapLeg> getLegs​(SwapLegType type)
Gets the legs of the swap with the specified type.
Optional<ResolvedSwapLeg> getPayLeg()
Gets the first pay leg of the swap.
Optional<ResolvedSwapLeg> getReceiveLeg()
Gets the first receive leg of the swap.
LocalDate getStartDate()
Gets the accrual start date of the swap.
int hashCode()
boolean isCrossCurrency()
Checks if this trade is cross-currency.
static ResolvedSwap.Meta meta()
The meta-bean for ResolvedSwap.
ResolvedSwap.Meta metaBean()
static ResolvedSwap of​(ResolvedSwapLeg... legs)
Creates a swap from one or more swap legs.
ResolvedSwap.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 org.joda.beans.Bean

property, propertyNames
• ### Method Detail

• #### of

public static ResolvedSwap of​(ResolvedSwapLeg... legs)
Creates a swap from one or more swap legs.

While most swaps have two legs, other combinations are possible.

Parameters:
legs - the array of legs
Returns:
the swap
• #### getLegs

public ImmutableList<ResolvedSwapLeg> getLegs​(SwapLegType type)
Gets the legs of the swap with the specified type.

This returns all the legs with the given type.

Parameters:
type - the type to find
Returns:
the matching legs of the swap
• #### getLeg

public Optional<ResolvedSwapLeg> getLeg​(PayReceive payReceive)
Gets the first pay or receive leg of the swap.

This returns the first pay or receive leg of the swap, empty if no matching leg.

Parameters:
payReceive - the pay or receive flag
Returns:
the first matching leg of the swap
• #### getPayLeg

public Optional<ResolvedSwapLeg> getPayLeg()
Gets the first pay leg of the swap.

This returns the first pay leg of the swap, empty if no pay leg.

Returns:
the first pay leg of the swap

public Optional<ResolvedSwapLeg> getReceiveLeg()
Gets the first receive leg of the swap.

This returns the first receive leg of the swap, empty if no receive leg.

Returns:
the first receive leg of the swap
• #### getStartDate

public LocalDate getStartDate()
Gets the accrual start date of the swap.

This is the earliest accrual date of the legs, often known as the effective date. This date has typically been adjusted to be a valid business day.

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

public LocalDate getEndDate()
Gets the accrual end date of the swap.

This is the latest accrual date of the legs, often known as the termination date. This date has typically been adjusted to be a valid business day.

Returns:
the end date of the swap
• #### isCrossCurrency

public boolean isCrossCurrency()
Checks if this trade is cross-currency.

A cross currency swap is defined as one with legs in two different currencies.

Returns:
true if cross currency
• #### allPaymentCurrencies

public ImmutableSet<Currency> allPaymentCurrencies()
Returns the set of payment currencies referred to by the swap.

This returns the complete set of payment currencies for the swap. This will typically return one or two currencies.

If there is an FX reset, then this set contains the currency of the payment, not the currency of the notional. Note that in many cases, the currency of the FX reset notional will be the currency of the other leg.

Returns:
the currencies
• #### allIndices

public ImmutableSet<Index> allIndices()
Returns the set of indices referred to by the swap.

A swap will typically refer to at least one index, such as 'GBP-LIBOR-3M'. Calling this method will return the complete list of indices, including any associated with FX reset.

Returns:
the set of indices referred to by this swap
• #### meta

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

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

public ResolvedSwap.Meta metaBean()
Specified by:
metaBean in interface org.joda.beans.Bean
• #### getLegs

public ImmutableList<ResolvedSwapLeg> getLegs()
Gets the legs of the swap.

A swap consists of one or more legs. The legs of a swap are essentially unordered, however it is more efficient and closer to user expectation to treat them as being ordered.

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

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

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

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

public String toString()
Overrides:
toString in class Object