aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/tests/test_sabr_quantlib.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/python/tests/test_sabr_quantlib.py b/python/tests/test_sabr_quantlib.py
index 67a33ccb..eeec9e27 100644
--- a/python/tests/test_sabr_quantlib.py
+++ b/python/tests/test_sabr_quantlib.py
@@ -4,16 +4,17 @@ 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]
+if __name__ == "__main__":
+ 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)
+ section = SabrInterpolatedSmileSection(option_date, forward, strikes, False,
+ SimpleQuote(0.4), vol_quotes, 0.1, 1, 0.1, 0.5,
+ is_beta_fixed=True)