Options
All
  • Public
  • Public/Protected
  • All
Menu

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).

Hierarchy

Implements

Index

Properties

_alwaysForward

_alwaysForward: boolean = false

Private _attachmentAmount

_attachmentAmount: Real

basket tranched inception attachment amount:

Private _attachmentRatio

_attachmentRatio: Real

Private _basketNotional

_basketNotional: Real

_calculated

_calculated: boolean = false

Private _claim

_claim: Claim

The claim is the same for all names

Private _detachmentAmount

_detachmentAmount: Real

basket tranched inception detachment amount:

Private _detachmentRatio

_detachmentRatio: Real

Private _evalDateAttachAmount

_evalDateAttachAmount: Real

Private _evalDateDetachAmmount

_evalDateDetachAmmount: Real

Private _evalDateLiveKeys

_evalDateLiveKeys: DefaultProbKey[]

Private _evalDateLiveList

_evalDateLiveList: Size[]

Caches. Most of the times one wants statistics on the distribution of futures losses at arbitrary dates but some problems (e.g. derivatives pricing) work with todays (evalDate) magnitudes which do not require a loss model and would be too expensive to recompute on every call.

Private _evalDateLiveNames

_evalDateLiveNames: string[]

Private _evalDateLiveNotionals

_evalDateLiveNotionals: Real[]

Private _evalDateRemainingNot

_evalDateRemainingNot: Real

Private _evalDateSettledLoss

_evalDateSettledLoss: Real

_frozen

_frozen: boolean = false

_isDisposed

_isDisposed: boolean = false

Private _lossModel

_lossModel: DefaultLossModel

It is the basket responsibility to ensure that the model assigned it is properly initialized to the basket current data. This might not be the case for various reasons: the basket data might have been updated, the evaluation date has changed or the model has received another request from another basket pointing to it. For this last reason we can never be sure between calls that this is the case (and that is true in a single thread environment only).

Private _notionals

_notionals: Real[]

_observables

_observables: Set<Observable> = new Set()

_observers

_observers: Set<Observer> = new Set()

Private _pool

_pool: Pool

Private _refDate

_refDate: Date

Basket inception date.

Private _trancheNotional

_trancheNotional: Real

basket tranched notional amount:

dispose

dispose: () => void

Type declaration

    • (): void
    • Returns void

isDisposed

isDisposed: boolean

notifyObservers

notifyObservers: () => void

Type declaration

    • (): void
    • Returns void

registerObserver

registerObserver: (o: Observer) => void

Type declaration

registerWith

registerWith: (h: Observable) => void

Type declaration

registerWithObservables

registerWithObservables: (o: Observer) => void

Type declaration

unregisterObserver

unregisterObserver: (o: Observer) => void

Type declaration

unregisterWith

unregisterWith: (h: Observable) => Size

Type declaration

unregisterWithAll

unregisterWithAll: () => void

Type declaration

    • (): void
    • Returns void

Methods

alwaysForwardNotifications

  • alwaysForwardNotifications(): void
  • This method causes the object to forward all notifications, even when not calculated. The default behavior is to forward the first notification received, and discard the others until recalculated; the rationale is that observers were already notified, and don't need further notification until they recalculate, at which point this object would be recalculated too. After recalculation, this object would again forward the first notification received.

    warning Forwarding all notifications will cause a performance hit, and should be used only when discarding notifications cause an incorrect behavior.

    Returns void

attachmentAmount

  • attachmentAmount(): Real
  • Returns Real

attachmentRatio

  • attachmentRatio(): Real
  • Returns Real

basketNotional

  • basketNotional(): Real
  • Returns Real

calculate

  • calculate(): void
  • This method performs all needed calculations by calling the performCalculations method.

    warning Objects cache the results of the previous calculation. Such results will be returned upon later invocations of calculate. When the results depend on arguments which could change between invocations, the lazy object must register itself as observer of such objects for the calculations to be performed again when they change.

    warning Should this method be redefined in derived classes, LazyObject.calculate() should be called in the overriding method.

    Returns void

