30 vector<Real> nominals,
33 bool protectionSeller,
38 Rate upfrontPremiumRate,
41 const Period& integrationStep)
42 : attachment_(attachment), detachment_(detachment), nominals_(
std::move(nominals)),
43 basket_(basket), copula_(
std::move(copula)), protectionSeller_(protectionSeller),
44 premiumSchedule_(
std::move(premiumSchedule)), premiumRate_(premiumRate),
45 dayCounter_(
std::move(dayCounter)), recoveryRate_(recoveryRate),
46 upfrontPremiumRate_(upfrontPremiumRate), yieldTS_(
std::move(yieldTS)), nBuckets_(nBuckets),
47 integrationStep_(integrationStep) {
49 QL_REQUIRE (!basket.empty(),
"basket is empty");
52 "illegal attachment/detachment point");
60 "nominal vector size too large");
65 for (
Size i = 0; i <
n; i++)
71 <<
" != basket size " <<
basket_.size());
96 if (
d <=
basket_.front()->referenceDate())
99 vector<Real> defProb (
basket_.size());
101 defProb[j] =
basket_[j]->defaultProbability (
d);
collateralized debt obligation
Real upfrontPremiumValue_
void performCalculations() const override
bool isExpired() const override
returns whether the instrument might have value greater than zero.
CDO(Real attachment, Real detachment, std::vector< Real > nominals, const std::vector< Handle< DefaultProbabilityTermStructure > > &basket, Handle< OneFactorCopula > copula, bool protectionSeller, Schedule premiumSchedule, Rate premiumRate, DayCounter dayCounter, Rate recoveryRate, Rate upfrontPremiumRate, Handle< YieldTermStructure > yieldTS, Size nBuckets, const Period &integrationStep=Period(10, Years))
Handle< OneFactorCopula > copula_
Rate protectionValue() const
Real expectedTrancheLoss(Date d) const
void setupExpired() const override
Schedule premiumSchedule_
std::vector< Real > lgds_
Rate premiumValue() const
std::vector< Real > nominals_
std::vector< Handle< DefaultProbabilityTermStructure > > basket_
Handle< YieldTermStructure > yieldTS_
Date advance(const Date &, Integer n, TimeUnit unit, BusinessDayConvention convention=Following, bool endOfMonth=false) const
Time yearFraction(const Date &, const Date &, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date()) const
Returns the period between two dates as a fraction of year.
Real trancheExpectedValue(Real a, Real d)
virtual bool hasOccurred(const Date &refDate=Date(), ext::optional< bool > includeRefDate=ext::nullopt) const
returns true if an event has already occurred before a date
Shared handle to an observable.
void calculate() const override
virtual void setupExpired() const
Loss distribution with Hull-White bucketing.
Calendar for reproducing theoretical calculations.
template class providing a null value for a given type.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
const std::vector< Date > & dates() const
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Base class for events associated with a given date.
std::size_t Size
size of a container