Ejemplo n.º 1
0
        public void visit(DigitalCmsCoupon c)
        {
            CmsCouponPricer cmsCouponPricer = pricer_ as CmsCouponPricer;

            Utils.QL_REQUIRE(cmsCouponPricer != null, () => "pricer not compatible with CMS coupon");
            c.setPricer(cmsCouponPricer);
        }
Ejemplo n.º 2
0
        public LognormalCmsSpreadPricer(
            CmsCouponPricer cmsPricer1,
            CmsCouponPricer cmsPricer2,
            Handle <Quote> correlation,
            Handle <YieldTermStructure> couponDiscountCurve = null,
            int integrationPoints         = 16,
            VolatilityType volatilityType = VolatilityType.None,
            double?shift1 = null,
            double?shift2 = null)
            : base(correlation)
        {
            correlation_.registerWith(update);
            cmsPricer1_ = cmsPricer1;
            cmsPricer2_ = cmsPricer2;

            couponDiscountCurve_ = couponDiscountCurve;

            if (couponDiscountCurve_ != null && !couponDiscountCurve_.empty())
            {
                couponDiscountCurve_.registerWith(update);
            }

            cmsPricer1_.registerWith(update);
            cmsPricer2_.registerWith(update);

            Utils.QL_REQUIRE(integrationPoints >= 4,
                             () => "at least 4 integration points should be used ("
                             + integrationPoints + ")");
            integrator_ = new GaussHermiteIntegration(integrationPoints);

            cnd_ = new CumulativeNormalDistribution(0.0, 1.0);

            if (volatilityType == VolatilityType.None)
            {
                Utils.QL_REQUIRE(shift1 == null && shift2 == null,
                                 () => "if volatility type is inherited, no shifts should be specified");
                inheritedVolatilityType_ = true;
                volType_ = cmsPricer1.swaptionVolatility().currentLink().volatilityType();
            }
            else
            {
                shift1_ = shift1 == null ? 0.0 : shift1.Value;
                shift2_ = shift2 == null ? 0.0 : shift2.Value;
                inheritedVolatilityType_ = false;
                volType_ = volatilityType;
            }
        }
Ejemplo n.º 3
0
 public MakeCms withCmsCouponPricer(CmsCouponPricer couponPricer)
 {
     couponPricer_ = couponPricer;
     return(this);
 }