Options
All
  • Public
  • Public/Protected
  • All
Menu

Credit default swap

note This instrument currently assumes that the issuer did not default until today's date.

warning if Settings.includeReferenceDateCashFlows is set to true, payments occurring at the settlement date of the swap might be included in the NPV and therefore affect the fair-spread calculation. This might not be what you want.

warning conventionalSpread (and impliedHazardRate) by default use the mid-point engine, which is not ISDA conform.

Hierarchy

Implements

Index

Properties

Protected _NPV

_NPV: Real

Protected _accrualRebate

_accrualRebate: CashFlow

Protected _accrualRebateNPV

_accrualRebateNPV: Real

Protected _additionalResults

_additionalResults: Map<string, any> = new Map<string, any>()

_alwaysForward

_alwaysForward: boolean = false

_calculated

_calculated: boolean = false

Protected _claim

_claim: Claim

Protected _couponLegBPS

_couponLegBPS: Real

Protected _couponLegNPV

_couponLegNPV: Real

Protected _defaultLegNPV

_defaultLegNPV: Real

_engine

_engine: PricingEngine

Protected _errorEstimate

_errorEstimate: Real

Protected _fairSpread

_fairSpread: Rate

Protected _fairUpfront

_fairUpfront: Rate

_frozen

_frozen: boolean = false

_isDisposed

_isDisposed: boolean = false

Protected _leg

_leg: Leg

Protected _maturity

_maturity: Date

Protected _notional

_notional: Real

_observables

_observables: Set<Observable> = new Set()

_observers

_observers: Set<Observer> = new Set()

Protected _paysAtDefaultTime

_paysAtDefaultTime: boolean

Protected _protectionStart

_protectionStart: Date

Protected _runningSpread

_runningSpread: Rate

Protected _settlesAccrual

_settlesAccrual: boolean

Protected _side

_side: Side

Protected _upfront

_upfront: Rate

Protected _upfrontBPS

_upfrontBPS: Real

Protected _upfrontNPV

_upfrontNPV: Real

Protected _upfrontPayment

_upfrontPayment: CashFlow

Protected _valuationDate

_valuationDate: Date

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

NPV

  • returns the net present value of the instrument.

    Returns Real

accrualRebateNPV

  • accrualRebateNPV(): Real
  • Returns Real

additionalResults

  • additionalResults(): Map<string, any>
  • returns all additional result returned by the pricing engine.

    Returns Map<string, any>

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

calculate

  • calculate(): void

conventionalSpread

  • Conventional/standard upfront-to-spread conversion

    Under a standard ISDA model and a set of standardised instrument characteristics, it is the running only quoted spread that will make a CDS contract have an NPV of 0 when quoted for that running only spread. Refer to: "ISDA Standard CDS converter specification." May 2009.

    The conventional recovery rate to apply in the calculation is as specified by ISDA, not necessarily equal to the market-quoted one. It is typically 0.4 for SeniorSec and 0.2 for subordinate.

    note The conversion employs a flat hazard rate. As a result, you will not recover the market quotes.

    note This method performs the calculation with the instrument characteristics. It will coincide with the ISDA calculation if your object has the standard characteristics. Notably:

    • The calendar should have no bank holidays, just weekends.
    • The yield curve should be LIBOR piecewise constant in fwd rates, with a discount factor of 1 on the calculation date, which coincides with the trade date.
    • Convention should be Following for yield curve and contract cashflows.
    • The CDS should pay accrued and mature on standard IMM dates, settle on trade date +1 and upfront settle on trade date +3.

    Parameters

    Returns Rate

couponLegBPS

  • couponLegBPS(): Real
  • Returns the variation of the fixed-leg value given a one-basis-point change in the running spread.

    Returns Real

couponLegNPV

  • couponLegNPV(): Real
  • Returns Real

coupons

  • coupons(): Leg
  • Returns Leg

deepUpdate

  • deepUpdate(): void

defaultLegNPV

  • defaultLegNPV(): Real
  • Returns Real

errorEstimate

  • errorEstimate(): Real
  • returns the error estimate on the NPV when available.

    Returns Real

fairSpread

  • fairSpread(): Rate
  • Returns the running spread that, given the quoted recovery rate, will make the running-only CDS have an NPV of 0.

    note This calculation does not take any upfront into account, even if one was given.

    Returns Rate

fairUpfront

  • fairUpfront(): Rate
  • Returns the upfront spread that, given the running spread and the quoted recovery rate, will make the instrument have an NPV of 0.

    Returns Rate

