Logo Search packages:      
Sourcecode: quantlib version File versions  Download package

Real QuantLib::BlackCallableFixedRateBondEngine::spotIncome (  )  const [private]

settle date of embedded option assumed same as that of bond

Definition at line 52 of file blackcallablebondengine.cpp.

                                                            {
        //! settle date of embedded option assumed same as that of bond
        Date settlement = arguments_.settlementDate;
        Leg cf = arguments_.cashflows;
        Date optionMaturity = arguments_.putCallSchedule[0]->date();

        /* the following assumes
           1. cashflows are in ascending order !
           2. income = coupons paid between settlementDate() and put/call date
        */
        Real income = 0.0;
        for (Size i = 0; i < cf.size() - 1; ++i) {
            if (!cf[i]->hasOccurred(settlement, false)) {
                if (cf[i]->hasOccurred(optionMaturity, false)) {
                    income += cf[i]->amount() *
                              discountCurve_->discount(cf[i]->date());
                } else {
                    break;
                }
            }
        }
        return income/discountCurve_->discount(settlement);
    }


Generated by  Doxygen 1.6.0   Back to index