Ejemplo n.º 1
0
        /*! Simple yield calculation based on underlying spot and
         * forward values, taking into account underlying income.
         * When \f$ t>0 \f$, call with:
         * underlyingSpotValue=spotValue(t),
         * forwardValue=strikePrice, to get current yield. For a
         * repo, if \f$ t=0 \f$, impliedYield should reproduce the
         * spot repo rate. For FRA's, this should reproduce the
         * relevant zero rate at the FRA's maturityDate_
         */
        public InterestRate impliedYield(double underlyingSpotValue, double forwardValue, Date settlementDate,
                                         Compounding compoundingConvention, DayCounter dayCounter)
        {
            double tenor             = dayCounter.yearFraction(settlementDate, maturityDate_);
            double compoundingFactor = forwardValue / (underlyingSpotValue - spotIncome(incomeDiscountCurve_));

            return(InterestRate.impliedRate(compoundingFactor, dayCounter, compoundingConvention, Frequency.Annual, tenor));
        }