Class IborRateStubCalculation

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

    public final class IborRateStubCalculation
    extends Object
    implements org.joda.beans.ImmutableBean, Serializable
    Defines the rates applicable in the initial or final stub of an Ibor swap leg.

    A standard swap leg consists of a regular periodic schedule and one or two stub periods at each end. This class defines what floating rate to use during a stub.

    The rate may be specified in three ways.

    • A fixed rate, applicable for the whole stub
    • A floating rate based on a single Ibor index
    • A floating rate based on linear interpolation between two Ibor indices
    See Also:
    Serialized Form
    • Method Detail

      • ofFixedRate

        public static IborRateStubCalculation ofFixedRate​(double fixedRate)
        Obtains an instance with a single fixed rate.
        Parameters:
        fixedRate - the fixed rate for the stub
        Returns:
        the stub
      • ofKnownAmount

        public static IborRateStubCalculation ofKnownAmount​(CurrencyAmount knownAmount)
        Obtains an instance with a known amount of interest.
        Parameters:
        knownAmount - the known amount of interest
        Returns:
        the stub
      • ofIborInterpolatedRate

        public static IborRateStubCalculation ofIborInterpolatedRate​(IborIndex index1,
                                                                     IborIndex index2)
        Obtains an instance with linear interpolation of two floating rates.

        The two indices must be different, typically with one longer than another. The order of input of the indices does not matter.

        Parameters:
        index1 - the first index
        index2 - the second index
        Returns:
        the stub
        Throws:
        IllegalArgumentException - if the two indices are the same or either is null
      • isFixedRate

        public boolean isFixedRate()
        Checks if the stub has a fixed rate.
        Returns:
        true if a fixed stub rate applies
      • isKnownAmount

        public boolean isKnownAmount()
        Checks if the stub has a known amount.
        Returns:
        true if the stub has a known amount
      • isFloatingRate

        public boolean isFloatingRate()
        Checks if the stub has a floating rate.
        Returns:
        true if a floating stub rate applies
      • isInterpolated

        public boolean isInterpolated()
        Checks if the stub has an interpolated rate.

        An interpolated rate exists when there are two different rates that need linear interpolation.

        Returns:
        true if linear interpolation applies
      • builder

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

        public OptionalDouble getFixedRate()
        Gets the fixed rate to use in the stub. A 5% rate will be expressed as 0.05.

        In certain circumstances two counterparties agree a fixed rate for the stub. It is used in place of an observed fixing. Other calculation elements, such as gearing or spread, still apply.

        If the fixed rate is present, then knownAmount, index and indexInterpolated must not be present.

        Returns:
        the optional value of the property, not null
      • getKnownAmount

        public Optional<CurrencyAmount> getKnownAmount()
        Gets the known amount to pay/receive for the stub.

        If the known amount is present, then fixedRate, index and indexInterpolated must not be present.

        Returns:
        the optional value of the property, not null
      • getIndex

        public Optional<IborIndex> getIndex()
        Gets the Ibor index to be used for the stub.

        This will be used throughout the stub unless indexInterpolated is present.

        If the index is present, then fixedRate and knownAmount must not be present.

        Returns:
        the optional value of the property, not null
      • getIndexInterpolated

        public Optional<IborIndex> getIndexInterpolated()
        Gets the second Ibor index to be used for the stub, linearly interpolated.

        This will be used with index to linearly interpolate the rate. This index may be shorter or longer than index, but not the same.

        If the interpolated index is present, then index must also be present, and fixedRate and knownAmount must not be present.

        Returns:
        the optional value of the property, not null
      • toBuilder

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

        public int hashCode()
        Overrides:
        hashCode in class Object