aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests
diff options
context:
space:
mode:
Diffstat (limited to 'python/tests')
-rw-r--r--python/tests/test_cms_spread.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/python/tests/test_cms_spread.py b/python/tests/test_cms_spread.py
index 777aee86..db1903ff 100644
--- a/python/tests/test_cms_spread.py
+++ b/python/tests/test_cms_spread.py
@@ -4,8 +4,6 @@ import numpy as np
import unittest
from serenitas.analytics.cms_spread import (
build_spread_index,
- VolatilityType,
- get_swaption_vol_data,
get_swaption_vol_matrix,
get_cms_coupons,
get_params,
@@ -14,6 +12,7 @@ from serenitas.analytics.cms_spread import (
h_put,
CmsSpread,
)
+from serenitas.utils.db import serenitas_pool
from quantlib.quotes import SimpleQuote
from quantlib.time.api import (
Actual365Fixed,
@@ -68,10 +67,9 @@ class TestCmsSpread(unittest.TestCase):
evaluation_date = datetime.date(2018, 8, 23)
self.yc.link_to(YC(evaluation_date=evaluation_date, extrapolation=True))
self.yc.extrapolation = True
- date, surf = get_swaption_vol_data(
- date=evaluation_date, vol_type=VolatilityType.ShiftedLognormal
- )
- atm_vol = get_swaption_vol_matrix(evaluation_date, surf)
+ conn = serenitas_pool.getconn()
+ atm_vol = get_swaption_vol_matrix(conn, evaluation_date)
+ serenitas_pool.putconn(conn)
μ = SimpleQuote(0.1)
self.ρ = SimpleQuote(0.8)
self.cms_pricer = AnalyticHaganPricer(atm_vol, YieldCurveModel.Standard, μ)
@@ -130,7 +128,6 @@ class TestCmsSpread(unittest.TestCase):
def test_scipy_integrate(self):
x, w = roots_hermitenorm(20)
val_call = np.dot(w, h_call(x, self.cap, *self.params, self.ρ.value))
- args = (self.cap, *self.params, self.ρ.value)
val, _ = quad(
_call_integrand,
-np.inf,