Interface SwapLeg
- 
- All Superinterfaces:
- Resolvable<ResolvedSwapLeg>
 - All Known Subinterfaces:
- ScheduledSwapLeg
 - All Known Implementing Classes:
- KnownAmountSwapLeg,- RateCalculationSwapLeg,- RatePeriodSwapLeg
 
 public interface SwapLeg extends Resolvable<ResolvedSwapLeg> A single leg of a swap.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 ResolvedSwapLegclass, which this leg can be converted to, does define the swap in terms of payment periods.Implementations must be immutable and thread-safe beans. 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method 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.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.CurrencygetCurrency()Gets the payment currency of the leg.AdjustableDategetEndDate()Gets the accrual end date of the leg.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.default SwapLegreplaceStartDate(LocalDate adjustedStartDate)Returns an instance based on this leg with the start date replaced.ResolvedSwapLegresolve(ReferenceData refData)Resolves this swap leg using the specified reference data.
 
- 
- 
- 
Method Detail- 
getTypeSwapLegType getType() Gets the type of the leg, such as Fixed or Ibor.This provides a high level categorization of the swap leg. - Returns:
- the leg type
 
 - 
getPayReceivePayReceive 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. - Returns:
- the pay receive flag
 
 - 
getStartDateAdjustableDate getStartDate() Gets 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. - Returns:
- the start date of the leg
 
 - 
getEndDateAdjustableDate getEndDate() Gets 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. - Returns:
- the end date of the leg
 
 - 
getCurrencyCurrency getCurrency() Gets the payment currency of the leg.A swap leg has a single payment currency. - Returns:
- the payment currency of the leg
 
 - 
allCurrenciesdefault ImmutableSet<Currency> allCurrencies() Returns the set of currencies referred to by the leg.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. - Returns:
- the set of currencies referred to by this leg
 
 - 
collectCurrenciesvoid collectCurrencies(ImmutableSet.Builder<Currency> builder) Collects all the currencies referred to by this leg.This collects the complete set of currencies for the leg, not just the payment currencies. - Parameters:
- builder- the builder to populate
 
 - 
allIndicesdefault ImmutableSet<Index> allIndices() Returns the set of indices referred to by the leg.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. - Returns:
- the set of indices referred to by this leg
 
 - 
collectIndicesvoid collectIndices(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 populate
 
 - 
replaceStartDatedefault SwapLeg replaceStartDate(LocalDate adjustedStartDate) Returns an instance based on this leg with the start date replaced.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. - 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
- UnsupportedOperationException- if changing the start date is not supported
 
 - 
resolveResolvedSwapLeg resolve(ReferenceData refData) Resolves this swap leg using the specified reference data.This converts the swap leg to the equivalent resolved form. All ReferenceDataIdidentifiers 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. - Specified by:
- resolvein interface- Resolvable<ResolvedSwapLeg>
- Parameters:
- refData- the reference data to use when resolving
- Returns:
- the resolved instance
- Throws:
- ReferenceDataNotFoundException- if an identifier cannot be resolved in the reference data
- RuntimeException- if unable to resolve due to an invalid definition
 
 
- 
 
-