aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/exploration/test_swaption.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/python/exploration/test_swaption.py b/python/exploration/test_swaption.py
new file mode 100644
index 00000000..acaec705
--- /dev/null
+++ b/python/exploration/test_swaption.py
@@ -0,0 +1,18 @@
+from quantlib.time.api import Date, Period, Years
+from yieldcurve import YC
+from quantlib.indexes.swap.usd_libor_swap import UsdLiborSwapIsdaFixAm
+from quantlib.instruments.make_swaption import MakeSwaption
+from quantlib.pricingengines.api import BlackSwaptionEngine
+from quantlib.instruments.swap import Receiver
+
+yc = YC()
+index1 = UsdLiborSwapIsdaFixAm(Period(2, Years), yc)
+index2 = UsdLiborSwapIsdaFixAm(Period(10, Years), yc)
+swaption1 = (MakeSwaption(index1, Period(2, Years), strike=0.0206).
+ with_underlying_type(Receiver)())
+swaption2 = (MakeSwaption(index2, Period(10, Years), strike=0.0212).
+ with_underlying_type(Receiver)())
+pe1 = BlackSwaptionEngine(yc, 0.2987)
+pe2 = BlackSwaptionEngine(yc, 0.2830)
+swaption1.set_pricing_engine(pe1)
+swaption2.set_pricing_engine(pe2)