claim

  • default claim, same for all positions and counterparties

    Returns Claim

computeBasket

  • computeBasket(): void
  • Returns void

cumulatedLoss1

  • cumulatedLoss1(): Real
  • Actual basket losses between the reference date and the calculation date, taking the actual recovery rates of loss events into account. If the event has not settled yet a model driven recovery is used.

    Returns the realized losses in this portfolio since the portfolio default reference date. This method relies on an implementation of the loss given default since the events have not necessarily settled.

    Returns Real

cumulatedLoss2

  • cumulatedLoss2(endDate: Date): Real
  • Parameters

    • endDate: Date

    Returns Real

deepUpdate

  • deepUpdate(): void

defaultCorrelation

  • defaultCorrelation(d: Date, iName: Size, jName: Size): Real
  • Parameters

    Returns Real

defaultKeys

  • Returns DefaultProbKey[]

detachmentAmount

  • detachmentAmount(): Real
  • Returns Real

detachmentRatio

  • detachmentRatio(): Real
  • Returns Real

expectedShortfall

  • Parameters

    Returns Real

expectedTrancheLoss

  • expectedTrancheLoss(d: Date): Real
  • Basket Loss Statistics

    Methods providing statistical metrics on the loss or value distribution of the basket. Most calculations rely on the pressence of a model assigned to the basket.

    Parameters

    • d: Date

    Returns Real

exposure

  • exposure(name: string, d?: Date): Real
  • Parameters

    • name: string
    • Default value d: Date = null

    Returns Real

freeze

  • freeze(): void
  • This method constrains the object to return the presently cached results on successive invocations, even if arguments upon which they depend should change.

    Returns void

init

  • Parameters

    • refDate: Date
    • names: string[]
    • notionals: Real[]
    • pool: Pool
    • Default value attachment: Real = 0
    • Default value detachment: Real = 0
    • Default value claim: Claim = new FaceValueClaim()

    Returns Basket

liveList1

  • liveList1(): Size[]
  • Indexes of remaining names. Notice these are names and not positions.

    Returns Size[]

liveList2

  • liveList2(endDate: Date): Size[]
  • Parameters

    • endDate: Date

    Returns Size[]

lossDistribution

  • Full loss distribution

    Parameters

    • d: Date

    Returns Map<Real, Probability>

names

  • names(): string[]
  • Returns string[]

notionals

  • notionals(): Real[]
  • Returns Real[]

percentile

  • Parameters

    Returns Real

performCalculations

  • performCalculations(): void

pool

  • Returns Pool

probAtLeastNEvents

  • Returns the probaility of having a given or larger number of defaults in the basket portfolio at a given time.

    Parameters

    Returns Probability

probOverLoss

  • The lossFraction is the fraction of losses expressed in inception (no losses) tranche units (e.g. 'attach level'=0%, 'detach level'=100%)

    Parameters

    • d: Date
    • lossFraction: Real

    Returns Probability

probabilities

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

    Parameters

    • d: Date

    Returns Probability[]

probsBeingNthEvent

  • Probability vector that each of the remaining live names (at eval date) is the n-th default by date d.

    The n parameter is the internal index to the name; it should be alive at the evaluation date.

    todo:

    Implement with a string passed

    todo:

    Perform check the name is alive

    Parameters

    Returns Probability[]

recalculate

  • recalculate(): void
  • This method force the recalculation of any results which would otherwise be cached. It is not declared as const since it needs to call the non-const notifyObservers method.

    note Explicit invocation of this method is not necessary if the object registered itself as observer with the structures on which such results depend. It is strongly advised to follow this policy when possible.

    Returns void

recoveryRate

  • recoveryRate(d: Date, iName: Size): Real
  • Expected recovery rate of the underlying position as a fraction of its exposure value at date d given it has defaulted on that date. NOTICE THE ARG IS THE CTPTY....SHOULDNT IT BE THE POSITION/INSTRUMENT?????<<<<<<<<<<<<<<<<<<<<<<<

    Parameters

    • d: Date
    • iName: Size

    Returns Real

