Пример #1
0
        public BSMOperator(Vector grid, GeneralizedBlackScholesProcess process, double residualTime) : base(grid.size())
        {
            LogGrid logGrid = new LogGrid(grid);
            var     cc      = new PdeConstantCoeff <PdeBSM>(process, residualTime, process.stateVariable().link.value());

            cc.generateOperator(residualTime, logGrid, this);
        }
Пример #2
0
        //! default theta calculation for Black-Scholes options
        public static double blackScholesTheta(GeneralizedBlackScholesProcess p, double value, double delta, double gamma)
        {
            double u = p.stateVariable().currentLink().value();
            double r = p.riskFreeRate().currentLink().zeroRate(0.0, Compounding.Continuous).rate();
            double q = p.dividendYield().currentLink().zeroRate(0.0, Compounding.Continuous).rate();
            double v = p.localVolatility().currentLink().localVol(0.0, u, false);

            return(r * value - (r - q) * u * delta - 0.5 * v * v * u * u * gamma);
        }