public static BlackScholesWithDividendOption Build(double spot,
                                                           DividendQuote[] dividends,
                                                           DiscountCurve discountCurve,
                                                           ITimeMeasure time)
        {
            var divUtils = new AffineDivCurveUtils(dividends, discountCurve, time);

            return(new BlackScholesWithDividendOption(spot, divUtils));
        }
            public BsDivPrice(double maturity, double strike, double spot,
                              AffineDivCurveUtils affineDivUtils, double[] quadPoints, double[] quadWeights)
            {
                this.quadWeights = quadWeights;
                this.maturity    = maturity;

                midT = 0.5 * maturity; //TODO find a best heuristic !
                dT   = maturity - midT;

                double sqrtMidT = Math.Sqrt(midT);

                z = quadPoints.Map(p => p * sqrtMidT);

                var displacement1  = affineDivUtils.CashBpvAverage(0.0, midT);
                var displacement2  = affineDivUtils.CashBpvAverage(midT, maturity);
                var maturityGrowth = affineDivUtils.AssetGrowth(maturity);

                k = strike + maturityGrowth * (affineDivUtils.CashDivBpv(maturity) - displacement2);
                a = maturityGrowth * (spot - displacement1);
                b = maturityGrowth * (displacement1 - displacement2);
            }
 public BlackScholesWithDividendOption(double spot, AffineDivCurveUtils affineDivUtils, int quadratureNbPoints = 10)
 {
     this.affineDivUtils = affineDivUtils;
     this.spot           = spot;
     GaussHermite.GetQuadrature(quadratureNbPoints, out quadPoints, out quadWeights);
 }