# LGDs (3) - Linux Man Pages

## NAME

QuantLib::Basket -

## SYNOPSIS

#include <ql/experimental/credit/basket.hpp>

### Public Member Functions

**Basket** (const std::vector< std::string > &names, const std::vector< **Real** > ¬ionals, const boost::shared_ptr< Pool > pool, **Real** attachmentRatio=0.0, **Real** detachmentRatio=1.0)

Size **size** () const

const std::vector< std::string > & **names** () const

const std::vector< **Real** > & **notionals** () const

**Real** **notional** ()

boost::shared_ptr< Pool > **pool** () const

const std::vector< **Real** > & **LGDs** () const

**Real** **lgd** ()

**Real** **attachmentRatio** () const

**Real** **detachmentRatio** () const

**Real** **basketNotional** () const

**Real** **basketLGD** () const

**Real** **trancheNotional** () const

**Real** **attachmentAmount** () const

**Real** **detachmentAmount** () const

std::vector< **Real** > **probabilities** (const **Date** &d) const

**Real** **cumulatedLoss** (const **Date** &startDate, const **Date** &endDate) const

**Real** **remainingNotional** (const **Date** &startDate, const **Date** &endDate) const

std::vector< **Real** > **remainingNotionals** (const **Date** &startDate, const **Date** &endDate) const

std::vector< std::string > **remainingNames** (const **Date** &startDate, const **Date** &endDate) const

**Real** **remainingAttachmentRatio** (const **Date** &startDate, const **Date** &endDate) const

**Real** **remainingAttachmentAmount** (const **Date** &startDate, const **Date** &endDate) const

**Real** **remainingDetachmentRatio** (const **Date** &startDate, const **Date** &endDate) const

**Real** **remainingDetachmentAmount** (const **Date** &startDate, const **Date** &endDate) const

void **updateScenarioLoss** (bool zeroRecovery=false)

**Real** **scenarioTrancheLoss** (**Date** endDate) const

std::vector< Loss > **scenarioIncrementalBasketLosses** () const

std::vector< Loss > **scenarioIncrementalTrancheLosses** (**Date** startDate=Date::minDate(), **Date** endDate=Date::maxDate()) const

## Detailed Description

Credit **Basket** A basket is a collection of credit names, represented by a unique identifier (a text string), associated notional amounts, a pool and tranche information. The pool is a map of 'names' to issuers. The **Basket** structure is motivated by **CDO** squared instruments containing various underlying inner CDOs which can be represented by respective baskets including their tranche structure. The role of the Pool is providing a unique list of relevant issuers while names may appear multiple times across different baskets (overlap).

## Member Function Documentation

### const std::vector<**Real**>& LGDs () const

Loss Given Default for all issuers/notionals based on expected recovery rates for the respective issuers.

**Real** attachmentRatio () const

Attachment point expressed as a fraction of the total pool notional.

**Real** detachmentRatio () const

Detachment point expressed as a fraction of the total pool notional.

**Real** basketNotional () const

Original basket notional ignoring any losses.

**Real** basketLGD () const

**Real** trancheNotional () const

Original tranche notional ignoring any losses.

**Real** attachmentAmount () const

Attachment amount = **attachmentRatio()** * **basketNotional()**

**Real** detachmentAmount () const

Detachment amount = **detachmentRatio()** * **basketNotional()**

### std::vector<**Real**> probabilities (const **Date** & d) const

Vector of cumulative default probability to date d for al issuers in the basket.

**Real** cumulatedLoss (const **Date** & startDate, const **Date** & endDate) const

Actual basket losses between start and end date, taking the actual recovery rates of loss events into account.

**Real** remainingNotional (const **Date** & startDate, const **Date** & endDate) const

Remaining basket notional after losses between start and end date. The full notional for defaulted names is subracted, recovery ignored.

### std::vector<**Real**> remainingNotionals (const **Date** & startDate, const **Date** & endDate) const

Vector of surviving notionals after losses between start and end date, recovery ignored.

### std::vector<std::string> remainingNames (const **Date** & startDate, const **Date** & endDate) const

Vector of surviving issuers after defaults between start and end date.

**Real** remainingAttachmentRatio (const **Date** & startDate, const **Date** & endDate) const

The remaining attachment amount is RAA = max (0, attachmentAmount - **cumulatedLoss()**)

The remaining attachment ratio is then RAR = RAA / **remainingNotional()**

**Real** remainingDetachmentRatio (const **Date** & startDate, const **Date** & endDate) const

The remaining detachment amount is RDA = max (0, detachmentAmount - **cumulatedLoss()**)

The remaining detachment ratio is then RDR = RDA / **remainingNotional()**

### void updateScenarioLoss (bool zeroRecovery = false)

Based on the default times stored in the Pool for each name, update the vector of incremental basket losses (sorted by default time) for this basket. If zeroRecovery is set to true, losses are full notional amounts, otherwise loss give defaults.

**Real** scenarioTrancheLoss (**Date** endDate) const

Cumulative tranche loss up to end date under the current scenario

### std::vector<Loss> scenarioIncrementalBasketLosses () const

Vector of incremental basket losses under the current scenario

### std::vector<Loss> scenarioIncrementalTrancheLosses (**Date** startDate = Date::minDate(), **Date** endDate = Date::maxDate()) const

Vector of incremental tranche losses under the current scenario

## Author

Generated automatically by Doxygen for QuantLib from the source code.