public final class ResolvedSwap extends Object implements ResolvedProduct, org.joda.beans.ImmutableBean, Serializable
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
ResolvedSwap.Builder
The bean-builder for
ResolvedSwap. |
static class |
ResolvedSwap.Meta
The meta-bean for
ResolvedSwap. |
| Modifier and Type | Method and 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() |
public static ResolvedSwap of(ResolvedSwapLeg... legs)
While most swaps have two legs, other combinations are possible.
legs - the array of legspublic ImmutableList<ResolvedSwapLeg> getLegs(SwapLegType type)
This returns all the legs with the given type.
type - the type to findpublic Optional<ResolvedSwapLeg> getLeg(PayReceive payReceive)
This returns the first pay or receive leg of the swap, empty if no matching leg.
payReceive - the pay or receive flagpublic Optional<ResolvedSwapLeg> getPayLeg()
This returns the first pay leg of the swap, empty if no pay leg.
public Optional<ResolvedSwapLeg> getReceiveLeg()
This returns the first receive leg of the swap, empty if no receive leg.
public LocalDate getStartDate()
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.
public LocalDate getEndDate()
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.
public boolean isCrossCurrency()
A cross currency swap is defined as one with legs in two different currencies.
public ImmutableSet<Currency> allPaymentCurrencies()
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.
public ImmutableSet<Index> allIndices()
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.
public static ResolvedSwap.Meta meta()
ResolvedSwap.public static ResolvedSwap.Builder builder()
public ResolvedSwap.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic ImmutableList<ResolvedSwapLeg> getLegs()
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.
public ResolvedSwap.Builder toBuilder()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.