blob: acaec705a15ad13e46f67c20e6bdf382ebd39cb6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)
|