Skip to content

Commit 866d28c

Browse files
committed
add discount_bond_option method
1 parent ca289bb commit 866d28c

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

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)