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:
InstrumentCredit 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.
- schedule
Schedule Coupon schedule.
- payment_conventionint
Business-day convention for payment-date adjustment.
- day_counter
DayCounter 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_start
Date, optional The first date where a default event will trigger the contract.
- last_period_day_counter
DayCounter, 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_date
Date The contract’s trade date. It will be used with the
cash_settlement_daysto determine the date on which the cash settlement amount is paid. If not given, the trade date is guessed from the protection start date andscheduledate generation rule.- cash_settlement_daysint
The number of business days from
trade_dateto cash settlement date.
- Attributes:
- accrual
- accrual_rebate_npv
- cash_settlement_days
- coupon_leg_bps
- coupon_leg_npv
- coupons
- default_leg_npv
error_estimateInstrument.error_estimate: Real
fair_spreadReturns the running spread that, given the quoted recovery rate, will make the running-only CDS have an NPV of 0.
fair_upfrontReturns the upfront spread that, given the running spread and the quoted recovery rate, will make the instrument have an NPV of 0.
is_expiredInstrument.is_expired: bool
net_present_valueInstrument net present value.
- notional
npvShortcut 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_datethe 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_cashflowsis set toTrue, 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.