aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests/test_ir_swap.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/tests/test_ir_swap.py')
-rw-r--r--python/tests/test_ir_swap.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/python/tests/test_ir_swap.py b/python/tests/test_ir_swap.py
new file mode 100644
index 00000000..fd921c06
--- /dev/null
+++ b/python/tests/test_ir_swap.py
@@ -0,0 +1,21 @@
+import datetime
+from serenitas.analytics.ir_swap import SofrSwap
+import unittest
+
+
+class TestOISSofrSwap(unittest.TestCase):
+ def test_creation(self):
+ trade = SofrSwap(
+ "5y",
+ fixed_rate=0.025926,
+ value_date=datetime.date(2022, 4, 26),
+ notional=25_000_000,
+ )
+ self.assertAlmostEqual(trade.pv, -83761.318, 5)
+ trade2 = SofrSwap(
+ "5y",
+ fixed_rate=trade.fair_rate,
+ value_date=datetime.date(2022, 4, 26),
+ notional=25_000_000,
+ )
+ self.assertAlmostEqual(trade2.pv, 0.0)