Skip to content

Commit f587197

Browse files
committed
cleanups
1 parent 29f8fa7 commit f587197

File tree

3 files changed

+14
-23
lines changed

3 files changed

+14
-23
lines changed

quantlib/pricingengines/vanilla/_mceuropeanhestonengine.pxd

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
include '../../types.pxi'
2-
1+
from quantlib.types cimport BigNatural, Real, Size
32
from libcpp cimport bool
43
from quantlib.processes._heston_process cimport HestonProcess
54
from quantlib.pricingengines._pricing_engine cimport PricingEngine
65
from quantlib.handle cimport shared_ptr
6+
from ._mcvanillaengine cimport MCVanillaEngine
7+
from quantlib.methods.montecarlo._mctraits cimport MultiVariate
78

89
#needed to prevent a Forward declaration error
910
cdef extern from 'ql/exercise.hpp':
1011
pass
1112

12-
cdef extern from 'ql/pricingengines/vanilla/mceuropeanhestonengine.hpp' namespace 'QuantLib':
13-
cdef cppclass MCEuropeanHestonEngine[RNG=*,S=*,P=*](PricingEngine):
13+
cdef extern from 'ql/pricingengines/vanilla/mceuropeanhestonengine.hpp' namespace 'QuantLib' nogil:
14+
cdef cppclass MCEuropeanHestonEngine[RNG=*,S=*,P=*](MCVanillaEngine[MultiVariate, RNG, S]):
1415
MCEuropeanHestonEngine(shared_ptr[HestonProcess]& sp,
1516
Size timeSteps,
1617
Size timeStepsPerYear,

quantlib/pricingengines/vanilla/_mcvanillaengine.pxd

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,21 @@
66
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
77
FOR A PARTICULAR PURPOSE. See the license for more details.
88
"""
9-
10-
include '../../types.pxi'
11-
12-
from libcpp.vector cimport vector
13-
from libcpp.string cimport string
9+
from quantlib.types cimport BigNatural, Real, Size
1410
from libcpp cimport bool
1511

1612
from quantlib.handle cimport shared_ptr
17-
cimport quantlib.processes._stochastic_process as _sp
13+
cimport quantlib._stochastic_process as _sp
1814
from quantlib.pricingengines._pricing_engine cimport PricingEngine
1915

2016

21-
cdef extern from 'ql/math/randomnumbers/rngtraits.hpp' namespace 'QuantLib':
17+
cdef extern from 'ql/math/randomnumbers/rngtraits.hpp' namespace 'QuantLib' nogil:
2218
cdef cppclass PseudoRandom:
2319
pass
2420
cdef cppclass LowDiscrepancy:
2521
pass
2622

27-
cdef extern from 'ql/methods/montecarlo/mctraits.hpp' namespace 'QuantLib':
28-
cdef cppclass MultiVariate:
29-
pass
30-
cdef cppclass SingleVariate:
31-
pass
32-
33-
cdef extern from 'ql/pricingengines/vanilla/mcvanillaengine.hpp' namespace 'QuantLib':
23+
cdef extern from 'ql/pricingengines/vanilla/mcvanillaengine.hpp' namespace 'QuantLib' nogil:
3424
cdef cppclass MCVanillaEngine[MC, RNG, S=*, INST=*](PricingEngine):
3525
MCVanillaEngine(shared_ptr[_sp.StochasticProcess]& sp,
3626
Size timeSteps,

quantlib/pricingengines/vanilla/mceuropeanhestonengine.pyx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
from quantlib.types cimport BigNatural, Integer, Real, Size
22
from libcpp cimport bool
3-
from quantlib.handle cimport shared_ptr, static_pointer_cast
3+
from quantlib._defines cimport QL_MAX_INTEGER
4+
from quantlib.handle cimport static_pointer_cast
45
from quantlib.utilities.null cimport Null
56
from quantlib.processes.heston_process cimport HestonProcess
67
cimport quantlib.processes._heston_process as _hp
7-
from .mcvanillaengine cimport MCVanillaEngine
88
from . cimport _mceuropeanhestonengine as _mceh
99

1010
cdef class MCEuropeanHestonEngine(MCVanillaEngine):
1111

12-
def __init__(self, HestonProcess process, Size time_steps=Null[Integer](),
13-
Size steps_per_year=Null[Integer](), bool antithetic_variate=True,
12+
def __init__(self, HestonProcess process, Size time_steps=Null[Size](),
13+
Size steps_per_year=Null[Size](), bool antithetic_variate=True,
1414
Size required_samples=Null[Integer](), Real required_tolerance=Null[Real](),
15-
Size max_samples=Null[Integer](),
15+
Size max_samples=QL_MAX_INTEGER,
1616
BigNatural seed=0):
1717
self._thisptr.reset(
1818
new _mceh.MCEuropeanHestonEngine(

0 commit comments

Comments
 (0)