Skip to content

Commit

Permalink
simplify compounding
Browse files Browse the repository at this point in the history
  • Loading branch information
thrasibule committed Nov 22, 2023
1 parent 4173549 commit 11e6411
Show file tree
Hide file tree
Showing 17 changed files with 17 additions and 27 deletions.
2 changes: 1 addition & 1 deletion quantlib/_interest_rate.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include 'types.pxi'
from libcpp.string cimport string
from quantlib.time._daycounter cimport DayCounter
from quantlib.time._period cimport Frequency
from quantlib._compounding cimport Compounding
from quantlib.compounding cimport Compounding

cdef extern from 'ql/interestrate.hpp' namespace 'QuantLib':

Expand Down
2 changes: 1 addition & 1 deletion quantlib/cashflows/_fixed_rate_coupon.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ from quantlib.time.businessdayconvention cimport BusinessDayConvention
from quantlib.time._date cimport Date
from quantlib.time._period cimport Frequency, Period
from quantlib.time._calendar cimport Calendar
from quantlib._compounding cimport Compounding
from quantlib.compounding cimport Compounding
from quantlib.time._daycounter cimport DayCounter
from quantlib.time._schedule cimport Schedule
from quantlib._cashflow cimport CashFlow
Expand Down
3 changes: 1 addition & 2 deletions quantlib/cashflows/fixed_rate_coupon.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ include '../types.pxi'

from cython.operator cimport dereference as deref, preincrement as preinc
from libcpp.vector cimport vector
from quantlib.compounding import Compounding
from quantlib._compounding cimport Compounding
from quantlib.compounding cimport Compounding
from quantlib.handle cimport shared_ptr
from quantlib.time.businessdayconvention cimport BusinessDayConvention
from quantlib.time.calendar cimport Calendar
Expand Down
2 changes: 1 addition & 1 deletion quantlib/_compounding.pxd → quantlib/compounding.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cdef extern from "ql/compounding.hpp" namespace "QuantLib":
enum Compounding:
cpdef enum Compounding:
Simple = 0
Continuous = 1
Compounded = 2
Expand Down
8 changes: 0 additions & 8 deletions quantlib/compounding.pyx
Original file line number Diff line number Diff line change
@@ -1,8 +0,0 @@
from . cimport _compounding

cpdef enum Compounding:
Simple = _compounding.Simple
Compounded = _compounding.Compounded
Continuous = _compounding.Continuous
SimpleThenCompounded = _compounding.SimpleThenCompounded
CompoundedThenSimple = _compounding.CompoundedThenSimple
2 changes: 1 addition & 1 deletion quantlib/interest_rate.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ from quantlib.handle cimport shared_ptr

from quantlib.time.daycounter cimport DayCounter
cimport quantlib.time._daycounter as _daycounter
from quantlib._compounding cimport Compounding
from quantlib.compounding cimport Compounding
from quantlib.time.frequency cimport Frequency

cdef class InterestRate:
Expand Down
2 changes: 1 addition & 1 deletion quantlib/pricingengines/bondfunctions.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ from quantlib.instruments.bonds cimport Bond
from quantlib.time.date cimport date_from_qldate, Date
from quantlib.termstructures.yield_term_structure cimport YieldTermStructure
from quantlib.time.daycounter cimport DayCounter
from quantlib._compounding cimport Compounding
from quantlib.compounding cimport Compounding
cimport quantlib.time._date as _dt

cpdef enum DurationType:
Expand Down
2 changes: 1 addition & 1 deletion quantlib/termstructures/_yield_term_structure.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ from quantlib.time._daycounter cimport DayCounter
from quantlib.time._period cimport Frequency
cimport quantlib._quote as _qt
from quantlib._interest_rate cimport InterestRate
from quantlib._compounding cimport Compounding
from quantlib.compounding cimport Compounding

cdef extern from 'ql/termstructures/yieldtermstructure.hpp' namespace 'QuantLib' nogil:

Expand Down
2 changes: 1 addition & 1 deletion quantlib/termstructures/yield_term_structure.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ from quantlib.time.calendar cimport Calendar
from quantlib.time.daycounter cimport DayCounter
from quantlib.time.date cimport Date, date_from_qldate, Period

