Class DispatchingRateComputationFn
- java.lang.Object
-
- com.opengamma.strata.pricer.impl.rate.DispatchingRateComputationFn
-
- All Implemented Interfaces:
RateComputationFn<RateComputation>
public class DispatchingRateComputationFn extends Object implements RateComputationFn<RateComputation>
Rate computation implementation using multiple dispatch.Dispatches the request to the correct implementation.
-
-
Field Summary
Fields Modifier and Type Field Description static DispatchingRateComputationFnDEFAULTDefault implementation.
-
Constructor Summary
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doubleexplainRate(RateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider, ExplainMapBuilder builder)Explains the calculation of the applicable rate.doublerate(RateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider)Determines the applicable rate for the computation.PointSensitivityBuilderrateSensitivity(RateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider)Determines the point sensitivity for the rate computation.
-
-
-
Field Detail
-
DEFAULT
public static final DispatchingRateComputationFn DEFAULT
Default implementation.
-
-
Constructor Detail
-
DispatchingRateComputationFn
public DispatchingRateComputationFn(RateComputationFn<IborRateComputation> iborRateComputationFn, RateComputationFn<IborInterpolatedRateComputation> iborInterpolatedRateComputationFn, RateComputationFn<IborAveragedRateComputation> iborAveragedRateComputationFn, RateComputationFn<OvernightCompoundedRateComputation> overnightCompoundedRateComputationFn, RateComputationFn<OvernightCompoundedAnnualRateComputation> overnightCompundedAnnualRateComputationFn, RateComputationFn<OvernightAveragedRateComputation> overnightAveragedRateComputationFn, RateComputationFn<OvernightAveragedDailyRateComputation> overnightAveragedDailyRateComputationFn, RateComputationFn<InflationMonthlyRateComputation> inflationMonthlyRateComputationFn, RateComputationFn<InflationInterpolatedRateComputation> inflationInterpolatedRateComputationFn, RateComputationFn<InflationEndMonthRateComputation> inflationEndMonthRateComputationFn, RateComputationFn<InflationEndInterpolatedRateComputation> inflationEndInterpolatedRateComputationFn)
Creates an instance.- Parameters:
iborRateComputationFn- the rate provider forIborRateComputationiborInterpolatedRateComputationFn- the rate computation forIborInterpolatedRateComputationiborAveragedRateComputationFn- the rate computation forIborAveragedRateComputationovernightCompoundedRateComputationFn- the rate computation forOvernightCompoundedRateComputationovernightCompundedAnnualRateComputationFn- the rate computation forOvernightCompoundedAnnualRateComputationovernightAveragedRateComputationFn- the rate computation forOvernightAveragedRateComputationovernightAveragedDailyRateComputationFn- the rate computation forOvernightAveragedDailyRateComputationinflationMonthlyRateComputationFn- the rate computation forInflationMonthlyRateComputationinflationInterpolatedRateComputationFn- the rate computation forInflationInterpolatedRateComputationinflationEndMonthRateComputationFn- the rate computation forInflationEndMonthRateComputationinflationEndInterpolatedRateComputationFn- the rate computation forInflationEndInterpolatedRateComputation
-
-
Method Detail
-
rate
public double rate(RateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider)
Description copied from interface:RateComputationFnDetermines 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.
- Specified by:
ratein interfaceRateComputationFn<RateComputation>- Parameters:
computation- the computation definitionstartDate- the start date of the accrual periodendDate- the end date of the accrual periodprovider- the rates provider- Returns:
- the applicable rate
-
rateSensitivity
public PointSensitivityBuilder rateSensitivity(RateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider)
Description copied from interface:RateComputationFnDetermines the point sensitivity for the rate computation.This returns a sensitivity instance referring to the curves used to determine each forward rate.
- Specified by:
rateSensitivityin interfaceRateComputationFn<RateComputation>- Parameters:
computation- the computation definitionstartDate- the start date of the accrual periodendDate- the end date of the accrual periodprovider- the rates provider- Returns:
- the point sensitivity
-
explainRate
public double explainRate(RateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider, ExplainMapBuilder builder)
Description copied from interface:RateComputationFnExplains the calculation of the applicable rate.This adds information to the
ExplainMapBuilderto aid understanding of the computation. The actual rate is also returned.- Specified by:
explainRatein interfaceRateComputationFn<RateComputation>- Parameters:
computation- the computation definitionstartDate- the start date of the accrual periodendDate- the end date of the accrual periodprovider- the rates providerbuilder- the builder to populate- Returns:
- the applicable rate
-
-