-
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.
allow OvernightIndexedSwap in Swaption
- Loading branch information
1 parent
ab650eb
commit ca58e7c
Showing
12 changed files
with
184 additions
and
212 deletions.
There are no files selected for viewing
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,56 @@ | ||
from libcpp.vector cimport vector | ||
|
||
from quantlib.types cimport Natural, Rate, Real, Spread | ||
from quantlib.handle cimport shared_ptr, optional | ||
from quantlib.time._calendar cimport BusinessDayConvention, Calendar | ||
from quantlib.time._date cimport Date | ||
from quantlib.time._daycounter cimport DayCounter | ||
from quantlib.time._schedule cimport Schedule | ||
from quantlib._cashflow cimport Leg | ||
from ._swap cimport Swap | ||
from .swap cimport Type | ||
from quantlib.indexes._ibor_index cimport IborIndex | ||
|
||
cdef extern from 'ql/instruments/fixedvsfloatingswap.hpp' namespace 'QuantLib': | ||
cdef cppclass FixedVsFloatingSwap(Swap): | ||
FixedVsFloating(Type type, | ||
vector[Real] fixed_nominals, | ||
Schedule& fixedSchedule, | ||
Rate fixedRate, | ||
DayCounter& fixedDayCount, | ||
vector[Real] floating_nominals, | ||
Schedule& floatSchedule, | ||
shared_ptr[IborIndex] iborIndex, | ||
Spread spread, | ||
DayCounter& floatingDayCount, | ||
optional[BusinessDayConvention] paymentConvention, | ||
Natural payment_lag, # = 0 | ||
Calendar payment_calendar) # = Calendar() | ||
|
||
Type type() | ||
Real nominal() | ||
vector[Real] nominals() | ||
|
||
vector[Real] fixedNominals() | ||
Schedule& fixedSchedule() | ||
Rate fixedRate() | ||
DayCounter& fixedDayCount() | ||
|
||
vector[Real] floatingNominals() | ||
Schedule& floatingSchedule() | ||
shared_ptr[IborIndex]& iborIndex() | ||
Spread spread() | ||
DayCounter& floatingDayCount() | ||
|
||
BusinessDayConvention paymentConvention() | ||
|
||
Leg& fixedLeg() | ||
Leg& floatingLeg() | ||
|
||
Real fixedLegBPS() except + | ||
Real fixedLegNPV() except + | ||
Rate fairRate() except + | ||
|
||
Real floatingLegBPS() except + | ||
Real floatingLegNPV() except + | ||
Spread fairSpread() 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
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
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
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,5 @@ | ||
from .swap cimport Swap | ||
from . cimport _fixedvsfloatingswap | ||
|
||
cdef class FixedVsFloatingSwap(Swap): | ||
cdef inline _fixedvsfloatingswap.FixedVsFloatingSwap* get_ptr(self) |
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,92 @@ | ||
from quantlib.cashflows.ibor_coupon cimport IborLeg | ||
from quantlib.time.schedule cimport Schedule | ||
from quantlib.time.daycounter cimport DayCounter | ||
from quantlib.time._daycounter cimport DayCounter as QlDayCounter | ||
from quantlib.cashflows.fixed_rate_coupon cimport FixedRateLeg | ||
|
||
cdef class FixedVsFloatingSwap(Swap): | ||
|
||
|
||
cdef inline _fixedvsfloatingswap.FixedVsFloatingSwap* get_ptr(self): | ||
return <_fixedvsfloatingswap.FixedVsFloatingSwap*>self._thisptr.get() | ||
|
||
@property | ||
def fair_rate(self): | ||
return self.get_ptr().fairRate() | ||
|
||
@property | ||
def fair_spread(self): | ||
return self.get_ptr().fairSpread() | ||
|
||
@property | ||
def nominal(self): | ||
return self.get_ptr().nominal() | ||
|
||
@property | ||
def nominals(self): | ||
return self.get_ptr().nominals() | ||
|
||
@property | ||
def type(self): | ||
return self.get_ptr().type() | ||
|
||
@property | ||
def fixed_rate(self): | ||
return self.get_ptr().fixedRate() | ||
|
||
@property | ||
def fixed_schedule(self): | ||
cdef Schedule sched = Schedule.__new__(Schedule) | ||
sched._thisptr = self.get_ptr().fixedSchedule() | ||
return sched | ||
|
||
@property | ||
def fixed_day_count(self): | ||
cdef DayCounter dc = DayCounter.__new__(DayCounter) | ||
dc._thisptr = new QlDayCounter(self.get_ptr().fixedDayCount()) | ||
return dc | ||
|
||
@property | ||
def floating_schedule(self): | ||
cdef Schedule sched = Schedule.__new__(Schedule) | ||
sched._thisptr = self.get_ptr().floatingSchedule() | ||
return sched | ||
|
||
@property | ||
def spread(self): | ||
return self.get_ptr().spread() | ||
|
||
@property | ||
def floating_day_count(self): | ||
cdef DayCounter dc = DayCounter.__new__(DayCounter) | ||
dc._thisptr = new QlDayCounter(self.get_ptr().floatingDayCount()) | ||
return dc | ||
|
||
@property | ||
def fixed_leg(self): | ||
cdef FixedRateLeg leg = FixedRateLeg.__new__(FixedRateLeg) | ||
leg._thisptr = self.get_ptr().fixedLeg() | ||
return leg | ||
|
||
@property | ||
def fixed_leg_NPV(self): | ||
return self.get_ptr().fixedLegNPV() | ||
|
||
@property | ||
def fixed_leg_BPS(self): | ||
return self.get_ptr().fixedLegBPS() | ||
|
||
@property | ||
def floating_leg(self): | ||
cdef IborLeg leg = IborLeg.__new__(IborLeg) | ||
leg._thisptr = self.get_ptr().floatingLeg() | ||
return leg | ||
|
||
@property | ||
def floating_leg_NPV(self): | ||
return self.get_ptr().floatingLegNPV() | ||
|
||
|
||
@property | ||
def floating_leg_BPS(self): | ||
return self.get_ptr().floatingLegBPS() |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from .swap cimport Swap | ||
from .fixedvsfloatingswap cimport FixedVsFloatingSwap | ||
|
||
cdef class OvernightIndexedSwap(Swap): | ||
cdef class OvernightIndexedSwap(FixedVsFloatingSwap): | ||
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
Oops, something went wrong.