示例#1
0
        protected override PathPricer <IPath> pathPricer()
        {
            TimeGrid grid     = this.timeGrid();
            double   discount = (this.process_ as GeneralizedBlackScholesProcess)
                                .riskFreeRate().currentLink().discount(grid.Last());

            ContinuousFixedLookbackOption.Arguments           arg1 = this.arguments_ as ContinuousFixedLookbackOption.Arguments;
            ContinuousPartialFixedLookbackOption.Arguments    arg2 = this.arguments_ as ContinuousPartialFixedLookbackOption.Arguments;
            ContinuousFloatingLookbackOption.Arguments        arg3 = this.arguments_ as ContinuousFloatingLookbackOption.Arguments;
            ContinuousPartialFloatingLookbackOption.Arguments arg4 = this.arguments_ as ContinuousPartialFloatingLookbackOption.Arguments;

            if (arg2 != null)
            {
                return(mc_looback_path_pricer(arg2, this.process_ as GeneralizedBlackScholesProcess, discount));
            }
            else if (arg1 != null)
            {
                return(mc_looback_path_pricer(arg1, this.process_ as GeneralizedBlackScholesProcess, discount));
            }
            else if (arg4 != null)
            {
                return(mc_looback_path_pricer(arg4, this.process_ as GeneralizedBlackScholesProcess, discount));
            }
            else if (arg3 != null)
            {
                return(mc_looback_path_pricer(arg3, this.process_ as GeneralizedBlackScholesProcess, discount));
            }
            else
            {
                return(null);
            }
        }
示例#2
0
        protected PathPricer <IPath> mc_looback_path_pricer(ContinuousFixedLookbackOption.Arguments args,
                                                            GeneralizedBlackScholesProcess process,
                                                            double discount)
        {
            PlainVanillaPayoff payoff = args.payoff as PlainVanillaPayoff;

            Utils.QL_REQUIRE(payoff != null, () => "non-plain payoff given");


            return(new LookbackFixedPathPricer(payoff.optionType(),
                                               payoff.strike(),
                                               discount));
        }