from quantlib._compounding cimport Compounding
from quantlib.compounding cimport Compounding
from quantlib.time.date import Annual

cimport quantlib.termstructures._yield_term_structure as _yts
Expand Down
5 changes: 2 additions & 3 deletions quantlib/termstructures/yields/_flat_forward.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
FOR A PARTICULAR PURPOSE. See the license for more details.
"""

include '../../types.pxi'

from quantlib.types cimport *
from libcpp cimport bool
from libcpp.vector cimport vector

Expand All @@ -18,7 +17,7 @@ from quantlib.time._date cimport Date
from quantlib.time._daycounter cimport DayCounter
from quantlib.time._period cimport Frequency
cimport quantlib._quote as _qt
from quantlib._compounding cimport Compounding
from quantlib.compounding cimport Compounding

from quantlib.termstructures._yield_term_structure cimport YieldTermStructure

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ from quantlib.time.frequency cimport Frequency
from quantlib.termstructures._yield_term_structure cimport YieldTermStructure
from quantlib._quote cimport Quote
from quantlib.math._interpolations cimport Linear
from quantlib._compounding cimport Compounding
from quantlib.compounding cimport Compounding

cdef extern from 'ql/termstructures/yield/piecewisezerospreadedtermstructure.hpp' namespace 'QuantLib':
cdef cppclass InterpolatedPiecewiseZeroSpreadedTermStructure[I](YieldTermStructure):
Expand Down
2 changes: 1 addition & 1 deletion quantlib/termstructures/yields/_zero_curve.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ from libcpp.pair cimport pair

from quantlib.termstructures._yield_term_structure cimport YieldTermStructure

from quantlib._compounding cimport Compounding
from quantlib.compounding cimport Compounding
from quantlib.time._date cimport Date
from quantlib.time._daycounter cimport DayCounter
from quantlib.time._calendar cimport Calendar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ from quantlib.time.frequency cimport Frequency
from quantlib.termstructures._yield_term_structure cimport YieldTermStructure
from quantlib._quote cimport Quote
from quantlib.math._interpolations cimport Linear
from quantlib._compounding cimport Compounding
from quantlib.compounding cimport Compounding

cdef extern from 'ql/termstructures/yield/zerospreadedtermstructure.hpp' namespace 'QuantLib':
cdef cppclass ZeroSpreadedTermStructure(YieldTermStructure):
Expand Down
2 changes: 1 addition & 1 deletion quantlib/termstructures/yields/flat_forward.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ from quantlib.time.calendar cimport Calendar
from quantlib.time.daycounter cimport DayCounter
from quantlib.time.date cimport Date, date_from_qldate

from quantlib._compounding cimport Compounding
from quantlib.compounding cimport Compounding
from quantlib.time.date import Annual

from quantlib.handle cimport shared_ptr, RelinkableHandle, Handle
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from cython.operator cimport dereference as deref
from libcpp.vector cimport vector
from quantlib.handle cimport Handle, make_shared, static_pointer_cast
from quantlib._compounding cimport Compounding, Continuous
from quantlib.compounding cimport Compounding, Continuous
from quantlib.time.daycounter cimport DayCounter
from quantlib.time.frequency cimport Frequency, NoFrequency
from quantlib.time._date cimport Date as QlDate
Expand Down
2 changes: 1 addition & 1 deletion quantlib/termstructures/yields/zero_curve.pyx.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cimport quantlib.time._date as _date
from quantlib.time.frequency cimport Frequency
from .. cimport _yield_term_structure as _yts

from quantlib._compounding cimport Compounding
from quantlib.compounding cimport Compounding
from quantlib.time.daycounter cimport DayCounter
from quantlib.time.calendar cimport Calendar
from quantlib.math.interpolation cimport Linear, LogLinear, BackwardFlat, Cubic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from cython.operator cimport dereference as deref
from quantlib.handle cimport Handle, make_shared, static_pointer_cast
from quantlib._compounding cimport Compounding, Continuous
from quantlib.compounding cimport Compounding, Continuous
from quantlib.time.daycounter cimport DayCounter
from quantlib.time.frequency cimport Frequency, NoFrequency
from quantlib.quote cimport Quote
Expand Down

0 comments on commit 11e6411

Please sign in to comment.