Skip to content

Commit

Permalink
rename classes
Browse files Browse the repository at this point in the history
  • Loading branch information
thrasibule committed Nov 22, 2023
1 parent ec93856 commit 4173549
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .swaption_vol_cube cimport SwaptionVolatilityCube

cdef class SwaptionVolatilityCube1(SwaptionVolatilityCube):
cdef class SabrSwaptionVolatilityCube(SwaptionVolatilityCube):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions test/test_swaption_vol_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 4173549

Please sign in to comment.