protected override double?controlVariateValue()
        {
            IPricingEngine controlPE = controlPricingEngine();

            Utils.QL_REQUIRE(controlPE != null, () => "engine does not provide control variation pricing engine");

            VanillaOption.Arguments controlArguments = controlPE.getArguments() as VanillaOption.Arguments;
            controlArguments          = arguments_;
            controlArguments.exercise = new EuropeanExercise(arguments_.exercise.lastDate());

            controlPE.calculate();

            VanillaOption.Results controlResults = controlPE.getResults() as VanillaOption.Results;

            return(controlResults.value);
        }
Beispiel #2
0
        protected override double controlVariateValue()
        {
            IPricingEngine controlPE = controlPricingEngine();

            if (controlPE == null)
            {
                throw new Exception("engine does not provide control variation pricing engine");
            }

            VanillaOption.Arguments controlArguments = controlPE.getArguments() as VanillaOption.Arguments;
            controlArguments          = arguments_;
            controlArguments.exercise = new EuropeanExercise(arguments_.exercise.lastDate());

            controlPE.calculate();

            VanillaOption.Results controlResults = controlPE.getResults() as VanillaOption.Results;

            return(controlResults.value.GetValueOrDefault());
        }