diff options
Diffstat (limited to 'python/tests/test_swap_index.py')
| -rw-r--r-- | python/tests/test_swap_index.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/python/tests/test_swap_index.py b/python/tests/test_swap_index.py new file mode 100644 index 00000000..f2816bac --- /dev/null +++ b/python/tests/test_swap_index.py @@ -0,0 +1,19 @@ +import unittest +import sys + +from quantlib.indexes.swap.usd_libor_swap import UsdLiborSwapIsdaFixAm +from quantlib.time.api import Date, Period, Years +from yieldcurve import YC + +class UsdLiborSwap(unittest.TestCase): + def test_creation(self): + yc = YC() + yc.extrapolation = True + USISDA30 = UsdLiborSwapIsdaFixAm(Period(30, Years), forwarding=yc, discounting=yc) + USISDA30.add_fixing(Date(25, 1, 2018), 0.02781) + USISDA02 = UsdLiborSwapIsdaFixAm(Period(2, Years), forwarding=yc, discounting=yc) + USISDA02.add_fixing(Date(25, 1, 2018), 0.02283) + USFS022 = USISDA02.underlying_swap(Date(27, 1, 2020)) + USFS0230 = USISDA30.underlying_swap(Date(27, 1, 2020)) + self.assertEqual(USFS022.fair_rate, USISDA02.fixing(Date(27, 1, 2020))) + self.assertEqual(USFS0230.fair_rate, USISDA30.fixing(Date(27, 1, 2020))) |
