Class ResolvedSwapLeg

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

    public final class ResolvedSwapLeg
    extends Object
    implements org.joda.beans.ImmutableBean, 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.

    See Also:
    Serialized Form
    • Method Detail

      • getStartDate

        public 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.

        the start date of the leg
      • getEndDate

        public 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.

        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.

        the currency
      • findPaymentPeriod

        public Optional<SwapPaymentPeriod> findPaymentPeriod​(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.

        date - the date to find
        the payment period applicable at the date
      • collectIndices

        public void 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.

        builder - the builder to use
      • findNotional

        public Optional<CurrencyAmount> findNotional​(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.

        date - the date on which the notional is required
        the notional on the specified date, if available
      • meta

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

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

        public ResolvedSwapLeg.Meta metaBean()
        Specified by:
        metaBean in interface org.joda.beans.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.

        the value of the property, not null
      • getPayReceive

        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.

        the value of the property, not null
      • getPaymentPeriods

        public 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.

        the value of the property, not empty
      • getPaymentEvents

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

        Payment events include notional exchange and fees.

        the value of the property, not null
      • toBuilder

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

        public int hashCode()
        hashCode in class Object