# QuantLib_NthToDefault man page

NthToDefault — N-th to default swap.

## Synopsis

`#include <ql/experimental/credit/nthtodefault.hpp>`

Inherits **Instrument**.

### Classes

classengine

NTD base engine.

### Public Member Functions

NthToDefault(const boost::shared_ptr<Basket> &basket,Sizen, Protection::Side side, constSchedule&premiumSchedule,RateupfrontRate,RatepremiumRate, constDayCounter&dayCounter,Realnominal, bool settlePremiumAccrual)

This product is 'digital'; the basket might be tranched but this is.

boolisExpired() const

returns whether the instrument might have value greater than zero.Rate premium() constReal nominal() constDayCounter dayCounter() const

Protection::Sideside() constSize rank() constSize basketSize() const

constDate&maturity() const

const boost::shared_ptr<Basket> &basket() constRate fairPremium() constReal premiumLegNPV() constReal protectionLegNPV() constReal errorEstimate() const

voidsetupArguments(PricingEngine::arguments *) const

voidfetchResults(const PricingEngine::results *) const

### Additional Inherited Members

## Detailed Description

N-th to default swap.

A NTD instrument exchanges protection against the nth default in a basket of underlying credits for premium payments based on the protected notional amount.

The pricing is analogous to the pricing of a CDS instrument which represents protection against default of a single underlying credit. The only difference is the calculation of the probability of default. In the CDS case, it is the probabilty of single name default; in the NTD case the probability of at least N defaults in the portfolio of underlying credits.

This probability is computed using the algorithm in John Hull and Alan White, 'Valuation of a CDO and nth to default CDS without Monte Carlo simulation', Journal of Derivatives 12, 2, 2004.

The algorithm allows for varying probability of default across the basket. Otherwise, for identical probabilities of default, the probability of n defaults is given by the binomial distribution.

Default correlation is modeled using a one-factor Gaussian copula approach.

The class is tested against data in Hull-White (see reference above.)

## Member Function Documentation

### void setupArguments (PricingEngine::arguments *) const [virtual]

When a derived argument structure is defined for an instrument, this method should be overridden to fill it. This is mandatory in case a pricing engine is used.

Reimplemented from **Instrument**.

### void fetchResults (const PricingEngine::results * r) const [virtual]

When a derived result structure is defined for an instrument, this method should be overridden to read from it. This is mandatory in case a pricing engine is used.

Reimplemented from **Instrument**.

## Author

Generated automatically by Doxygen for QuantLib from the source code.

## Referenced By

basket(3), basketSize(3), NthToDefault(3), premium(3), premiumLegNPV(3), protectionLegNPV(3) and rank(3) are aliases of QuantLib_NthToDefault(3).