refDate

  • refDate(): Date
  • Returns Date

remainingAttachmentAmount1

  • remainingAttachmentAmount1(): Real
  • Attachment amount of the equivalent (after defaults) remaining basket The remaining attachment amount is RAA = max (0, attachmentAmount - cumulatedLoss())

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

    Returns Real

remainingAttachmentAmount2

  • remainingAttachmentAmount2(endDate: Date): Real
  • Parameters

    • endDate: Date

    Returns Real

remainingDefaultKeys1

  • Default keys of non defaulted counterparties

    Returns DefaultProbKey[]

remainingDefaultKeys2

  • Parameters

    • endDate: Date

    Returns DefaultProbKey[]

remainingDetachmentAmount1

  • remainingDetachmentAmount1(): Real
  • Detachment amount of the equivalent remaining basket. The remaining detachment amount is RDA = max (0, detachmentAmount - cumulatedLoss())

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

    Returns Real

remainingDetachmentAmount2

  • remainingDetachmentAmount2(d: Date): Real
  • Parameters

    • d: Date

    Returns Real

remainingNames1

  • remainingNames1(): string[]
  • Vector of surviving issuers after defaults between the reference basket date and the given (or evaluation) date.

    Returns string[]

remainingNames2

  • remainingNames2(endDate: Date): string[]
  • Parameters

    • endDate: Date

    Returns string[]

remainingNotional1

  • remainingNotional1(): Real
  • Remaining full basket (untranched) notional after settled losses between the reference date and the given date. The full notional for defaulted names is subracted, recovery ignored.

    Returns Real

remainingNotional2

  • remainingNotional2(endDate: Date): Real
  • Parameters

    • endDate: Date

    Returns Real

remainingNotionals1

  • remainingNotionals1(): Real[]
  • Vector of surviving notionals after settled losses between the reference date and the given date, recovery ignored.

    Returns Real[]

remainingNotionals2

  • remainingNotionals2(endDate: Date): Real[]
  • Parameters

    • endDate: Date

    Returns Real[]

remainingProbabilities

  • Vector of cumulative default probability to date d for all issuers still (at the evaluation date) alive in the basket.

    Parameters

    • d: Date

    Returns Probability[]

remainingSize1

  • remainingSize1(): Size
  • Number of counterparties alive on the requested date.

    Returns Size

remainingTrancheNotional

  • remainingTrancheNotional(): Real
  • Remaining basket tranched notional on calculation date

    Returns Real

remainingTrancheNotional2

  • remainingTrancheNotional2(endDate: Date): Real
  • Expected basket tranched notional on the requested date according to the basket model. Model should have been assigned.

    Parameters

    • endDate: Date

    Returns Real

setLossModel

  • Assigns the default loss model to this basket. Resets calculations.

    Parameters

    Returns void

settledLoss1

  • settledLoss1(): Real
  • Realized basket losses between the reference date and the calculation date, taking the actual recovery rates of loss events into account. Only default events that have settled (have a realized RR) are accounted for. For contingent losses after a default you need to compute the losses through a DefaultLossModel

    Optionally one can pass a date in the future and that will collect events stored in the issuers list. This shows the effect of 'programmed' (after today's) events on top of past ones. The intention is to be used in risk analysis (jump to default, etc).

    Returns Real

settledLoss2

  • settledLoss2(endDate: Date): Real
  • Parameters

    • endDate: Date

    Returns Real

size

  • Returns Size

splitVaRLevel

  • splitVaRLevel(date: Date, loss: Real): Real[]
  • Split a portfolio loss along counterparties. Typically loss corresponds to some percentile.

    Parameters

    • date: Date
    • loss: Real

    Returns Real[]

trancheNotional

  • trancheNotional(): Real
  • Returns Real

unfreeze

  • unfreeze(): void
  • This method reverts the effect of the freeze method, thus re-enabling recalculations.

    Returns void

update

  • update(): void
  • Returns void