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

Real QuantLib::Basket::scenarioTrancheLoss ( Date  endDate  )  const

Cumulative tranche loss up to end date under the current scenario

Definition at line 199 of file basket.cpp.

References QuantLib::Singleton< T >::instance().

                                                       {
        Real A = attachmentAmount_;
        Real D = detachmentAmount_;
        Date today = Settings::instance().evaluationDate();
        Real t2 = ActualActual().yearFraction(today, endDate);
        Real L = 0.0;
        for (Size i = 0; i < scenarioLoss_.size(); i++) {
            if (scenarioLoss_[i].time <= t2)
                L += scenarioLoss_[i].amount;
            else break;
        }
        return std::min(L, D) - std::min(L, A);
    }


Generated by  Doxygen 1.6.0   Back to index