Esempio n. 1
0
        protected PathPricer <IPath> mc_looback_path_pricer(ContinuousFloatingLookbackOption.Arguments args,
                                                            GeneralizedBlackScholesProcess process,
                                                            double discount)
        {
            FloatingTypePayoff payoff = args.payoff as FloatingTypePayoff;

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

            return(new LookbackFloatingPathPricer(payoff.optionType(),
                                                  discount));
        }
        public override void calculate()
        {
            FloatingTypePayoff payoff = arguments_.payoff as FloatingTypePayoff;

            Utils.QL_REQUIRE(payoff != null, () => "Non-floating payoff given");

            Utils.QL_REQUIRE(process_.x0() > 0.0, () => "negative or null underlying");

            switch (payoff.optionType())
            {
            case Option.Type.Call:
                results_.value = A(1);
                break;

            case Option.Type.Put:
                results_.value = A(-1);
                break;

            default:
                Utils.QL_FAIL("Unknown type");
                break;
            }
        }