## Interface RateComputationFn<T extends RateComputation>

• Type Parameters:
T - the type of rate to be observed

public interface RateComputationFn<T extends RateComputation>
Computes a rate.

This function provides the ability to compute a rate defined by RateComputation. The rate will be based on known historic data and forward curves.

Implementations must be immutable and thread-safe functions.

• ### Method Summary

All Methods
Modifier and Type Method Description
double explainRate​(T computation, java.time.LocalDate startDate, java.time.LocalDate endDate, RatesProvider provider, ExplainMapBuilder builder)
Explains the calculation of the applicable rate.
double rate​(T computation, java.time.LocalDate startDate, java.time.LocalDate endDate, RatesProvider provider)
Determines the applicable rate for the computation.
PointSensitivityBuilder rateSensitivity​(T computation, java.time.LocalDate startDate, java.time.LocalDate endDate, RatesProvider provider)
Determines the point sensitivity for the rate computation.
static RateComputationFn<RateComputation> standard()
Returns the standard instance of the function.
• ### 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,
java.time.LocalDate startDate,
java.time.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,
java.time.LocalDate startDate,
java.time.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,
java.time.LocalDate startDate,
java.time.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