finpricing.model.cds_pricer#

Module Contents#

Classes#

CDSPricer

class finpricing.model.cds_pricer.CDSPricer(fixed_coupon_leg: finpricing.instrument.cds.CDSFixedCouponLeg, contingent_leg: finpricing.instrument.cds.CDSContingentLeg, discount_curve, survival_curve, recovery_rate, granularity: int = 14, include_accrued: bool = True)[source]#

Bases: finpricing.utils.ClassUtil

property cds_style#
property accrued_interest#
classmethod from_cds(cds: finpricing.instrument.cds.CreditDefaultSwap, discount_curve, survival_curve, recovery_rate, granularity: int = 14, include_accrued: bool = True)[source]#
_generate_payment_dates_with_additional_date(coupon_leg: finpricing.instrument.cds.CDSFixedCouponLeg, include_spread: bool = False)[source]#

generate customized fixed payments for a cds fixed coupon leg with additional day added to the accrual end date

NOTE this is not a general purpose function, and should be considered as a workaround. The last accrual period of a CDS has an additional day added to the accrual end date.

Parameters:
  • coupon_leg – a CDSFixedCouponLeg object

  • include_spread – if True, the coupon rate is included in the cashflow amount

generate_upfront_payment_date(calendar_type=None, date=None)[source]#

three business days after the settlement date

NOTE according to the SNAC rule, the upfront payment is exchanged three business day after the trade settlement date

coupon_leg_accrued_interest(valuation_date: datetime.date | finpricing.utils.Date = None, accrued_style: finpricing.utils.CDSAccruedStyle = None, day_count_type: finpricing.utils.DayCountTypes = None)[source]#
pv_annuity(valuation_date: datetime.date | finpricing.utils.Date = None, survival_curve=None, discount_curve=None) float[source]#

calculate the annuity PV of a CDS. This is the PV of the fixed coupon leg when coupon rate is 1.0

NOTE

The notional is included in the annuity calculation. The recovery rate seems to be not needed in this function, maybe because the CDS will pay the full notional

Returns:

Dirty price of coupon leg.

pv_coupon_leg(valuation_date: datetime.date | finpricing.utils.Date = None, discount_curve=None, survival_curve=None)[source]#
pv_contingent_leg_unit_notional(discount_curve, survival_curve, lgd_curve: finpricing.market.lgd_curve.LGDCurve, start_date: datetime.date | finpricing.utils.Date, end_date: datetime.date | finpricing.utils.Date, granularity: int, special_dates: List, is_first_period: bool)[source]#
pv_contingent_leg(valuation_date: datetime.date | finpricing.utils.Date = None, discount_curve=None, survival_curve=None, recovery_rate=None)[source]#
par_spread()[source]#
pv()[source]#