aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests/test_sabr_quantlib.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/tests/test_sabr_quantlib.py')
-rw-r--r--python/tests/test_sabr_quantlib.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/python/tests/test_sabr_quantlib.py b/python/tests/test_sabr_quantlib.py
new file mode 100644
index 00000000..67a33ccb
--- /dev/null
+++ b/python/tests/test_sabr_quantlib.py
@@ -0,0 +1,19 @@
+from quantlib.termstructures.volatility.sabr_interpolated_smilesection import SabrInterpolatedSmileSection
+from quantlib.time.api import Date, Period, Months
+from quantlib.quotes import SimpleQuote
+from quantlib.settings import Settings
+import numpy as np
+
+strikes = np.array([50, 55, 57.5, 60, 62.5, 65, 67.5, 70, 75, 80, 85])
+pvs = np.array([53.65, 37.75, 31.55, 26.45, 22.25, 18.85, 16.15, 13.95, 10.55,
+ 8.05, 6.15, 4.65, 3.65, 2.75]) * 1e-4
+option_date = Settings().instance().evaluation_date + Period(3, Months)
+forward = SimpleQuote(58.71e-4)
+strikes = np.array([50, 55, 57.5, 60, 62.5, 65, 67.5, 70, 75, 80, 85, 90, 95, 100]) * 1e-4
+vol = np.array([28.5, 31.6, 33.7, 36.1, 38.7, 41.5, 44.1,
+ 46.5, 50.8, 54.4, 57.3, 59.8, 61.8, 63.6]) * 1e-2
+vol_quotes = [SimpleQuote(q) for q in vol]
+
+section = SabrInterpolatedSmileSection(option_date, forward, strikes, False,
+ SimpleQuote(0.4), vol_quotes, 0.1, 1, 0.1, 0.5,
+ is_beta_fixed=True)