Beispiel #1
0
            public CmsIntegrantProvider(SabrExtrapolationReplicationCmsPeriodPricer outerInstance, CmsPeriod cmsPeriod, ResolvedSwap swap, SabrSwaptionVolatilities swaptionVolatilities, double forward, double strike, double timeToExpiry, double tenor, double cutOffStrike, double eta)
            {
                this.outerInstance = outerInstance;

                ResolvedSwapLeg fixedLeg = swap.getLegs(SwapLegType.FIXED).get(0);

                this.nbFixedPeriod      = fixedLeg.PaymentPeriods.size();
                this.nbFixedPaymentYear = (int)(long)Math.Round(1d / ((RatePaymentPeriod)fixedLeg.PaymentPeriods.get(0)).AccrualPeriods.get(0).YearFraction, MidpointRounding.AwayFromZero);
                this.tau = 1d / nbFixedPaymentYear;
                this.eta = eta;
                SabrFormulaData sabrPoint = SabrFormulaData.of(swaptionVolatilities.alpha(timeToExpiry, tenor), swaptionVolatilities.beta(timeToExpiry, tenor), swaptionVolatilities.rho(timeToExpiry, tenor), swaptionVolatilities.nu(timeToExpiry, tenor));

                this.shift             = swaptionVolatilities.shift(timeToExpiry, tenor);
                this.sabrExtrapolation = SabrExtrapolationRightFunction.of(forward + shift, timeToExpiry, sabrPoint, cutOffStrike + shift, outerInstance.mu);
                this.putCall           = cmsPeriod.CmsPeriodType.Equals(CmsPeriodType.FLOORLET) ? PutCall.PUT : PutCall.CALL;
                this.strike            = strike;
                this.factor            = g(forward) / h(forward);
                this.g0 = new double[4];
                g0[0]   = nbFixedPeriod * tau;
                g0[1]   = -0.5 * nbFixedPeriod * (nbFixedPeriod + 1.0d) * tau * tau;
                g0[2]   = -2.0d / 3.0d * g0[1] * (nbFixedPeriod + 2.0d) * tau;
                g0[3]   = -3.0d / 4.0d * g0[2] * (nbFixedPeriod + 2.0d) * tau;
            }