Esempio n. 1
0
 void REPORT_FAILURE_FLOATING(string greekName,
                              double minmax,
                              FloatingTypePayoff payoff,
                              Exercise exercise,
                              double s,
                              double q,
                              double r,
                              Date today,
                              double v,
                              double expected,
                              double calculated,
                              double error,
                              double tolerance)
 {
     QAssert.Fail(exercise.GetType() + " "
                  + payoff.optionType() + " lookback option with "
                  + payoff + " payoff:\n"
                  + "    underlying value  " + s + "\n"
                  + "    dividend yield:   " + q + "\n"
                  + "    risk-free rate:   " + r + "\n"
                  + "    reference date:   " + today + "\n"
                  + "    maturity:         " + exercise.lastDate() + "\n"
                  + "    volatility:       " + v + "\n\n"
                  + "    expected " + greekName + ":   " + expected + "\n"
                  + "    calculated " + greekName + ": " + calculated + "\n"
                  + "    error:            " + error + "\n"
                  + "    tolerance:        " + tolerance);
 }
Esempio n. 2
0
            public override void validate()
            {
                base.validate();

                EuropeanExercise europeanExercise = exercise as EuropeanExercise;

                Utils.QL_REQUIRE(lookbackPeriodEnd <= europeanExercise.lastDate(), () =>
                                 "lookback start date must be earlier than exercise date");

                FloatingTypePayoff floatingTypePayoff = payoff as FloatingTypePayoff;

                if (floatingTypePayoff.optionType() == Option.Type.Call)
                {
                    Utils.QL_REQUIRE(lambda >= 1.0, () =>
                                     "lambda should be greater than or equal to 1 for calls");
                }

                if (floatingTypePayoff.optionType() == Option.Type.Put)
                {
                    Utils.QL_REQUIRE(lambda <= 1.0, () =>
                                     "lambda should be smaller than or equal to 1 for puts");
                }
            }