fetchResults

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

impliedHazardRate

  • Implied hazard rate calculation

    note This method performs the calculation with the instrument characteristics. It will coincide with the ISDA calculation if your object has the standard characteristics. Notably:

    • The calendar should have no bank holidays, just weekends.
    • The yield curve should be LIBOR piecewise constant in fwd rates, with a discount factor of 1 on the calculation date, which coincides with the trade date.
    • Convention should be Following for yield curve and contract cashflows.
    • The CDS should pay accrued and mature on standard IMM dates, settle on trade date +1 and upfront settle on trade date +3.

    Parameters

    Returns Rate

init

init1

  • Parameters

    • side: Side

      Whether the protection is bought or sold.

    • notional: Real

      Notional value

    • spread: Rate

      Running spread in fractional units.

    • schedule: Schedule

      Coupon schedule.

    • convention: BusinessDayConvention
    • dayCounter: DayCounter

      Day-count convention for accrual.

    • Default value settlesAccrual: boolean = true

      Whether or not the accrued coupon is due in the event of a default.

    • Default value paysAtDefaultTime: boolean = true

      If set to true, any payments triggered by a default event are due at default time. If set to false, they are due at the end of the accrual period.

    • Default value protectionStart: Date = null

      The first date where a default event will trigger the contract. Typically T+1 Notice there is no default lookback period and protection start here. In the way it determines the dirty amount it is more like the trade execution date

    • Default value claim: Claim = null
    • Default value lastPeriodDayCounter: DayCounter = new DayCounter()

      Day-count convention for accrual in last period

    • Default value rebatesAccrual: boolean = true

      The protection seller pays the accrued scheduled current coupon at the start of the contract. The rebate date is not provided but computed to be two days after protection start.

    Returns CreditDefaultSwap

init2

  • Parameters

    • side: Side

      Whether the protection is bought or sold.

    • notional: Real

      Notional value

    • upfront: Rate

      Upfront in fractional units.

    • runningSpread: Rate
    • schedule: Schedule

      Coupon schedule.

    • convention: BusinessDayConvention
    • dayCounter: DayCounter

      Day-count convention for accrual.

    • Default value settlesAccrual: boolean = true

      Whether or not the accrued coupon is due in the event of a default.

    • Default value paysAtDefaultTime: boolean = true

      If set to true, any payments triggered by a default event are due at default time. If set to false, they are due at the end of the accrual period.

    • Default value protectionStart: Date = null

      The first date where a default event will trigger the contract. Typically T+1 Notice there is no default lookback period and protection start here. In the way it determines the dirty amount it is more like the trade execution date

    • Default value upfrontDate: Date = null

      Settlement date for the upfront and accrual rebate (if any) payments. Typically T+3, this is also the default value.

    • Default value claim: Claim = null
    • Default value lastPeriodDayCounter: DayCounter = new DayCounter()

      Day-count convention for accrual in last period

    • Default value rebatesAccrual: boolean = true

      The protection seller pays the accrued scheduled current coupon at the start of the contract. The rebate date is not provided but computed to be two days after protection start.

    Returns CreditDefaultSwap

isExpired

  • isExpired(): boolean
  • Returns boolean

notional

  • Returns Real

paysAtDefaultTime

  • paysAtDefaultTime(): boolean
  • Returns boolean

performCalculations

  • performCalculations(): void

protectionEndDate

  • protectionEndDate(): Date
  • Returns Date

protectionStartDate

  • protectionStartDate(): Date
  • Returns Date

rebatesAccrual

  • rebatesAccrual(): boolean
  • Returns boolean

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

result

  • result(tag: string): any
  • returns any additional result returned by the pricing engine.

    Parameters

    • tag: string

    Returns any

runningSpread

  • runningSpread(): Rate
  • Returns Rate

setPricingEngine

  • set the pricing engine to be used.

    warning calling this method will have no effects in case the performCalculation method was overridden in a derived class.

    Parameters

    Returns void

settlesAccrual

  • settlesAccrual(): boolean
  • Returns boolean

setupArguments

setupExpired

  • setupExpired(): void

side

  • Returns Side

unfreeze

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

    Returns void

update

  • update(): void

upfront

  • Returns Rate

upfrontBPS

  • upfrontBPS(): Real
  • Returns Real

upfrontNPV

  • upfrontNPV(): Real
  • Returns Real

valuationDate

  • valuationDate(): Date
  • returns the date the net present value refers to.

    Returns Date