Skip to content

Commit 0d2caaf

Browse files
committed
DatedOISRateHelper is deprecated
1 parent 3794423 commit 0d2caaf

File tree

2 files changed

+99
-18
lines changed

2 files changed

+99
-18
lines changed

quantlib/termstructures/yields/_ois_rate_helper.pxd

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,40 @@ cdef extern from 'ql/termstructures/yield/oisratehelper.hpp' namespace 'QuantLib
4242
bool applyObservationShift,# = false,
4343
#shared_ptr[FloatingRateCouponPricer] pricer
4444
) except + # = 0.0
45-
46-
cdef cppclass DatedOISRateHelper(RateHelper):
47-
DatedOISRateHelper(
48-
Date& startDate,
49-
Date& endDate,
45+
cdef extern from 'ql/termstructures/yield/oisratehelper.hpp' namespace 'QuantLib':
46+
OISRateHelper* OISRateHelper_ "new QuantLib::OISRateHelper" (
47+
Date startDate,
48+
Date endDate,
5049
Handle[Quote]& fixedRate,
5150
shared_ptr[OvernightIndex]& overnightIndex,
5251
# exogenous discounting curve
53-
Handle[YieldTermStructure] discountingCurve,# = Handle<YieldTermStructure>(),
54-
bool telescopicValueDates, #= false,
55-
RateAveraging averagingMethod #= RateAveraging::Compound)
56-
) except +
52+
Handle[YieldTermStructure]& discountingCurve, # = Handle<YieldTermStructure>()
53+
bool telescopicValueDates, # False)
54+
Integer paymentLag, # = 0
55+
BusinessDayConvention paymentConvention, # = Following
56+
Frequency paymentFrequency, # = Annual
57+
Calendar& paymentCalendar, # = Calendar()
58+
Spread overnightSpread,
59+
Pillar pillar, # = Pillar::LastRelevantDate,
60+
Date customPillarDate, # = Date(),
61+
RateAveraging averagingMethod,# = RateAveraging::Compound,
62+
optional[bool] endOfMonth, # = boost::none
63+
optional[Frequency] fixedPaymentFrequency, # = ext::nullopt,
64+
Calendar fixedCalendar, # = Calendar(),
65+
Natural lookbackDays, # = Null<Natural>(),
66+
Natural lockoutDays, # = 0,
67+
bool applyObservationShift,# = false,
68+
#shared_ptr[FloatingRateCouponPricer] pricer
69+
) except + # = 0.0
70+
71+
# cdef cppclass DatedOISRateHelper(RateHelper):
72+
# DatedOISRateHelper(
73+
# Date& startDate,
74+
# Date& endDate,
75+
# Handle[Quote]& fixedRate,
76+
# shared_ptr[OvernightIndex]& overnightIndex,
77+
# # exogenous discounting curve
78+
# Handle[YieldTermStructure] discountingCurve,# = Handle<YieldTermStructure>(),
79+
# bool telescopicValueDates, #= false,
80+
# RateAveraging averagingMethod #= RateAveraging::Compound)
81+
# ) except +

quantlib/termstructures/yields/ois_rate_helper.pyx

Lines changed: 65 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,27 +83,83 @@ cdef class OISRateHelper(RelativeDateRateHelper):
8383
#pricer._thisptr
8484
)
8585
)
86-
87-
cdef class DatedOISRateHelper(RateHelper):
88-
89-
def __init__(self,
90-
Date start_date not None,
86+
@classmethod
87+
def from_dates(cls, Date start_date not None,
9188
Date end_date not None,
9289
Quote fixed_rate not None,
9390
OvernightIndex overnight_index not None,
9491
# exogenous discounting curve
9592
HandleYieldTermStructure discounting_curve not None=HandleYieldTermStructure(),
9693
bool telescopic_value_dates = False,
94+
Integer payment_lag=0,
95+
BusinessDayConvention payment_convention = Following,
96+
Frequency payment_frequency = Frequency.Annual,
97+
Calendar payment_calendar = Calendar(),
98+
Spread overnight_spread = 0.0,
99+
Pillar pillar=Pillar.LastRelevantDate,
100+
Date custom_pillar_date=Date(),
97101
RateAveraging averaging_method=RateAveraging.Compound,
98-
):
99-
self._thisptr = shared_ptr[_rh.RateHelper](
100-
new _orh.DatedOISRateHelper(
102+
end_of_month=None,
103+
fixed_payment_frequency=None,
104+
Calendar fixed_calendar=Calendar(),
105+
Natural lookback_days=Null[Natural](),
106+
Natural lockout_days=0,
107+
bool apply_observation_shift=False):
108+
cdef OISRateHelper instance = OISRateHelper.__new__(OISRateHelper)
109+
cdef:
110+
optional[bool] end_of_month_opt
111+
optional[Frequency] fixed_payment_frequency_opt
112+
if end_of_month is not None:
113+
end_of_month_opt = <bool>end_of_month
114+
if fixed_payment_frequency is not None:
115+
fixed_payment_frequency_opt = <Frequency>fixed_payment_frequency
116+
instance._thisptr.reset(
117+
_orh.OISRateHelper_(
101118
start_date._thisptr,
102119
end_date._thisptr,
103120
fixed_rate.handle(),
104121
static_pointer_cast[_ib.OvernightIndex](overnight_index._thisptr),
105122
discounting_curve.handle,
106123
telescopic_value_dates,
107-
averaging_method
124+
payment_lag,
125+
<_rh.BusinessDayConvention> payment_convention,
126+
<Frequency> payment_frequency,
127+
payment_calendar._thisptr,
128+
overnight_spread,
129+
pillar,
130+
custom_pillar_date._thisptr,
131+
averaging_method,
132+
end_of_month_opt,
133+
fixed_payment_frequency_opt,
134+
fixed_calendar._thisptr,
135+
lookback_days,
136+
lockout_days,
137+
apply_observation_shift,
138+
#pricer._thisptr
108139
)
109140
)
141+
return instance
142+
143+
# cdef class DatedOISRateHelper(RateHelper):
144+
145+
# def __init__(self,
146+
# Date start_date not None,
147+
# Date end_date not None,
148+
# Quote fixed_rate not None,
149+
# OvernightIndex overnight_index not None,
150+
# # exogenous discounting curve
151+
# HandleYieldTermStructure discounting_curve not None=HandleYieldTermStructure(),
152+
# bool telescopic_value_dates = False,
153+
# RateAveraging averaging_method=RateAveraging.Compound,
154+
# ):
155+
# self._thisptr = shared_ptr[_rh.RateHelper](
156+
# new _orh.DatedOISRateHelper(
157+
# start_date._thisptr,
158+
# end_date._thisptr,
159+
# fixed_rate.handle(),
160+
# static_pointer_cast[_ib.OvernightIndex](overnight_index._thisptr),
161+
# discounting_curve.handle,
162+
# telescopic_value_dates,
163+
# averaging_method
164+
# )
165+
# )

0 commit comments

Comments
 (0)