aboutsummaryrefslogtreecommitdiffstats
path: root/python/test_upfront_cds.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/test_upfront_cds.py')
-rw-r--r--python/test_upfront_cds.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/python/test_upfront_cds.py b/python/test_upfront_cds.py
new file mode 100644
index 00000000..1575d7fc
--- /dev/null
+++ b/python/test_upfront_cds.py
@@ -0,0 +1,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)