Class FixedRateCalculation

  • All Implemented Interfaces:
    RateCalculation, java.io.Serializable, Bean, ImmutableBean

    public final class FixedRateCalculation
    extends java.lang.Object
    implements RateCalculation, ImmutableBean, java.io.Serializable
    Defines the calculation of a fixed rate swap leg.

    This defines the data necessary to calculate the amount payable on the leg. The amount is based on a fixed rate, which can vary over the lifetime of the leg.

    See Also:
    Serialized Form
    • Method Detail

      • of

        public static FixedRateCalculation of​(double rate,
                                              DayCount dayCount)
        Obtains a rate calculation for the specified day count and rate.

        The rate specified here does not vary during the life of the swap. If this method provides insufficient control, use the builder.

        Parameters:
        rate - the rate
        dayCount - the day count
        Returns:
        the calculation
      • getType

        public SwapLegType getType()
        Description copied from interface: RateCalculation
        Gets the type of the leg, such as Fixed or Ibor.

        This provides a high level categorization of the swap leg.

        Specified by:
        getType in interface RateCalculation
        Returns:
        the leg type
      • collectCurrencies

        public void collectCurrencies​(com.google.common.collect.ImmutableSet.Builder<Currency> builder)
        Description copied from interface: RateCalculation
        Collects all the currencies referred to by this calculation.

        This collects the complete set of currencies for the calculation, not just the payment currencies.

        Specified by:
        collectCurrencies in interface RateCalculation
        Parameters:
        builder - the builder to populate
      • collectIndices

        public void collectIndices​(com.google.common.collect.ImmutableSet.Builder<Index> builder)
        Description copied from interface: RateCalculation
        Collects all the indices referred to by this calculation.

        A calculation 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.

        Specified by:
        collectIndices in interface RateCalculation
        Parameters:
        builder - the builder to use
      • createAccrualPeriods

        public com.google.common.collect.ImmutableList<RateAccrualPeriod> createAccrualPeriods​(Schedule accrualSchedule,
                                                                                               Schedule paymentSchedule,
                                                                                               ReferenceData refData)
        Description copied from interface: RateCalculation
        Creates accrual periods based on the specified schedule.

        The specified accrual schedule defines the period dates to be created. One instance of RateAccrualPeriod must be created for each period in the schedule.

        Specified by:
        createAccrualPeriods in interface RateCalculation
        Parameters:
        accrualSchedule - the accrual schedule
        paymentSchedule - the payment schedule
        refData - the reference data to use when resolving
        Returns:
        the accrual periods
      • meta

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

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

        public DayCount getDayCount()
        Gets the day count convention.

        This is used to convert schedule period dates to a numerical value.

        Specified by:
        getDayCount in interface RateCalculation
        Returns:
        the value of the property, not null
      • getRate

        public ValueSchedule getRate()
        Gets the interest rate to be paid. A 5% rate will be expressed as 0.05.

        This defines the rate as an initial amount and a list of adjustments. The rate is only permitted to change at accrual period boundaries.

        Returns:
        the value of the property, not null
      • getInitialStub

        public java.util.Optional<FixedRateStubCalculation> getInitialStub()
        Gets the initial stub, optional.

        The initial stub of a swap may have a different rate from the regular accrual periods. This property allows the stub rate to be specified, either as a known amount or a rate. If this property is not present, then the rate derived from the rate property applies during the stub. If this property is present and there is no initial stub, it is ignored.

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

        public java.util.Optional<FixedRateStubCalculation> getFinalStub()
        Gets the final stub, optional.

        The final stub of a swap may have a different rate from the regular accrual periods. This property allows the stub rate to be specified, either as a known amount or a rate. If this property is not present, then the rate derived from the rate property applies during the stub. If this property is present and there is no initial stub, it is ignored.

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

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object