Skip to content

Commit

Permalink
move bond engines inside folder
Browse files Browse the repository at this point in the history
  • Loading branch information
thrasibule committed Apr 22, 2024
1 parent 9bb8c05 commit 4f6a6e0
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 17 deletions.
1 change: 1 addition & 0 deletions quantlib/pricingengines/bond/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .discountingbondengine import DiscountingBondEngine
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include '../types.pxi'
from quantlib.types cimport Rate, Real, Spread, Size, Time

from quantlib.instruments._bond cimport Bond
from quantlib.handle cimport shared_ptr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ from quantlib.handle cimport Handle, optional
from quantlib.termstructures._yield_term_structure cimport YieldTermStructure

cdef extern from 'ql/pricingengines/bond/discountingbondengine.hpp' namespace \
'QuantLib':
'QuantLib' nogil:

cdef cppclass DiscountingBondEngine(PricingEngine):

DiscountingBondEngine()
DiscountingBondEngine(Handle[YieldTermStructure]& discountCurve)
DiscountingBondEngine(Handle[YieldTermStructure]& discountCurve,
optional[bool] includeSettlementDateFlows)
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
include '../types.pxi'

from quantlib.types cimport Rate, Real, Size
from quantlib.time._date cimport Day, Month, Year, Date as QLDate
from quantlib.time._period cimport Frequency
from quantlib.time._daycounter cimport DayCounter as _DayCounter
cimport quantlib.pricingengines._bondfunctions as _bf
from . cimport _bondfunctions as _bf

from quantlib.handle cimport shared_ptr, Handle
from cython.operator cimport dereference as deref
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,10 @@
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
"""
from cython.operator cimport dereference as deref
from . cimport _discountingbondengine as _dbe

from quantlib.handle cimport Handle, shared_ptr
from .cimport _pricing_engine as _pe
from . cimport _bond
from ..engine cimport PricingEngine

from .engine cimport PricingEngine

cimport quantlib.termstructures._yield_term_structure as _yts
from quantlib.termstructures.yield_term_structure cimport YieldTermStructure

cdef class DiscountingBondEngine(PricingEngine):
Expand All @@ -22,4 +17,4 @@ cdef class DiscountingBondEngine(PricingEngine):
"""
"""

self._thisptr.reset(new _bond.DiscountingBondEngine(discount_curve._thisptr))
self._thisptr.reset(new _dbe.DiscountingBondEngine(discount_curve._thisptr))
2 changes: 1 addition & 1 deletion test/test_bondfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from quantlib.math.interpolation import LogLinear
from quantlib.quotes import SimpleQuote

import quantlib.pricingengines.bondfunctions as bf
import quantlib.pricingengines.bond.bondfunctions as bf


class BondFunctionTestCase(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion test/test_sensitivity_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
AnalyticEuropeanEngine
)
from quantlib.instruments.payoffs import PlainVanillaPayoff
import quantlib.pricingengines.bondfunctions as bf
import quantlib.pricingengines.bond.bondfunctions as bf
from quantlib.experimental.risk.sensitivityanalysis import (
bucket_analysis, parallel_analysis, Centered)
from numpy.testing import assert_allclose
Expand Down

0 comments on commit 4f6a6e0

Please sign in to comment.