aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests
diff options
context:
space:
mode:
Diffstat (limited to 'python/tests')
-rw-r--r--python/tests/test_swaption.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/python/tests/test_swaption.py b/python/tests/test_swaption.py
index bccab8de..33ac81aa 100644
--- a/python/tests/test_swaption.py
+++ b/python/tests/test_swaption.py
@@ -20,7 +20,7 @@ class TestPutCallParity(unittest.TestCase):
receiver.sigma = 0.416
df = self.index._yc.discount_factor(payer.exercise_date_settle)
self.assertAlmostEqual(payer.pv - receiver.pv,
- df * (payer.forward_pv(self.exercise_date) -
+ df * (payer.forward_pv -
g(self.index, self.strike, self.exercise_date, payer._forward_yc)))
def test_inheritance(self):
payer = Swaption(self.index, self.exercise_date, self.strike)
@@ -37,5 +37,14 @@ class TestPutCallParity(unittest.TestCase):
df * (self.index.forward_pv(self.exercise_date)/self.index.notional -
g(self.index, self.strike, self.exercise_date, payer._forward_yc)))
+ def test_calibration(self):
+ payer = Swaption(self.index, self.exercise_date, self.strike)
+ payer.sigma = 0.2
+ pv = 30 * 1e-4
+ payer.pv = pv
+ self.assertAlmostEqual(payer.pv, payer.pv)
+ self.assertAlmostEqual(payer.sigma, 0.3756828)
+
+
if __name__=="__main__":
unittest.main()