Interface RateComputationFn<T extends RateComputation>

    • Method Detail

      • standard

        static RateComputationFn<RateComputation> standard()
        Returns the standard instance of the function.

        Use this method to avoid a direct dependency on the implementation.

        Returns:
        the rate computation function
      • rate

        double rate​(T computation,
                    LocalDate startDate,
                    LocalDate endDate,
                    RatesProvider provider)
        Determines the applicable rate for the computation.

        Each type of rate has specific rules, encapsulated in RateComputation.

        The start date and end date refer to the accrual period. In many cases, this information is not necessary, however it does enable some implementations that would not otherwise be possible.

        Parameters:
        computation - the computation definition
        startDate - the start date of the accrual period
        endDate - the end date of the accrual period
        provider - the rates provider
        Returns:
        the applicable rate
      • rateSensitivity

        PointSensitivityBuilder rateSensitivity​(T computation,
                                                LocalDate startDate,
                                                LocalDate endDate,
                                                RatesProvider provider)
        Determines the point sensitivity for the rate computation.

        This returns a sensitivity instance referring to the curves used to determine each forward rate.

        Parameters:
        computation - the computation definition
        startDate - the start date of the accrual period
        endDate - the end date of the accrual period
        provider - the rates provider
        Returns:
        the point sensitivity
      • explainRate

        double explainRate​(T computation,
                           LocalDate startDate,
                           LocalDate endDate,
                           RatesProvider provider,
                           ExplainMapBuilder builder)
        Explains the calculation of the applicable rate.

        This adds information to the ExplainMapBuilder to aid understanding of the computation. The actual rate is also returned.

        Parameters:
        computation - the computation definition
        startDate - the start date of the accrual period
        endDate - the end date of the accrual period
        provider - the rates provider
        builder - the builder to populate
        Returns:
        the applicable rate