aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests/test_cds.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/tests/test_cds.py')
-rw-r--r--python/tests/test_cds.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/python/tests/test_cds.py b/python/tests/test_cds.py
index ee4f9bb4..28c22cc2 100644
--- a/python/tests/test_cds.py
+++ b/python/tests/test_cds.py
@@ -1,11 +1,13 @@
import unittest
from pyisda.cdsone import upfront_charge
-from pyisda.utils import build_yc
import datetime
+from quantlib.settings import Settings
+from quantlib.time.api import Date
import sys
sys.path.append('..')
from swaption import Index
+from yieldcurve import YC, ql_to_jp
class TestUpfront(unittest.TestCase):
index = Index.from_name("ig", 26, "5yr",
@@ -17,20 +19,23 @@ class TestUpfront(unittest.TestCase):
self.assertAlmostEqual(-self.index.pv, 685292.81, 2)
def test_cdsone(self):
-
+ settings = Settings()
+ settings.evaluation_date = Date.from_datetime(self.index.trade_date)
+ yc = YC()
+ jp_yc = ql_to_jp(yc)
fee_dirty = self.index.notional * (
upfront_charge(self.index.trade_date, self.index._value_date,
self.index.start_date,
self.index._step_in_date, self.index.start_date,
self.index.end_date, self.index.fixed_rate*1e-4,
- self.index._yc, 70e-4, self.index.recovery,
+ jp_yc, 70e-4, self.index.recovery,
False))
fee_clean = self.index.notional * (
upfront_charge(self.index.trade_date, self.index._value_date,
self.index.start_date,
self.index._step_in_date, self.index.start_date,
self.index.end_date, self.index.fixed_rate*1e-4,
- self.index._yc, 70e-4, self.index.recovery,
+ jp_yc, 70e-4, self.index.recovery,
True))
self.assertAlmostEqual(-fee_dirty, 685292.81, 2)
self.assertAlmostEqual(fee_clean, self.index.clean_pv)