aboutsummaryrefslogtreecommitdiffstats
path: root/python/test_upfront_cds.py
blob: 1575d7fc4b91f29eff7927ae42010f45daf61fb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from quantlib.time.api import (calendar_from_name, May,
                               Period, Date, Actual365Fixed,
                               Actual360, Quarterly, Following)
from quantlib.time.schedule import CDS
from quantlib.settings import Settings
from quantlib.termstructures.credit.api import UpfrontCdsHelper
from yieldcurve import YC
calendar = calendar_from_name('WO')

todays_date = Date(26, May, 2016)
ts = YC()

Settings.instance().evaluation_date = todays_date
recovery_rate = 0.4
running_spread = 0.05
tenor = Period("5Y")
cds = UpfrontCdsHelper(0.01, running_spread, tenor, 0, calendar, Quarterly, Following,
                       CDS, Actual360(), recovery_rate, ts)