Example #1
0
        protected double getDividendAmount(int i)
        {
            Dividend dividend = events_[i] as Dividend;

            if (dividend != null)
            {
                return(dividend.amount());
            }
            else
            {
                return(0.0);
            }
        }
Example #2
0
        protected override void setGridLimits()
        {
            double underlying = process_.stateVariable().link.value();

            for (int i = 0; i < events_.Count; i++)
            {
                Dividend dividend = events_[i] as Dividend;
                if (dividend == null)
                {
                    continue;
                }
                if (getDividendTime(i) < 0.0)
                {
                    continue;
                }
                underlying -= dividend.amount(underlying);
            }

            base.setGridLimits(underlying, getResidualTime());
            ensureStrikeInGrid();
        }
Example #3
0
        public Vector adjustedGrid()
        {
            double t    = time();
            Vector grid = method().grid(t);

            // add back all dividend amounts in the future
            for (var i = 0; i < arguments_.dividends.Count; i++)
            {
                double dividendTime = dividendTimes_[i];
                if (dividendTime >= t || Utils.close(dividendTime, t))
                {
                    Dividend d = arguments_.dividends[i];
                    double   dividendDiscount = process_.riskFreeRate().currentLink().discount(dividendTime) /
                                                process_.riskFreeRate().currentLink().discount(t);
                    for (var j = 0; j < grid.size(); j++)
                    {
                        grid[j] += d.amount(grid[j]) * dividendDiscount;
                    }
                }
            }

            return(grid);
        }
Example #4
0
 public double value(double x)
 {
     return(x + dividend.amount(x));
 }