Bermudan uses analytic value of swap when valuing underlying.
@@ -62,6 +62,7 @@ public class BermudanSwaptionFromSwapSchedules extends AbstractLIBORMonteCarloPr
private final Schedule[] floatSchedules;
private final RegressionBasisFunctionsProvider regressionBasisFunctionProvider;
private final MonteCarloConditionalExpectationRegressionFactory conditionalExpectationRegressionFactory;
+ private final boolean isUseAnalyticSwapValuationAtExercise = true;
/**
* Create a Bermudan swaption from an array of underlying swap schedules (fix leg and float leg), swap rates and notionals.
@@ -290,6 +291,17 @@ public class BermudanSwaptionFromSwapSchedules extends AbstractLIBORMonteCarloPr
* @throws CalculationException Thrown if underlying model failed to calculate stochastic process.
*/
private RandomVariable getValueUnderlyingNumeraireRelative(LIBORModelMonteCarloSimulationModel model, Schedule legSchedule, boolean paysFloat, double swaprate, double notional) throws CalculationException {
+
+ if(isUseAnalyticSwapValuationAtExercise) {
+ double valuationTime = FloatingpointDate.getFloatingPointDateFromDate(model.getReferenceDate().toLocalDate(), legSchedule.getPeriod(0).getFixing());
+ RandomVariable numeraireAtValuationTime = model.getNumeraire(valuationTime);
+ RandomVariable monteCarloProbabilitiesAtValuationTime = model.getMonteCarloWeights(valuationTime);
+ RandomVariable value = SwaptionFromSwapSchedules.getValueOfLegAnalytic(valuationTime, model, legSchedule, paysFloat, swaprate, notional);
+ value = value.div(model.getNumeraire(valuationTime)).mult(monteCarloProbabilitiesAtValuationTime);
+ return value;
+ }
+ else {
+
RandomVariable value = model.getRandomVariableForConstant(0.0);
for(int periodIndex = legSchedule.getNumberOfPeriods() - 1; periodIndex >= 0; periodIndex--) {
@@ -312,6 +324,7 @@ public class BermudanSwaptionFromSwapSchedules extends AbstractLIBORMonteCarloPr
}
return value;
}
+ }
/**
* The conditional expectation is calculated using a Monte-Carlo regression technique.
