-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b94c43e
commit b0308e3
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
quantlib/instruments/bonds/_amortizingfloatingratebond.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from quantlib.types cimport Integer, Natural, Rate, Real, Spread | ||
from libcpp cimport bool | ||
from quantlib.handle cimport shared_ptr | ||
from quantlib.indexes._ibor_index cimport IborIndex | ||
from quantlib.time.businessdayconvention cimport BusinessDayConvention | ||
from quantlib.time._calendar cimport Calendar | ||
from quantlib.time._date cimport Date | ||
from quantlib.time._period cimport Period | ||
from quantlib.time._daycounter cimport DayCounter | ||
from quantlib.time._schedule cimport Schedule | ||
from libcpp.vector cimport vector | ||
from .._bond cimport Bond | ||
|
||
cdef extern from "ql/instruments/bonds/amortizingfloatingratebond.hpp" namespace "QuantLib" nogil: | ||
cdef cppclass AmortizingFloatingRateBond(Bond): | ||
AmortizingFloatingRateBond( | ||
Natural settlementDays, | ||
const vector[Real]& notional, | ||
const Schedule& schedule, | ||
const shared_ptr[IborIndex]& index, | ||
const DayCounter& accrualDayCounter, | ||
BusinessDayConvention paymentConvention,# = Following, | ||
Natural fixingDays,# = Null<Natural>(), | ||
const vector[Real]& gearings, # = { 1.0 }, | ||
const vector[Spread]& spreads, # = { 0.0 }, | ||
const vector[Rate]& caps, # = {}, | ||
const vector[Rate]& floors, # = {}, | ||
bool inArrears,# = false, | ||
const Date& issueDate,# = Date(), | ||
const Period& exCouponPeriod,# = Period(), | ||
const Calendar& exCouponCalendar,# = Calendar(), | ||
BusinessDayConvention exCouponConvention,# = Unadjusted, | ||
bool exCouponEndOfMonth, # = false, | ||
const vector[Real]& redemptions, #= { 100.0 }, | ||
Integer paymentLag # = 0 | ||
) except + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from ..bond cimport Bond | ||
|
||
cdef class AmortizingFloatingRateBond(Bond): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from cython.operator cimport dereference as deref | ||
from libcpp cimport bool | ||
from libcpp.vector cimport vector | ||
|
||
from quantlib.handle cimport static_pointer_cast | ||
cimport quantlib.indexes._ibor_index as _ii | ||
from quantlib.indexes.ibor_index cimport IborIndex | ||
from quantlib.types cimport Natural, Integer, Real, Rate, Spread | ||
from quantlib.time.businessdayconvention cimport BusinessDayConvention, Following, Unadjusted | ||
from quantlib.time.schedule cimport Schedule | ||
from quantlib.time.daycounter cimport DayCounter | ||
from quantlib.time.date cimport Date, Period | ||
from quantlib.time.calendar cimport Calendar | ||
from quantlib.utilities.null cimport Null | ||
from . cimport _amortizingfloatingratebond as _afb | ||
|
||
cdef class AmortizingFloatingRateBond(Bond): | ||
def __init__(self, Natural settlement_days, vector[Real] notional, Schedule schedule, IborIndex index, DayCounter accrual_day_counter, | ||
BusinessDayConvention payment_convention = Following, Natural fixing_days = Null[Natural](), vector[Real] gearings = [1.0], | ||
vector[Spread] spreads = [0.0], | ||
vector[Rate] caps=[], vector[Rate] floors=[], bool in_arrears = False, Date issue_date = Date(), | ||
Period ex_coupon_period = Period(), Calendar ex_coupon_calendar=Calendar(), | ||
BusinessDayConvention ex_coupon_convention=Unadjusted, | ||
bool ex_coupon_end_of_month=False, | ||
vector[Real] redemptions=[100.0], | ||
Integer payment_lag = 0): | ||
self._thisptr.reset( | ||
new _afb.AmortizingFloatingRateBond( | ||
settlement_days, | ||
notional, schedule._thisptr, static_pointer_cast[_ii.IborIndex](index._thisptr), | ||
deref(accrual_day_counter._thisptr), payment_convention, fixing_days, gearings, | ||
spreads, caps, floors, in_arrears, deref(issue_date._thisptr), | ||
deref(ex_coupon_period._thisptr), ex_coupon_calendar._thisptr, | ||
ex_coupon_convention, ex_coupon_end_of_month, | ||
redemptions, | ||
payment_lag | ||
) | ||
) |