Esempio n. 1
0
        protected override PathPricer <IPath> pathPricer()
        {
            PlainVanillaPayoff payoff = this.arguments_.payoff as PlainVanillaPayoff;

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

            HestonProcess process = this.process_ as HestonProcess;

            Utils.QL_REQUIRE(process != null, () => "Heston process required");

            return(new EuropeanHestonPathPricer(payoff.optionType(),
                                                payoff.strike(),
                                                process.riskFreeRate().link.discount(this.timeGrid().Last())));
        }
Esempio n. 2
0
        protected override PathPricer <IPath> pathPricer()
        {
            PlainVanillaPayoff payoff = (PlainVanillaPayoff)(this.arguments_.payoff);

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

            EuropeanExercise exercise = (EuropeanExercise)this.arguments_.exercise;

            Utils.QL_REQUIRE(exercise != null, () => "wrong exercise given");

            return((PathPricer <IPath>) new ArithmeticASOPathPricer(
                       payoff.optionType(),
                       this.process_.riskFreeRate().link.discount(this.timeGrid().Last()),
                       this.arguments_.runningAccumulator.GetValueOrDefault(),
                       this.arguments_.pastFixings.GetValueOrDefault()));
        }
Esempio n. 3
0
        protected override PathPricer <IPath> controlPathPricer()
        {
            PlainVanillaPayoff payoff = (PlainVanillaPayoff)this.arguments_.payoff;

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

            EuropeanExercise exercise = (EuropeanExercise)this.arguments_.exercise;

            Utils.QL_REQUIRE(exercise != null, () => "wrong exercise given");

            // for seasoned option the geometric strike might be rescaled
            // to obtain an equivalent arithmetic strike.
            // Any change applied here MUST be applied to the analytic engine too
            return((PathPricer <IPath>) new GeometricAPOPathPricer(
                       payoff.optionType(),
                       payoff.strike(),
                       this.process_.riskFreeRate().link.discount(this.timeGrid().Last())));
        }
Esempio n. 4
0
 public void REPORT_FAILURE_2(String greekName, BasketType basketType, PlainVanillaPayoff payoff, Exercise exercise,
                              double s1, double s2, double q1, double q2, double r, Date today, double v1, double v2, double rho,
                              double expected, double calculated, double error, double tolerance)
 {
     Assert.Fail(Utilities.exerciseTypeToString(exercise) + " "
                 + payoff.optionType() + " option on "
                 + basketTypeToString(basketType)
                 + " with " + Utilities.payoffTypeToString(payoff) + " payoff:\n"
                 + "1st underlying value: " + s1 + "\n"
                 + "2nd underlying value: " + s2 + "\n"
                 + "              strike: " + payoff.strike() + "\n"
                 + "  1st dividend yield: " + q1 + "\n"
                 + "  2nd dividend yield: " + q2 + "\n"
                 + "      risk-free rate: " + r + "\n"
                 + "      reference date: " + today + "\n"
                 + "            maturity: " + exercise.lastDate() + "\n"
                 + "1st asset volatility: " + v1 + "\n"
                 + "2nd asset volatility: " + v2 + "\n"
                 + "         correlation: " + rho + "\n\n"
                 + "    expected   " + greekName + ": " + expected + "\n"
                 + "    calculated " + greekName + ": " + calculated + "\n"
                 + "    error:            " + error + "\n"
                 + "    tolerance:        " + tolerance);
 }