示例#1
0
        protected override PathPricer <IPath> pathPricer()
        {
            AutocallPayoff payoff = arguments_.payoff as AutocallPayoff;

            if (payoff == null)
            {
                throw new ApplicationException("non-plain payoff given");
            }

            AutocallExercise exercise = arguments_.exercise as AutocallExercise;

            if (payoff == null)
            {
                throw new ApplicationException("non-plain payoff given");
            }

            GeneralizedBlackScholesProcess process = process_ as GeneralizedBlackScholesProcess;

            if (process == null)
            {
                throw new ApplicationException("Black-Scholes process required");
            }

            // return new EuropeanAutocallPathPricer(payoff, exercise, process.riskFreeRate().link.discount(timeGrid().Last()));
            return(new EuropeanAutocallPathPricer(payoff, exercise, process)); //, process.riskFreeRate().link.discount(timeGrid().Last()));
        }
示例#2
0
 public EuropeanAutocallPathPricer(AutocallPayoff autocallPayoff, AutocallExercise autocallExercise, GeneralizedBlackScholesProcess process)
 {
     payoff_   = autocallPayoff;
     exercise_ = autocallExercise;
     //payoff_ = new AutocallPayoff(type, strike);
     process_ = process;
     //if (!(strike >= 0.0))
     //    throw new ApplicationException("strike less than zero not allowed");
 }
示例#3
0
        public myAutocall(QLNet.Date valuationDate, AutocallExercise exercise, AutocallPayoff payoff) : base()
        {
            // Assign dates
            base.valuationDate_ = valuationDate;
            Settings.setEvaluationDate(valuationDate);

            // Assign payoff and exercise
            exercise_ = exercise;
            payoff_   = payoff;

            // @TODO : valuation date chould not be here, this is not part of the instrument itself. Belongs to valuation methods... @TODO
        }
示例#4
0
        // ************************************************************
        // METHODS - VALUATION
        // ************************************************************

        /*
         * public double value(Path thisPath, AutocallExercise thisExercise, GeneralizedBlackScholesProcess process)
         * {
         *
         *  int cas = 3;
         *
         *  switch (cas)
         *  {
         *      case 1:
         *          //Console.WriteLine("Pricing : Forward");
         *          return value_forward(thisPath, thisExercise, process);
         *
         *      case 2:
         *          //Console.WriteLine("Pricing : PDI");
         *          return value_PDI(thisPath, thisExercise, process);
         *
         *      case 3:
         *          //Console.WriteLine("Pricing : Autocall");
         *          return value_autocall(thisPath, thisExercise, process);
         *
         *  }
         *
         *  return this.value_autocall(thisPath, thisExercise, process);
         * }
         *
         */


        /// <summary>
        ///  Performs valuations of the autocall payoff for a given Monte Carlo trajectory.
        /// </summary>
        public double value(Path thisPath, AutocallExercise thisExercise, GeneralizedBlackScholesProcess process)
        {
            int nbSteps = thisExercise.dates().Count();

            double pmt   = 0.0;
            double yield = 0.0;

            for (int i = 0; i < nbSteps; i++)
            {
                Date   d   = Settings.evaluationDate();
                double t_k = dayCount_.yearFraction(d, thisExercise.dates()[i]);

                // Check for coupons payments and autocall events
                if (t_k >= 0.0)
                {
                    int k = thisPath.timeGrid().closestIndex(t_k);
                    yield = thisPath.value(k) / spotAtStrikeDate_;

                    if (yield >= recallMoneyness_)
                    {
                        double df = process.riskFreeRate().link.discount(t_k);
                        pmt += df * nominal_ * (1 + (1 + i) * CouponRate_);
                        return(pmt);
                    }
                }
            }


            // Product maturity reached without autocall event, checking only PDI
            double final_DF = process.riskFreeRate().link.discount(thisPath.timeGrid().Last());

            yield = thisPath.back() / spotAtStrikeDate_;

            // Case 1 : Above (or equal to) PDI barrier
            if (yield >= finalBarrierMoneyness_)
            {
                pmt += 1.0;
            }

            // Case 2 : Below PDI barrier
            else
            {
                pmt += yield;
            }

            return(nominal_ * final_DF * pmt);
        }