public interface SwapLeg extends Resolvable<ResolvedSwapLeg>
A swap leg is one element of a Swap.
In most cases, a swap has two legs, one expressing the obligations of the seller
and one expressing the obligations of the buyer. However, it is possible to
represent more complex swaps, with one, three or more legs.
This interface imposes few restrictions on the swap leg. A leg must have a start and end date, where the start date can be before or after the date that the swap is traded. A single swap leg must produce payments in a single currency.
In most cases, a swap will consist of a list of payment periods, but this is not
required by this interface. The ResolvedSwapLeg class, which this leg can
be converted to, does define the swap in terms of payment periods.
Implementations must be immutable and thread-safe beans.
| Modifier and Type | Method and Description |
|---|---|
default ImmutableSet<Currency> |
allCurrencies()
Returns the set of currencies referred to by the leg.
|
default ImmutableSet<Index> |
allIndices()
Returns the set of indices referred to by the leg.
|
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.
|
Currency |
getCurrency()
Gets the payment currency of the leg.
|
AdjustableDate |
getEndDate()
Gets the accrual end date of the leg.
|
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.
|
default SwapLeg |
replaceStartDate(LocalDate adjustedStartDate)
Returns an instance based on this leg with the start date replaced.
|
ResolvedSwapLeg |
resolve(ReferenceData refData)
Resolves this swap leg using the specified reference data.
|
SwapLegType getType()
This provides a high level categorization of the swap leg.
PayReceive getPayReceive()
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.
AdjustableDate getStartDate()
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.
AdjustableDate getEndDate()
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.
Currency getCurrency()
A swap leg has a single payment currency.
default ImmutableSet<Currency> allCurrencies()
This returns the complete set of currencies for the leg, not just the payment currencies. For example, if there is an FX reset, then this set contains both the currency of the payment and the currency of the notional.
void collectCurrencies(ImmutableSet.Builder<Currency> builder)
This collects the complete set of currencies for the leg, not just the payment currencies.
builder - the builder to populatedefault ImmutableSet<Index> allIndices()
A leg 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.
void collectIndices(ImmutableSet.Builder<Index> builder)
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.
builder - the builder to populatedefault SwapLeg replaceStartDate(LocalDate adjustedStartDate)
This is used to change the start date of the leg, and is currently used by Swaption.
See each implementation for details of how the override is performed.
adjustedStartDate - the new adjusted start dateIllegalArgumentException - if the start date cannot be replaced with the proposed start dateUnsupportedOperationException - if changing the start date is not supportedResolvedSwapLeg resolve(ReferenceData refData)
This converts the swap leg to the equivalent resolved form.
All ReferenceDataId identifiers in this instance will be resolved.
The resolved form will typically be a type that is optimized for pricing.
Resolved objects may be 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.
resolve in interface Resolvable<ResolvedSwapLeg>refData - the reference data to use when resolvingReferenceDataNotFoundException - if an identifier cannot be resolved in the reference dataRuntimeException - if unable to resolve due to an invalid definitionCopyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.