Skip to content

Commit 6bfd0f8

Browse files
committed
add ZeroCouponSwap
1 parent f2e2ca6 commit 6bfd0f8

File tree

4 files changed

+60
-0
lines changed

4 files changed

+60
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from quantlib.types cimport Natural, Rate, Real
2+
from quantlib.handle cimport shared_ptr
3+
from quantlib.time._calendar cimport BusinessDayConvention, Calendar
4+
from quantlib.time._date cimport Date
5+
from quantlib.time._daycounter cimport DayCounter
6+
from quantlib.indexes._ibor_index cimport IborIndex
7+
from .swap cimport Type
8+
from ._swap cimport Swap
9+
10+
cdef extern from "ql/instruments/zerocouponswap.hpp" namespace "QuantLib" nogil:
11+
cdef cppclass ZeroCouponSwap(Swap):
12+
ZeroCouponSwap(Type type,
13+
Real baseNominal,
14+
const Date& startDate,
15+
const Date& maturityDate,
16+
Real fixedPayment,
17+
shared_ptr[IborIndex] iborIndex,
18+
const Calendar& paymentCalendar,
19+
BusinessDayConvention paymentConvention,# = Following,
20+
Natural paymentDelay) # = 0
21+
22+
ZeroCouponSwap(Type type,
23+
Real baseNominal,
24+
const Date& startDate,
25+
const Date& maturityDate,
26+
Rate fixedRate,
27+
const DayCounter& fixedDayCounter,
28+
shared_ptr[IborIndex] iborIndex,
29+
const Calendar& paymentCalendar,
30+
BusinessDayConvention paymentConvention,# = Following,
31+
Natural paymentDelay) # = 0)

quantlib/instruments/api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@
1616
from .overnightindexfuture import OvernightIndexFuture
1717
from .overnightindexedswap import OvernightIndexedSwap
1818
from .make_ois import MakeOIS
19+
from .zerocouponswap import ZeroCouponSwap
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from .swap cimport Swap, Type
2+
3+
cdef class ZeroCouponSwap(Swap):
4+
pass
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from quantlib.types cimport Real, Natural
2+
from quantlib.handle cimport static_pointer_cast
3+
from quantlib.time.date cimport Date
4+
from quantlib.time.calendar cimport Calendar
5+
from quantlib.time.businessdayconvention cimport BusinessDayConvention, Following
6+
from quantlib.indexes.ibor_index cimport IborIndex
7+
from quantlib.indexes cimport _ibor_index as _ib
8+
from . cimport _zerocouponswap as _zcs
9+
10+
cdef class ZeroCouponSwap(Swap):
11+
def __init__(self, Type type, Real nominal, Date start_date, Date maturity, Real fixed_payment, IborIndex ibor_index, Calendar payment_calendar, BusinessDayConvention payment_convention=Following, Natural payment_delay=0):
12+
self._thisptr.reset(
13+
new _zcs.ZeroCouponSwap(
14+
type,
15+
nominal,
16+
start_date._thisptr,
17+
maturity._thisptr,
18+
fixed_payment,
19+
static_pointer_cast[_ib.IborIndex](ibor_index._thisptr),
20+
payment_calendar._thisptr,
21+
payment_convention,
22+
payment_delay
23+
)
24+
)

0 commit comments

Comments
 (0)