Skip to content

Commit 359187a

Browse files
committed
add discount_bond_option method
1 parent b3e1e5b commit 359187a

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

quantlib/models/_model.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ cdef extern from 'ql/models/model.hpp' namespace 'QuantLib' nogil:
3333
DiscountFactor discount(Time t)
3434
Real discountBond(Time now, Time maturity, Array factors)
3535
Real discountBondOption(OptionType type, Real strike, Time maturity, Time bondMaturity)
36-
Real discountBondOption(OptionType type, Real strike, Time maturity, Time bondStart, Time bondMaturity)
36+
#Real discountBondOption(OptionType type, Real strike, Time maturity, Time bondStart, Time bondMaturity)
3737

3838
cdef cppclass ShortRateModel(CalibratedModel):
3939
ShortRateModel(Size nArguments)

quantlib/models/shortrate/onefactor_model.pyx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
"""
2-
Copyright (C) 2015, Enthought Inc
3-
Copyright (C) 2015, Patrick Henaff
1+
#
2+
# Copyright (C) 2015, Enthought Inc
3+
# Copyright (C) 2015, Patrick Henaff
4+
#
5+
# This program is distributed in the hope that it will be useful, but WITHOUT
6+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
7+
# FOR A PARTICULAR PURPOSE. See the license for more details.
48

5-
This program is distributed in the hope that it will be useful, but WITHOUT
6-
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
7-
FOR A PARTICULAR PURPOSE. See the license for more details.
8-
"""
9-
10-
include '../../types.pxi'
9+
from quantlib.types cimport Rate, Real, Time
1110

1211
from quantlib.handle cimport static_pointer_cast
13-
from quantlib.models.model cimport CalibratedModel
14-
cimport quantlib.models._model as _model
12+
from quantlib.instruments.option cimport OptionType
1513
cimport quantlib.models.shortrate._onefactor_model as _ofm
1614
cimport quantlib._stochastic_process as _sp
1715
from quantlib.stochastic_process cimport StochasticProcess1D
@@ -43,6 +41,10 @@ cdef class OneFactorAffineModel(OneFactorModel):
4341
def __init__(self):
4442
raise ValueError('Cannot instantiate OneFactorAffineModel')
4543

46-
def discount_bound(self, Time now, Time maturity, Rate rate):
44+
def discount_bond(self, Time now, Time maturity, Rate rate):
4745
return (<_ofm.OneFactorAffineModel*>self._thisptr.get()).discountBond(
4846
now, maturity, rate)
47+
48+
def discount_bond_option(self, OptionType option_type, Real strike, Time maturity, Time bond_maturity):
49+
return (<_ofm.OneFactorAffineModel*>self._thisptr.get()).discountBondOption(
50+
option_type, strike, maturity, bond_maturity)

0 commit comments

Comments
 (0)