public override void reset(int size)
        {
            // Set to bond redemption values
            values_ = new Vector(size, Convert.ToDouble(arguments_.redemption));

            conversionProbability_ = new Vector(size, 0.0);
            spreadAdjustedRate_    = new Vector(size, 0.0);

            DayCounter rfdc = process_.riskFreeRate().link.dayCounter();

            // this takes care of the convertibility and conversion probabilities
            adjustValues();

            Handle <Quote> creditSpread = arguments_.creditSpread;
            Date           exercise     = arguments_.exercise.lastDate();
            InterestRate   riskFreeRate = process_.riskFreeRate().link
                                          .zeroRate(exercise, rfdc, Compounding.Continuous, Frequency.NoFrequency);


            // Claculate blended discount rate to be used on roll back .
            for (var j = 0; j < values_.Count; j++)
            {
                spreadAdjustedRate_[j] = conversionProbability_[j] * riskFreeRate.value() +
                                         (1 - conversionProbability_[j]) *
                                         (riskFreeRate.value() + creditSpread.link.value());
            }
        }
        protected override double zeroYieldImpl(double t)
        {
            double       spread       = calcSpread(t);
            InterestRate zeroRate     = originalCurve_.link.zeroRate(t, compounding_, frequency_, true);
            InterestRate spreadedRate = new InterestRate(zeroRate.value() + spread,
                                                         zeroRate.dayCounter(),
                                                         zeroRate.compounding(),
                                                         zeroRate.frequency());

            return(spreadedRate.equivalentRate(Compounding.Continuous, Frequency.NoFrequency, t).value());
        }
Пример #3
0
                public override double value(Vector v, double t)
                {
                    InterestRate forward = termStructure_.currentLink().forwardRate(t, t,
                                                                                    Compounding.Continuous,
                                                                                    Frequency.NoFrequency);
                    double temp1 = sigma_ * (1.0 - Math.Exp(-a_ * t)) / a_;
                    double temp2 = eta_ * (1.0 - Math.Exp(-b_ * t)) / b_;
                    double value = 0.5 * temp1 * temp1 + 0.5 * temp2 * temp2 +
                                   rho_ * temp1 * temp2 + forward.value();

                    return(value);
                }