public FdmBermudanStepCondition(List <Date> exerciseDates, Date referenceDate, DayCounter dayCounter, FdmMesher mesher, FdmInnerValueCalculator calculator) { mesher_ = mesher; calculator_ = calculator; exerciseTimes_ = new List <double>(); foreach (Date iter in exerciseDates) { exerciseTimes_.Add( dayCounter.yearFraction(referenceDate, iter)); } }
public static FdmStepConditionComposite vanillaComposite(DividendSchedule cashFlow, Exercise exercise, FdmMesher mesher, FdmInnerValueCalculator calculator, Date refDate, DayCounter dayCounter) { List <List <double> > stoppingTimes = new List <List <double> >(); List <IStepCondition <Vector> > stepConditions = new List <IStepCondition <Vector> >(); if (!cashFlow.empty()) { FdmDividendHandler dividendCondition = new FdmDividendHandler(cashFlow, mesher, refDate, dayCounter, 0); stepConditions.Add(dividendCondition); stoppingTimes.Add(dividendCondition.dividendTimes()); } Utils.QL_REQUIRE(exercise.type() == Exercise.Type.American || exercise.type() == Exercise.Type.European || exercise.type() == Exercise.Type.Bermudan, () => "exercise type is not supported"); if (exercise.type() == Exercise.Type.American) { stepConditions.Add(new FdmAmericanStepCondition(mesher, calculator)); } else if (exercise.type() == Exercise.Type.Bermudan) { FdmBermudanStepCondition bermudanCondition = new FdmBermudanStepCondition(exercise.dates(), refDate, dayCounter, mesher, calculator); stepConditions.Add(bermudanCondition); stoppingTimes.Add(bermudanCondition.exerciseTimes()); } return(new FdmStepConditionComposite(stoppingTimes, stepConditions)); }
public FdmAmericanStepCondition(FdmMesher mesher, FdmInnerValueCalculator calculator) { mesher_ = mesher; calculator_ = calculator; }