quantlib.instruments.credit_default_swap.

CreditDefaultSwap

class CreditDefaultSwap(Protection side, double notional, double spread, Schedule schedule, BusinessDayConvention payment_convention, DayCounter day_counter, bool settles_accrual=True, bool pays_at_default_time=True, Date protection_start=Date(), DayCounter last_period_day_counter=Actual360(True), bool rebates_accrual=True, Date trade_date=Date(), Natural cash_settlement_days=3)

Bases: Instrument

Credit default swap as running-spread only

Parameters:
sideint or {BUYER, SELLER}

Whether the protection is bought or sold.

notionalfloat

Notional value

spreadfloat

Running spread in fractional units.

scheduleSchedule

Coupon schedule.

payment_conventionint

Business-day convention for payment-date adjustment.

day_counterDayCounter

Day-count convention for accrual.

settles_accrualbool, optional

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

pays_at_default_timebool, optional

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.

protection_startDate, optional

The first date where a default event will trigger the contract.

last_period_day_counterDayCounter, optional

Day-count convention for accrual in last period

rebates_accrualbool, optional

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.

trade_dateDate

The contract’s trade date. It will be used with the cash_settlement_days to determine the date on which the cash settlement amount is paid. If not given, the trade date is guessed from the protection start date and schedule date generation rule.

cash_settlement_daysint

The number of business days from trade_date to cash settlement date.

Attributes:
accrual
accrual_rebate_npv
cash_settlement_days
coupon_leg_bps
coupon_leg_npv
coupons
default_leg_npv
error_estimate

Instrument.error_estimate: Real

fair_spread

Returns the running spread that, given the quoted recovery rate, will make the running-only CDS have an NPV of 0.

fair_upfront

Returns the upfront spread that, given the running spread and the quoted recovery rate, will make the instrument have an NPV of 0.

is_expired

Instrument.is_expired: bool

net_present_value

Instrument net present value.

notional
npv

Shortcut to the net_present_value property.

pays_at_default_time
protection_end_date
protection_start_date
rebates_accrual
running_spread
settles_accrual
side
trade_date
upfront
upfront_bps
upfront_npv
valuation_date

the date the net present value refers to.

Methods

conventional_spread(self, Real recovery, ...)

from_upfront(cls, Protection side, ...)

Credit default swap quoted as upfront and running spread

implied_hazard_rate(self, Real target_npv, ...)

set_pricing_engine(self, PricingEngine engine)

Sets the pricing engine.

Notes

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

Warning

if Settings.include_reference_date_cashflows 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.