Esempio n. 1
0
        //@}
        private double callPayoff()
        {
            // to use only if index has fixed
            double payoff = 0.0;

            if (hasCallStrike_)
            {
                double underlyingRate = underlying_.rate();
                if ((underlyingRate - callStrike_) > 1.0e-16)
                {
                    payoff = isCallCashOrNothing_ ? callDigitalPayoff_ : underlyingRate;
                }
                else
                {
                    if (isCallATMIncluded_)
                    {
                        if (Math.Abs(callStrike_ - underlyingRate) <= 1.0e-16)
                        {
                            payoff = isCallCashOrNothing_ ? callDigitalPayoff_ : underlyingRate;
                        }
                    }
                }
            }
            return(payoff);
        }
Esempio n. 2
0
        // Coupon interface
        public override double rate()
        {
            Utils.QL_REQUIRE(underlying_.pricer() != null, () => "pricer not set");

            double swapletRate  = underlying_.rate();
            double floorletRate = 0.0;

            if (isFloored_)
            {
                floorletRate = underlying_.pricer().floorletRate(effectiveFloor().Value);
            }
            double capletRate = 0.0;

            if (isCapped_)
            {
                capletRate = underlying_.pricer().capletRate(effectiveCap().Value);
            }
            return(swapletRate + floorletRate - capletRate);
        }
        //! \name Coupon interface
        //@{
        public override double rate()
        {
            if (underlying_.pricer() == null)
            {
                throw new ApplicationException("pricer not set");
            }

            double swapletRate  = underlying_.rate();
            double floorletRate = 0.0;

            if (isFloored_)
            {
                floorletRate = underlying_.pricer().floorletRate(effectiveFloor().Value);
            }
            double capletRate = 0.0;

            if (isCapped_)
            {
                capletRate = underlying_.pricer().capletRate(effectiveCap().Value);
            }
            return(swapletRate + floorletRate - capletRate);
        }