示例#1
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            base.setupArguments(args);

            DiscreteAveragingAsianOption.Arguments moreArgs = args as DiscreteAveragingAsianOption.Arguments;
            Utils.QL_REQUIRE(moreArgs != null, () => "wrong argument type");

            moreArgs.averageType        = averageType_;
            moreArgs.runningAccumulator = runningAccumulator_;
            moreArgs.pastFixings        = pastFixings_;
            moreArgs.fixingDates        = fixingDates_;
        }
        protected override double?controlVariateValue()
        {
            IPricingEngine controlPE = this.controlPricingEngine();

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

            DiscreteAveragingAsianOption.Arguments controlArguments =
                (DiscreteAveragingAsianOption.Arguments)controlPE.getArguments();
            controlArguments = arguments_;
            controlPE.calculate();

            DiscreteAveragingAsianOption.Results controlResults =
                (DiscreteAveragingAsianOption.Results)(controlPE.getResults());

            return(controlResults.value);
        }