Beispiel #1
0
        protected override LongstaffSchwartzPathPricer <IPath> lsmPathPricer()
        {
            GeneralizedBlackScholesProcess process = process_ as GeneralizedBlackScholesProcess;

            Utils.QL_REQUIRE(process != null, () => "generalized Black-Scholes process required");

            EarlyExercise exercise = arguments_.exercise as EarlyExercise;

            Utils.QL_REQUIRE(exercise != null, () => "wrong exercise given");
            Utils.QL_REQUIRE(!exercise.payoffAtExpiry(), () => "payoff at expiry not handled");

            AmericanPathPricer earlyExercisePathPricer = new AmericanPathPricer(arguments_.payoff, polynomOrder_, polynomType_);

            return(new LongstaffSchwartzPathPricer <IPath>(timeGrid(), earlyExercisePathPricer, process.riskFreeRate()));
        }
Beispiel #2
0
        protected override LongstaffSchwartzPathPricer <IPath> lsmPathPricer()
        {
            GeneralizedBlackScholesProcess process = process_ as GeneralizedBlackScholesProcess;

            if (process == null)
            {
                throw new Exception("generalized Black-Scholes process required");
            }

            EarlyExercise exercise = arguments_.exercise as EarlyExercise;

            if (exercise == null)
            {
                throw new Exception("wrong exercise given");
            }
            if (exercise.payoffAtExpiry())
            {
                throw new Exception("payoff at expiry not handled");
            }

            AmericanPathPricer earlyExercisePathPricer = new AmericanPathPricer(arguments_.payoff, polynomOrder_, polynomType_);

            return(new LongstaffSchwartzPathPricer <IPath>(timeGrid(), earlyExercisePathPricer, process.riskFreeRate()));
        }