From ac8393448c1c8ada05ee6493e5f9b28941edfc10 Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Mon, 24 Apr 2023 13:44:33 -0400 Subject: [PATCH] rename classes --- ...n_vol_cube1.pxd => _sabr_swaption_volatility_cube.pxd} | 8 ++++---- ...on_vol_cube1.pxd => sabr_swaption_volatility_cube.pxd} | 2 +- ...on_vol_cube1.pyx => sabr_swaption_volatility_cube.pyx} | 6 +++--- test/test_swaption_vol_cube.py | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) rename quantlib/termstructures/volatility/swaption/{_swaption_vol_cube1.pxd => _sabr_swaption_volatility_cube.pxd} (93%) rename quantlib/termstructures/volatility/swaption/{swaption_vol_cube1.pxd => sabr_swaption_volatility_cube.pxd} (50%) rename quantlib/termstructures/volatility/swaption/{swaption_vol_cube1.pyx => sabr_swaption_volatility_cube.pyx} (94%) diff --git a/quantlib/termstructures/volatility/swaption/_swaption_vol_cube1.pxd b/quantlib/termstructures/volatility/swaption/_sabr_swaption_volatility_cube.pxd similarity index 93% rename from quantlib/termstructures/volatility/swaption/_swaption_vol_cube1.pxd rename to quantlib/termstructures/volatility/swaption/_sabr_swaption_volatility_cube.pxd index 589234519..0808e7205 100644 --- a/quantlib/termstructures/volatility/swaption/_swaption_vol_cube1.pxd +++ b/quantlib/termstructures/volatility/swaption/_sabr_swaption_volatility_cube.pxd @@ -13,8 +13,8 @@ from quantlib.math._interpolations cimport SABRInterpolation from quantlib.time._date cimport Date from quantlib.time._period cimport Period -cdef extern from 'ql/termstructures/volatility/swaption/swaptionvolcube1.hpp' namespace 'QuantLib': - cdef cppclass SwaptionVolCube1x[Model](SwaptionVolatilityCube): +cdef extern from 'ql/termstructures/volatility/swaption/sabrswaptionvolatilitycube.hpp' namespace 'QuantLib': + cdef cppclass XabrSwaptionVolatilityCube[Model](SwaptionVolatilityCube): cppclass Cube: Cube(const vector[Date]& optionDates, const vector[Period]& swapTenors, @@ -49,7 +49,7 @@ cdef extern from 'ql/termstructures/volatility/swaption/swaptionvolcube1.hpp' na const Time swapLengths) void updateInterpolators() Matrix browse() - SwaptionVolCube1x( + XabrSwaptionVolatilityCube( const Handle[SwaptionVolatilityStructure]& atmVolStructure, const vector[Period]& optionTenors, const vector[Period]& swapTenors, @@ -92,4 +92,4 @@ cdef extern from 'ql/termstructures/volatility/swaption/swaptionvolcube1.hpp' na ctypedef SABRInterpolation Interpolation ctypedef SabrSmileSection SmileSection - ctypedef SwaptionVolCube1x[SwaptionVolCubeSabrModel] SwaptionVolCube1 + ctypedef XabrSwaptionVolatilityCube[SwaptionVolCubeSabrModel] SabrSwaptionVolatilityCube diff --git a/quantlib/termstructures/volatility/swaption/swaption_vol_cube1.pxd b/quantlib/termstructures/volatility/swaption/sabr_swaption_volatility_cube.pxd similarity index 50% rename from quantlib/termstructures/volatility/swaption/swaption_vol_cube1.pxd rename to quantlib/termstructures/volatility/swaption/sabr_swaption_volatility_cube.pxd index 4d2a25a81..1e5e5f2c3 100644 --- a/quantlib/termstructures/volatility/swaption/swaption_vol_cube1.pxd +++ b/quantlib/termstructures/volatility/swaption/sabr_swaption_volatility_cube.pxd @@ -1,4 +1,4 @@ from .swaption_vol_cube cimport SwaptionVolatilityCube -cdef class SwaptionVolatilityCube1(SwaptionVolatilityCube): +cdef class SabrSwaptionVolatilityCube(SwaptionVolatilityCube): pass diff --git a/quantlib/termstructures/volatility/swaption/swaption_vol_cube1.pyx b/quantlib/termstructures/volatility/swaption/sabr_swaption_volatility_cube.pyx similarity index 94% rename from quantlib/termstructures/volatility/swaption/swaption_vol_cube1.pyx rename to quantlib/termstructures/volatility/swaption/sabr_swaption_volatility_cube.pyx index b3ebd36f0..c73500a98 100644 --- a/quantlib/termstructures/volatility/swaption/swaption_vol_cube1.pyx +++ b/quantlib/termstructures/volatility/swaption/sabr_swaption_volatility_cube.pyx @@ -11,14 +11,14 @@ from quantlib.quote cimport Quote from quantlib.time.date cimport Period from quantlib.time._period cimport Period as QlPeriod from .swaption_vol_structure cimport SwaptionVolatilityStructure -from . cimport _swaption_vol_cube1 as _svc1 +from . cimport _sabr_swaption_volatility_cube as _ssvc cimport quantlib.indexes._swap_index as _si cimport quantlib._quote as _qt from . cimport _swaption_vol_structure as _svs from ..._vol_term_structure cimport VolatilityTermStructure -cdef class SwaptionVolCube1(SwaptionVolatilityCube): +cdef class SabrSwaptionVolatilityCube(SwaptionVolatilityCube): def __init__(self, atm_vol_structure not None, list option_tenors not None, @@ -65,7 +65,7 @@ cdef class SwaptionVolCube1(SwaptionVolatilityCube): for p in swap_tenors: swap_tenors_vec.push_back(deref(p._thisptr)) - self._derived_ptr = make_shared[_svc1.SwaptionVolCube1]( + self._derived_ptr = make_shared[_ssvc.SabrSwaptionVolatilityCube]( SwaptionVolatilityStructure.swaption_vol_handle(atm_vol_structure), option_tenors_vec, swap_tenors_vec, diff --git a/test/test_swaption_vol_cube.py b/test/test_swaption_vol_cube.py index acb36844b..8170c7e83 100644 --- a/test/test_swaption_vol_cube.py +++ b/test/test_swaption_vol_cube.py @@ -6,8 +6,8 @@ from quantlib.quotes import SimpleQuote from quantlib.termstructures.volatility.swaption.swaption_vol_matrix \ import SwaptionVolatilityMatrix -from quantlib.termstructures.volatility.swaption.swaption_vol_cube1 \ - import SwaptionVolCube1 +from quantlib.termstructures.volatility.swaption.sabr_swaption_volatility_cube \ + import SabrSwaptionVolatilityCube from quantlib.termstructures.volatility.swaption.spreaded_swaption_vol \ import SpreadedSwaptionVolatility from quantlib.indexes.api import EuriborSwapIsdaFixA @@ -70,7 +70,7 @@ def test_sabr_vols(self): parameters_guess.append([SimpleQuote(0.2), SimpleQuote(0.5), SimpleQuote(0.4), SimpleQuote(0.)]) is_parameter_fixed = [False] * 4 - vol_cube = SwaptionVolCube1(self.atm_vol_matrix, + vol_cube = SabrSwaptionVolatilityCube(self.atm_vol_matrix, self.cube.option_tenors, self.cube.swap_tenors, self.cube.strike_spreads, @@ -108,7 +108,7 @@ def test_spreaded_cube(self): SimpleQuote(0.4), SimpleQuote(0.)]) is_parameter_fixed = [False] * 4 spread = SimpleQuote(0.0001) - vol_cube = SwaptionVolCube1(self.atm_vol_matrix, + vol_cube = SabrSwaptionVolatilityCube(self.atm_vol_matrix, self.cube.option_tenors, self.cube.swap_tenors, self.cube.strike_spreads,