diff --git a/quantlib/cashflows/fixed_rate_coupon.pyx b/quantlib/cashflows/fixed_rate_coupon.pyx index 83116dbba..2a1fe6d3d 100644 --- a/quantlib/cashflows/fixed_rate_coupon.pyx +++ b/quantlib/cashflows/fixed_rate_coupon.pyx @@ -54,7 +54,7 @@ cdef class FixedRateLeg(Leg): return self def with_payment_calendar(self, Calendar cal): - self.frl.withPaymentCalendar(deref(cal._thisptr)) + self.frl.withPaymentCalendar(cal._thisptr) return self def with_last_period_day_counter(self, DayCounter dc): diff --git a/quantlib/experimental/termstructures/crosscurrencyratehelpers.pyx b/quantlib/experimental/termstructures/crosscurrencyratehelpers.pyx index 1197a384b..0a0559fb4 100644 --- a/quantlib/experimental/termstructures/crosscurrencyratehelpers.pyx +++ b/quantlib/experimental/termstructures/crosscurrencyratehelpers.pyx @@ -45,7 +45,7 @@ cdef class ConstNotionalCrossCurrencyBasisSwapRateHelper(RelativeDateRateHelper) basis.handle(), deref(tenor._thisptr), fixing_days, - deref(calendar._thisptr), + calendar._thisptr, convention, end_of_month, static_pointer_cast[_ii.IborIndex](base_currency_index._thisptr), @@ -80,7 +80,7 @@ cdef class MtMCrossCurrencyBasisSwapRateHelper(RelativeDateRateHelper): basis.handle(), deref(tenor._thisptr), fixing_days, - deref(calendar._thisptr), + calendar._thisptr, convention, end_of_month, static_pointer_cast[_ii.IborIndex](base_currency_index._thisptr), diff --git a/quantlib/index.pyx b/quantlib/index.pyx index b574032f6..4c11189fb 100644 --- a/quantlib/index.pyx +++ b/quantlib/index.pyx @@ -52,7 +52,7 @@ cdef class Index: """the calendar defining valid fixing dates""" def __get__(self): cdef Calendar cal = Calendar.__new__(Calendar) - cal._thisptr = new _calendar.Calendar(self._thisptr.get().fixingCalendar()) + cal._thisptr = self._thisptr.get().fixingCalendar() return cal @property diff --git a/quantlib/indexes/ibor/libor.pyx b/quantlib/indexes/ibor/libor.pyx index 2138915ee..fe2ad7308 100644 --- a/quantlib/indexes/ibor/libor.pyx +++ b/quantlib/indexes/ibor/libor.pyx @@ -55,12 +55,12 @@ cdef class Libor(IborIndex): deref(tenor._thisptr), settlementDays, deref(currency._thisptr), - deref(financial_center_calendar._thisptr), + financial_center_calendar._thisptr, deref(dayCounter._thisptr), ts._thisptr)) @property def joint_calendar(self): cdef Calendar cal = Calendar.__new__(Calendar) - cal._thisptr = new _calendar.Calendar((<_libor.Libor*>self._thisptr.get()).jointCalendar()) + cal._thisptr = (<_libor.Libor*>self._thisptr.get()).jointCalendar() return cal diff --git a/quantlib/indexes/ibor_index.pyx b/quantlib/indexes/ibor_index.pyx index 956930544..30c1598cc 100644 --- a/quantlib/indexes/ibor_index.pyx +++ b/quantlib/indexes/ibor_index.pyx @@ -32,7 +32,7 @@ cdef class IborIndex(InterestRateIndex): deref(tenor._thisptr), settlement_days, deref(currency._thisptr), - deref(fixing_calendar._thisptr), + fixing_calendar._thisptr, convention, end_of_month, deref(day_counter._thisptr), @@ -94,7 +94,7 @@ cdef class OvernightIndex(IborIndex): new _ib.OvernightIndex(family_name.encode('utf-8'), settlement_days, deref(currency._thisptr), - deref(fixing_calendar._thisptr), + fixing_calendar._thisptr, deref(day_counter._thisptr), yts._thisptr) ) diff --git a/quantlib/indexes/swap_index.pyx b/quantlib/indexes/swap_index.pyx index 626db650e..5c286da37 100644 --- a/quantlib/indexes/swap_index.pyx +++ b/quantlib/indexes/swap_index.pyx @@ -50,7 +50,7 @@ cdef class SwapIndex(InterestRateIndex): deref(tenor._thisptr), settlement_days, deref(currency._thisptr), - deref(calendar._thisptr), + calendar._thisptr, deref(fixed_leg_tenor._thisptr), fixed_leg_convention, deref(fixed_leg_daycounter._thisptr), diff --git a/quantlib/instruments/bonds.pyx b/quantlib/instruments/bonds.pyx index ebdf1e39c..ed1ec9f97 100644 --- a/quantlib/instruments/bonds.pyx +++ b/quantlib/instruments/bonds.pyx @@ -177,9 +177,9 @@ cdef class FixedRateBond(Bond): deref(accrual_day_counter._thisptr), payment_convention, redemption, deref(issue_date._thisptr), - deref(payment_calendar._thisptr), + payment_calendar._thisptr, deref(ex_coupon_period._thisptr), - deref(ex_coupon_calendar._thisptr), + ex_coupon_calendar._thisptr, ex_coupon_convention, ex_coupon_end_of_month) ) @@ -211,7 +211,7 @@ cdef class ZeroCouponBond(Bond): self._thisptr = shared_ptr[_instrument.Instrument]( new _bonds.ZeroCouponBond(settlement_days, - deref(calendar._thisptr), face_amount, + calendar._thisptr, face_amount, deref(maturity_date._thisptr), payment_convention, redemption, deref(issue_date._thisptr) @@ -299,7 +299,7 @@ cdef class CPIBond(Bond): deref(schedule._thisptr), coupons, deref(accrual_day_counter._thisptr), payment_convention, deref(issue_date._thisptr), - deref(payment_calendar._thisptr), deref(ex_coupon_period._thisptr), - deref(ex_coupon_calendar._thisptr), ex_coupon_convention, + payment_calendar._thisptr, deref(ex_coupon_period._thisptr), + ex_coupon_calendar._thisptr, ex_coupon_convention, ex_coupon_end_of_month) ) diff --git a/quantlib/instruments/make_ois.pyx b/quantlib/instruments/make_ois.pyx index afc7102f5..a45e01def 100644 --- a/quantlib/instruments/make_ois.pyx +++ b/quantlib/instruments/make_ois.pyx @@ -82,7 +82,7 @@ cdef class MakeOIS: return self def with_payment_calendar(self, Calendar cal not None): - self._thisptr.withPaymentCalendar(deref(cal._thisptr)) + self._thisptr.withPaymentCalendar(cal._thisptr) return self def with_end_of_month(self, bool flag=True): diff --git a/quantlib/instruments/overnightindexedswap.pyx b/quantlib/instruments/overnightindexedswap.pyx index 8372ca5c8..fe973ff5c 100644 --- a/quantlib/instruments/overnightindexedswap.pyx +++ b/quantlib/instruments/overnightindexedswap.pyx @@ -41,7 +41,7 @@ cdef class OvernightIndexedSwap(Swap): make_shared[_ois.OvernightIndexedSwap]( swap_type, nominal, deref(schedule._thisptr), fixed_rate, deref(fixed_dc._thisptr), static_pointer_cast[_ii.OvernightIndex](overnight_index._thisptr), - spread, payment_lag, payment_adjustment, deref(payment_calendar._thisptr), + spread, payment_lag, payment_adjustment, payment_calendar._thisptr, telescopic_value_dates, averaging_method ) ) @@ -52,7 +52,7 @@ cdef class OvernightIndexedSwap(Swap): make_shared[_ois.OvernightIndexedSwap]( swap_type, nominals, deref(schedule._thisptr), fixed_rate, deref(fixed_dc._thisptr), static_pointer_cast[_ii.OvernightIndex](overnight_index._thisptr), - spread, payment_lag, payment_adjustment, deref(payment_calendar._thisptr), + spread, payment_lag, payment_adjustment, payment_calendar._thisptr, telescopic_value_dates, averaging_method ) ) diff --git a/quantlib/models/equity/heston_model.pyx b/quantlib/models/equity/heston_model.pyx index 5c6bfffcd..638dfffde 100644 --- a/quantlib/models/equity/heston_model.pyx +++ b/quantlib/models/equity/heston_model.pyx @@ -53,7 +53,7 @@ cdef class HestonModelHelper(BlackCalibrationHelper): self._thisptr = shared_ptr[_ch.CalibrationHelper]( new _hm.HestonModelHelper( deref(maturity._thisptr), - deref(calendar._thisptr), + calendar._thisptr, s0, strike_price, volatility.handle(), diff --git a/quantlib/termstructures/credit/default_probability_helpers.pyx b/quantlib/termstructures/credit/default_probability_helpers.pyx index e58e6beeb..8e54dc54f 100644 --- a/quantlib/termstructures/credit/default_probability_helpers.pyx +++ b/quantlib/termstructures/credit/default_probability_helpers.pyx @@ -128,7 +128,7 @@ cdef class SpreadCdsHelper(CdsHelper): self._thisptr = shared_ptr[_ci.DefaultProbabilityHelper]( new _ci.SpreadCdsHelper( running_spread, deref(tenor._thisptr), - settlement_days, deref(calendar._thisptr), + settlement_days, calendar._thisptr, frequency, paymentConvention, date_generation_rule, deref(daycounter._thisptr), @@ -143,7 +143,7 @@ cdef class SpreadCdsHelper(CdsHelper): self._thisptr = shared_ptr[_ci.DefaultProbabilityHelper]( new _ci.SpreadCdsHelper( (running_spread).handle(), deref(tenor._thisptr), - settlement_days, deref(calendar._thisptr), + settlement_days, calendar._thisptr, frequency, paymentConvention, date_generation_rule, deref(daycounter._thisptr), @@ -178,7 +178,7 @@ cdef class UpfrontCdsHelper(CdsHelper): self._thisptr = shared_ptr[_ci.DefaultProbabilityHelper]( new _ci.UpfrontCdsHelper( upfront, running_spread, deref(tenor._thisptr.get()), - settlement_days, deref(calendar._thisptr), frequency, + settlement_days, calendar._thisptr, frequency, paymentConvention, rule, deref(daycounter._thisptr), recovery_rate, discount_curve._thisptr, upfront_settlement_days, settles_accrual, @@ -192,7 +192,7 @@ cdef class UpfrontCdsHelper(CdsHelper): self._thisptr = shared_ptr[_ci.DefaultProbabilityHelper]( new _ci.UpfrontCdsHelper( (upfront).handle(), running_spread, deref(tenor._thisptr), - settlement_days, deref(calendar._thisptr), frequency, + settlement_days, calendar._thisptr, frequency, paymentConvention, rule, deref(daycounter._thisptr), recovery_rate, discount_curve._thisptr, upfront_settlement_days, settles_accrual, diff --git a/quantlib/termstructures/credit/flat_hazard_rate.pyx b/quantlib/termstructures/credit/flat_hazard_rate.pyx index d9992e2b5..6770a78d4 100644 --- a/quantlib/termstructures/credit/flat_hazard_rate.pyx +++ b/quantlib/termstructures/credit/flat_hazard_rate.pyx @@ -34,14 +34,14 @@ cdef class FlatHazardRate(DefaultProbabilityTermStructure): if isinstance(hazard_rate, float): self._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _fhr.FlatHazardRate(settlement_days, - deref(calendar._thisptr), + calendar._thisptr, hazard_rate, deref(day_counter._thisptr))) elif isinstance(hazard_rate, Quote): self._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _fhr.FlatHazardRate( settlement_days, - deref(calendar._thisptr), + calendar._thisptr, (hazard_rate).handle(), deref(day_counter._thisptr))) else: diff --git a/quantlib/termstructures/credit/interpolated_hazardrate_curve.pyx b/quantlib/termstructures/credit/interpolated_hazardrate_curve.pyx index 9b08ecbd9..c06f24322 100644 --- a/quantlib/termstructures/credit/interpolated_hazardrate_curve.pyx +++ b/quantlib/termstructures/credit/interpolated_hazardrate_curve.pyx @@ -44,21 +44,21 @@ cdef class InterpolatedHazardRateCurve(DefaultProbabilityTermStructure): new _ihc.InterpolatedHazardRateCurve[intpl.Linear]( _dates, hazard_rates, deref(day_counter._thisptr), - deref(cal._thisptr)) + cal._thisptr) ) elif interpolator == LogLinear: self._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _ihc.InterpolatedHazardRateCurve[intpl.LogLinear]( _dates, hazard_rates, deref(day_counter._thisptr), - deref(cal._thisptr)) + cal._thisptr) ) elif interpolator == BackwardFlat: self._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _ihc.InterpolatedHazardRateCurve[intpl.BackwardFlat]( _dates, hazard_rates, deref(day_counter._thisptr), - deref(cal._thisptr)) + cal._thisptr) ) else: raise ValueError("interpolator needs to be any of Linear, LogLinear or BackwardFlat") diff --git a/quantlib/termstructures/credit/piecewise_default_curve.pyx b/quantlib/termstructures/credit/piecewise_default_curve.pyx index f7a6544a7..eb5758be9 100644 --- a/quantlib/termstructures/credit/piecewise_default_curve.pyx +++ b/quantlib/termstructures/credit/piecewise_default_curve.pyx @@ -49,49 +49,49 @@ cdef class PiecewiseDefaultCurve(DefaultProbabilityTermStructure): if interpolator == Linear: self._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _pdc.PiecewiseDefaultCurve[_pdc.HazardRate,_pdc.Linear]( - settlement_days, deref(calendar._thisptr), instruments, + settlement_days, calendar._thisptr, instruments, deref(daycounter._thisptr), accuracy)) elif interpolator == LogLinear: self._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _pdc.PiecewiseDefaultCurve[_pdc.HazardRate,_pdc.LogLinear]( - settlement_days, deref(calendar._thisptr), instruments, + settlement_days, calendar._thisptr, instruments, deref(daycounter._thisptr), accuracy)) else: self._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _pdc.PiecewiseDefaultCurve[_pdc.HazardRate,_pdc.BackwardFlat]( - settlement_days, deref(calendar._thisptr), instruments, + settlement_days, calendar._thisptr, instruments, deref(daycounter._thisptr), accuracy)) elif trait == DefaultDensity: if interpolator == Linear: self._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _pdc.PiecewiseDefaultCurve[_pdc.DefaultDensity,_pdc.Linear]( - settlement_days, deref(calendar._thisptr), instruments, + settlement_days, calendar._thisptr, instruments, deref(daycounter._thisptr), accuracy)) elif interpolator == LogLinear: self._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _pdc.PiecewiseDefaultCurve[_pdc.DefaultDensity,_pdc.LogLinear]( - settlement_days, deref(calendar._thisptr), instruments, + settlement_days, calendar._thisptr, instruments, deref(daycounter._thisptr), accuracy)) else: self._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _pdc.PiecewiseDefaultCurve[_pdc.DefaultDensity,_pdc.BackwardFlat]( - settlement_days, deref(calendar._thisptr), instruments, + settlement_days, calendar._thisptr, instruments, deref(daycounter._thisptr), accuracy)) else: if interpolator == Linear: self._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _pdc.PiecewiseDefaultCurve[_pdc.SurvivalProbability,_pdc.Linear]( - settlement_days, deref(calendar._thisptr), instruments, + settlement_days, calendar._thisptr, instruments, deref(daycounter._thisptr), accuracy)) elif interpolator == LogLinear: self._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _pdc.PiecewiseDefaultCurve[_pdc.SurvivalProbability,_pdc.LogLinear]( - settlement_days, deref(calendar._thisptr), instruments, + settlement_days, calendar._thisptr, instruments, deref(daycounter._thisptr), accuracy)) else: self._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _pdc.PiecewiseDefaultCurve[_pdc.SurvivalProbability,_pdc.BackwardFlat]( - settlement_days, deref(calendar._thisptr), instruments, + settlement_days, calendar._thisptr, instruments, deref(daycounter._thisptr), accuracy)) @classmethod @@ -117,49 +117,49 @@ cdef class PiecewiseDefaultCurve(DefaultProbabilityTermStructure): if interpolator == Linear: instance._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _pdc.PiecewiseDefaultCurve[_pdc.HazardRate,_pdc.Linear]( - deref(reference_date._thisptr.get()), instruments, + deref(reference_date._thisptr), instruments, deref(daycounter._thisptr), accuracy)) elif interpolator == LogLinear: instance._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _pdc.PiecewiseDefaultCurve[_pdc.HazardRate,_pdc.LogLinear]( - deref(reference_date._thisptr.get()), instruments, + deref(reference_date._thisptr), instruments, deref(daycounter._thisptr), accuracy)) else: instance._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _pdc.PiecewiseDefaultCurve[_pdc.HazardRate,_pdc.BackwardFlat]( - deref(reference_date._thisptr.get()), instruments, + deref(reference_date._thisptr), instruments, deref(daycounter._thisptr), accuracy)) elif trait == DefaultDensity: if interpolator == Linear: instance._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _pdc.PiecewiseDefaultCurve[_pdc.DefaultDensity,_pdc.Linear]( - deref(reference_date._thisptr.get()), instruments, + deref(reference_date._thisptr), instruments, deref(daycounter._thisptr), accuracy)) elif interpolator == LogLinear: instance._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _pdc.PiecewiseDefaultCurve[_pdc.DefaultDensity,_pdc.LogLinear]( - deref(reference_date._thisptr.get()), + deref(reference_date._thisptr), instruments, deref(daycounter._thisptr), accuracy)) else: instance._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _pdc.PiecewiseDefaultCurve[_pdc.DefaultDensity,_pdc.BackwardFlat]( - deref(reference_date._thisptr.get()), instruments, + deref(reference_date._thisptr), instruments, deref(daycounter._thisptr), accuracy)) else: if interpolator == Linear: instance._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _pdc.PiecewiseDefaultCurve[_pdc.SurvivalProbability,_pdc.Linear]( - deref(reference_date._thisptr.get()), instruments, + deref(reference_date._thisptr), instruments, deref(daycounter._thisptr), accuracy)) elif interpolator == LogLinear: instance._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _pdc.PiecewiseDefaultCurve[_pdc.SurvivalProbability,_pdc.LogLinear]( - deref(reference_date._thisptr.get()), + deref(reference_date._thisptr), instruments, deref(daycounter._thisptr), accuracy)) else: instance._thisptr = shared_ptr[_dts.DefaultProbabilityTermStructure]( new _pdc.PiecewiseDefaultCurve[_pdc.SurvivalProbability,_pdc.BackwardFlat]( - deref(reference_date._thisptr.get()), instruments, + deref(reference_date._thisptr), instruments, deref(daycounter._thisptr), accuracy)) return instance diff --git a/quantlib/termstructures/inflation/inflation_helpers.pyx b/quantlib/termstructures/inflation/inflation_helpers.pyx index fce0425b5..07d4a179f 100644 --- a/quantlib/termstructures/inflation/inflation_helpers.pyx +++ b/quantlib/termstructures/inflation/inflation_helpers.pyx @@ -31,7 +31,7 @@ cdef class ZeroCouponInflationSwapHelper: quote.handle(), deref(swap_obs_lag._thisptr), deref(maturity._thisptr), - deref(calendar._thisptr), payment_convention, + calendar._thisptr, payment_convention, deref(day_counter._thisptr), static_pointer_cast[_ii.ZeroInflationIndex](zii._thisptr), observation_interpolation, @@ -62,7 +62,7 @@ cdef class YearOnYearInflationSwapHelper: quote.handle(), deref(swap_obs_lag._thisptr), deref(maturity._thisptr), - deref(calendar._thisptr), payment_convention, + calendar._thisptr, payment_convention, deref(day_counter._thisptr), static_pointer_cast[_ii.YoYInflationIndex](yii._thisptr), nominal_term_structure._thisptr) diff --git a/quantlib/termstructures/inflation/interpolated_zero_inflation_curve.pyx b/quantlib/termstructures/inflation/interpolated_zero_inflation_curve.pyx index 0a15bc585..20c63497e 100644 --- a/quantlib/termstructures/inflation/interpolated_zero_inflation_curve.pyx +++ b/quantlib/termstructures/inflation/interpolated_zero_inflation_curve.pyx @@ -29,7 +29,7 @@ cdef class InterpolatedZeroInflationCurve(ZeroInflationTermStructure): if interpolator == Linear: self._thisptr.reset(new _izic.InterpolatedZeroInflationCurve[intpl.Linear]( - deref(reference_date._thisptr), deref(calendar._thisptr), + deref(reference_date._thisptr), calendar._thisptr, deref(day_counter._thisptr), deref(lag._thisptr), frequency, _dates, rates)) @@ -37,7 +37,7 @@ cdef class InterpolatedZeroInflationCurve(ZeroInflationTermStructure): elif interpolator == LogLinear: self._thisptr.reset( new _izic.InterpolatedZeroInflationCurve[intpl.LogLinear]( - deref(reference_date._thisptr), deref(calendar._thisptr), + deref(reference_date._thisptr), calendar._thisptr, deref(day_counter._thisptr), deref(lag._thisptr), frequency, _dates, rates)) @@ -45,7 +45,7 @@ cdef class InterpolatedZeroInflationCurve(ZeroInflationTermStructure): elif interpolator == BackwardFlat: self._thisptr.reset( new _izic.InterpolatedZeroInflationCurve[intpl.BackwardFlat]( - deref(reference_date._thisptr), deref(calendar._thisptr), + deref(reference_date._thisptr), calendar._thisptr, deref(day_counter._thisptr), deref(lag._thisptr), frequency, _dates, rates)) diff --git a/quantlib/termstructures/inflation/piecewise_zero_inflation_curve.pyx b/quantlib/termstructures/inflation/piecewise_zero_inflation_curve.pyx index 46f4313bb..46756d592 100644 --- a/quantlib/termstructures/inflation/piecewise_zero_inflation_curve.pyx +++ b/quantlib/termstructures/inflation/piecewise_zero_inflation_curve.pyx @@ -35,7 +35,7 @@ cdef class PiecewiseZeroInflationCurve(InterpolatedZeroInflationCurve): self._thisptr.reset( new _pzic.PiecewiseZeroInflationCurve[intpl.Linear]( deref(reference_date._thisptr), - deref(calendar._thisptr), + calendar._thisptr, deref(day_counter._thisptr), deref(lag._thisptr), frequency, base_zero_rate, @@ -46,7 +46,7 @@ cdef class PiecewiseZeroInflationCurve(InterpolatedZeroInflationCurve): self._thisptr.reset( new _pzic.PiecewiseZeroInflationCurve[intpl.LogLinear]( deref(reference_date._thisptr), - deref(calendar._thisptr), + calendar._thisptr, deref(day_counter._thisptr), deref(lag._thisptr), frequency, base_zero_rate, @@ -56,7 +56,7 @@ cdef class PiecewiseZeroInflationCurve(InterpolatedZeroInflationCurve): self._thisptr.reset( new _pzic.PiecewiseZeroInflationCurve[intpl.BackwardFlat]( deref(reference_date._thisptr), - deref(calendar._thisptr), + calendar._thisptr, deref(day_counter._thisptr), deref(lag._thisptr), frequency, base_zero_rate, diff --git a/quantlib/termstructures/vol_term_structure.pyx b/quantlib/termstructures/vol_term_structure.pyx index c12088188..7df786694 100644 --- a/quantlib/termstructures/vol_term_structure.pyx +++ b/quantlib/termstructures/vol_term_structure.pyx @@ -29,7 +29,7 @@ cdef class VolatilityTermStructure: @property def calendar(self): cdef Calendar instance = Calendar.__new__(Calendar) - instance._thisptr = new _calendar.Calendar(self.as_ptr().calendar()) + instance._thisptr = self.as_ptr().calendar() return instance @property diff --git a/quantlib/termstructures/volatility/equityfx/black_constant_vol.pyx b/quantlib/termstructures/volatility/equityfx/black_constant_vol.pyx index 106ff5ce8..d57ef5c12 100644 --- a/quantlib/termstructures/volatility/equityfx/black_constant_vol.pyx +++ b/quantlib/termstructures/volatility/equityfx/black_constant_vol.pyx @@ -44,7 +44,7 @@ cdef class BlackConstantVol(BlackVolatilityTermStructure): self._thisptr.reset( new _bcv.BlackConstantVol( deref(reference_date._thisptr), - deref(calendar._thisptr), + calendar._thisptr, (volatility).handle(), deref(daycounter._thisptr) ) @@ -53,7 +53,7 @@ cdef class BlackConstantVol(BlackVolatilityTermStructure): self._thisptr.reset( new _bcv.BlackConstantVol( deref(reference_date._thisptr), - deref(calendar._thisptr), + calendar._thisptr, volatility, deref(daycounter._thisptr) ) @@ -63,7 +63,7 @@ cdef class BlackConstantVol(BlackVolatilityTermStructure): self._thisptr.reset( new _bcv.BlackConstantVol( settlement_days, - deref(calendar._thisptr), + calendar._thisptr, (volatility).handle(), deref(daycounter._thisptr) ) @@ -72,7 +72,7 @@ cdef class BlackConstantVol(BlackVolatilityTermStructure): self._thisptr.reset( new _bcv.BlackConstantVol( settlement_days, - deref(calendar._thisptr), + calendar._thisptr, volatility, deref(daycounter._thisptr) ) diff --git a/quantlib/termstructures/volatility/equityfx/black_variance_surface.pyx b/quantlib/termstructures/volatility/equityfx/black_variance_surface.pyx index c8d8553a8..0fabc688d 100644 --- a/quantlib/termstructures/volatility/equityfx/black_variance_surface.pyx +++ b/quantlib/termstructures/volatility/equityfx/black_variance_surface.pyx @@ -73,7 +73,7 @@ cdef class BlackVarianceSurface(BlackVarianceTermStructure): self._thisptr.reset( new _bvs.BlackVarianceSurface( deref(reference_date._thisptr), - deref(cal._thisptr), + cal._thisptr, _dates, strikes, (black_vol_matrix)._thisptr, diff --git a/quantlib/termstructures/volatility/optionlet/optionlet_volatility_structure.pyx b/quantlib/termstructures/volatility/optionlet/optionlet_volatility_structure.pyx index bdab778e9..edb74b31d 100644 --- a/quantlib/termstructures/volatility/optionlet/optionlet_volatility_structure.pyx +++ b/quantlib/termstructures/volatility/optionlet/optionlet_volatility_structure.pyx @@ -24,7 +24,7 @@ cdef class ConstantOptionletVolatility(OptionletVolatilityStructure): self._thisptr = shared_ptr[_ov.OptionletVolatilityStructure]( new _ov.ConstantOptionletVolatility( settlement_days, - deref(calendar._thisptr), + calendar._thisptr, bdc, volatility, deref(daycounter._thisptr) diff --git a/quantlib/termstructures/volatility/swaption/swaption_constant_vol.pyx b/quantlib/termstructures/volatility/swaption/swaption_constant_vol.pyx index a0acb6bdc..2d7580819 100644 --- a/quantlib/termstructures/volatility/swaption/swaption_constant_vol.pyx +++ b/quantlib/termstructures/volatility/swaption/swaption_constant_vol.pyx @@ -27,7 +27,7 @@ cdef class ConstantSwaptionVolatility(SwaptionVolatilityStructure): if isinstance(volatility, float): self._derived_ptr = make_shared[_scv.ConstantSwaptionVolatility]( settlement_days, - deref(calendar._thisptr), + calendar._thisptr, bdc, volatility, deref(day_counter._thisptr), @@ -37,7 +37,7 @@ cdef class ConstantSwaptionVolatility(SwaptionVolatilityStructure): elif isinstance(volatility, Quote): self._derived_ptr = make_shared[_scv.ConstantSwaptionVolatility]( settlement_days, - deref(calendar._thisptr), + calendar._thisptr, bdc, (volatility).handle(), deref(day_counter._thisptr), @@ -63,7 +63,7 @@ cdef class ConstantSwaptionVolatility(SwaptionVolatilityStructure): if isinstance(volatility, float): instance._derived_ptr = make_shared[_scv.ConstantSwaptionVolatility]( deref(reference_date._thisptr), - deref(calendar._thisptr), + calendar._thisptr, bdc, (volatility), deref(day_counter._thisptr), @@ -73,7 +73,7 @@ cdef class ConstantSwaptionVolatility(SwaptionVolatilityStructure): elif isinstance(volatility, Quote): instance._derived_ptr = make_shared[_scv.ConstantSwaptionVolatility]( deref(reference_date._thisptr), - deref(calendar._thisptr), + calendar._thisptr, bdc, (volatility).handle(), deref(day_counter._thisptr), diff --git a/quantlib/termstructures/volatility/swaption/swaption_vol_matrix.pyx b/quantlib/termstructures/volatility/swaption/swaption_vol_matrix.pyx index 620f469cb..0b457b001 100644 --- a/quantlib/termstructures/volatility/swaption/swaption_vol_matrix.pyx +++ b/quantlib/termstructures/volatility/swaption/swaption_vol_matrix.pyx @@ -60,7 +60,7 @@ cdef class SwaptionVolatilityMatrix(SwaptionVolatilityDiscrete): if isinstance(volatilities, Matrix) and isinstance(shifts, Matrix): self._derived_ptr = make_shared[_svm.SwaptionVolatilityMatrix]( - deref(calendar._thisptr), + calendar._thisptr, bdc, option_tenors_vec, swap_tenors_vec, @@ -74,7 +74,7 @@ cdef class SwaptionVolatilityMatrix(SwaptionVolatilityDiscrete): build_vols_shifts(volatilities, shifts, c_vols, c_shifts) self._derived_ptr = make_shared[_svm.SwaptionVolatilityMatrix]( - deref(calendar._thisptr), + calendar._thisptr, bdc, option_tenors_vec, swap_tenors_vec, @@ -118,7 +118,7 @@ cdef class SwaptionVolatilityMatrix(SwaptionVolatilityDiscrete): if isinstance(volatilities, Matrix) and isinstance(shifts, Matrix): instance._derived_ptr = make_shared[_svm.SwaptionVolatilityMatrix]( deref(reference_date._thisptr), - deref(calendar._thisptr), + calendar._thisptr, bdc, option_tenors_vec, swap_tenors_vec, @@ -132,7 +132,7 @@ cdef class SwaptionVolatilityMatrix(SwaptionVolatilityDiscrete): build_vols_shifts(volatilities, shifts, c_vols, c_shifts) instance._derived_ptr = make_shared[_svm.SwaptionVolatilityMatrix]( deref(reference_date._thisptr), - deref(calendar._thisptr), + calendar._thisptr, bdc, option_tenors_vec, swap_tenors_vec, diff --git a/quantlib/termstructures/yields/discount_curve.pyx.in b/quantlib/termstructures/yields/discount_curve.pyx.in index df52a5e35..6d42956f3 100644 --- a/quantlib/termstructures/yields/discount_curve.pyx.in +++ b/quantlib/termstructures/yields/discount_curve.pyx.in @@ -55,7 +55,7 @@ cdef class {{I}}InterpolatedDiscountCurve(YieldTermStructure): self._curve = new _dc.InterpolatedDiscountCurve[intpl.{{I}}]( _dates, dfs, deref(day_counter._thisptr), - deref(cal._thisptr) + cal._thisptr ) self._thisptr.linkTo(shared_ptr[_yts.YieldTermStructure](self._curve)) diff --git a/quantlib/termstructures/yields/flat_forward.pyx b/quantlib/termstructures/yields/flat_forward.pyx index d7af9c93b..b345afba3 100644 --- a/quantlib/termstructures/yields/flat_forward.pyx +++ b/quantlib/termstructures/yields/flat_forward.pyx @@ -86,7 +86,7 @@ cdef class FlatForward(YieldTermStructure): if isinstance(forward, Quote): _forward = shared_ptr[ffwd.YieldTermStructure](new ffwd.FlatForward( settlement_days, - deref(calendar._thisptr), + calendar._thisptr, (forward).handle(), deref(daycounter._thisptr), compounding, @@ -95,7 +95,7 @@ cdef class FlatForward(YieldTermStructure): else: _forward = shared_ptr[ffwd.YieldTermStructure](new ffwd.FlatForward( settlement_days, - deref(calendar._thisptr), + calendar._thisptr, forward, deref(daycounter._thisptr), compounding, diff --git a/quantlib/termstructures/yields/forward_curve.pyx.in b/quantlib/termstructures/yields/forward_curve.pyx.in index 658ca5c86..ac5c872d4 100644 --- a/quantlib/termstructures/yields/forward_curve.pyx.in +++ b/quantlib/termstructures/yields/forward_curve.pyx.in @@ -47,7 +47,7 @@ cdef class {{I}}InterpolatedForwardCurve(YieldTermStructure): """ def __init__(self, list dates, vector[Rate] forwards, - DayCounter day_counter not None, Calendar cal= Calendar()): + DayCounter day_counter not None, Calendar cal=Calendar()): # convert the list of PyQL dates into a vector of QL dates cdef vector[_date.Date] _dates for date in dates: @@ -55,7 +55,7 @@ cdef class {{I}}InterpolatedForwardCurve(YieldTermStructure): self._curve = new _fc.InterpolatedForwardCurve[intpl.{{I}}]( _dates, forwards, deref(day_counter._thisptr), - deref(cal._thisptr) + cal._thisptr ) self._thisptr.linkTo(shared_ptr[_yts.YieldTermStructure](self._curve)) diff --git a/quantlib/termstructures/yields/ois_rate_helper.pyx b/quantlib/termstructures/yields/ois_rate_helper.pyx index e2196e787..7b432848f 100644 --- a/quantlib/termstructures/yields/ois_rate_helper.pyx +++ b/quantlib/termstructures/yields/ois_rate_helper.pyx @@ -56,7 +56,7 @@ cdef class OISRateHelper(RelativeDateRateHelper): payment_lag, <_rh.BusinessDayConvention> payment_convention, payment_frequency, - deref(payment_calendar._thisptr), + payment_calendar._thisptr, deref(forward_start._thisptr), overnight_spread, pillar, diff --git a/quantlib/termstructures/yields/piecewise_yield_curve.pyx.in b/quantlib/termstructures/yields/piecewise_yield_curve.pyx.in index 7e4cb292f..edda04e52 100644 --- a/quantlib/termstructures/yields/piecewise_yield_curve.pyx.in +++ b/quantlib/termstructures/yields/piecewise_yield_curve.pyx.in @@ -79,7 +79,7 @@ cdef class {{T}}{{I}}PiecewiseYieldCurve(YieldTermStructure): instruments.push_back(( helper)._thisptr) self._curve = new _pyc.PiecewiseYieldCurve[trait.{{T}}, intpl.{{I}}]( - settlement_days, deref(calendar._thisptr), instruments, + settlement_days, calendar._thisptr, instruments, deref(daycounter._thisptr), i._thisptr, _pyc.PiecewiseYieldCurve[trait.{{T}}, intpl.{{I}}].bootstrap_type(accuracy) diff --git a/quantlib/termstructures/yields/rate_helpers.pyx b/quantlib/termstructures/yields/rate_helpers.pyx index 656b25c69..effa5f1fc 100644 --- a/quantlib/termstructures/yields/rate_helpers.pyx +++ b/quantlib/termstructures/yields/rate_helpers.pyx @@ -98,7 +98,7 @@ cdef class DepositRateHelper(RelativeDateRateHelper): rate, deref(tenor._thisptr), fixing_days, - deref(calendar._thisptr), + calendar._thisptr, convention, end_of_month, deref(deposit_day_counter._thisptr) @@ -110,7 +110,7 @@ cdef class DepositRateHelper(RelativeDateRateHelper): (rate).handle(), deref(tenor._thisptr), fixing_days, - deref(calendar._thisptr), + calendar._thisptr, convention, end_of_month, deref(deposit_day_counter._thisptr) @@ -152,7 +152,7 @@ cdef class SwapRateHelper(RelativeDateRateHelper): new _rh.SwapRateHelper( rate, deref(tenor._thisptr), - deref(calendar._thisptr), + calendar._thisptr, fixedFrequency, fixedConvention, deref(fixedDayCount._thisptr), @@ -171,7 +171,7 @@ cdef class SwapRateHelper(RelativeDateRateHelper): new _rh.SwapRateHelper( (rate).handle(), deref(tenor._thisptr), - deref(calendar._thisptr), + calendar._thisptr, fixedFrequency, fixedConvention, deref(fixedDayCount._thisptr), @@ -262,7 +262,7 @@ cdef class FraRateHelper(RelativeDateRateHelper): months_to_start, months_to_end, fixing_days, - deref(calendar._thisptr), + calendar._thisptr, convention, end_of_month, deref(day_counter._thisptr), @@ -278,7 +278,7 @@ cdef class FraRateHelper(RelativeDateRateHelper): months_to_start, months_to_end, fixing_days, - deref(calendar._thisptr), + calendar._thisptr, convention, end_of_month, deref(day_counter._thisptr), @@ -340,7 +340,7 @@ cdef class FuturesRateHelper(RateHelper): price, deref(imm_date._thisptr), length_in_months, - deref(calendar._thisptr), + calendar._thisptr, <_rh.BusinessDayConvention> convention, end_of_month, deref(day_counter._thisptr), @@ -354,7 +354,7 @@ cdef class FuturesRateHelper(RateHelper): (price).handle(), deref(imm_date._thisptr), length_in_months, - deref(calendar._thisptr), + calendar._thisptr, <_rh.BusinessDayConvention> convention, end_of_month, deref(day_counter._thisptr), @@ -446,12 +446,12 @@ cdef class FxSwapRateHelper(RelativeDateRateHelper): spot_fx.handle(), deref(tenor._thisptr), fixing_days, - deref(calendar._thisptr), + calendar._thisptr, <_rh.BusinessDayConvention>convention, end_of_month, is_fx_base_currency_collateral_currency, collateral_curve._thisptr, - deref(trading_calendar._thisptr), + trading_calendar._thisptr, ) ) @@ -471,7 +471,7 @@ cdef class FxSwapRateHelper(RelativeDateRateHelper): @property def calendar(self): cdef Calendar r = Calendar.__new__(Calendar) - r._thisptr = new _cal.Calendar(self.as_ptr().calendar()) + r._thisptr = self.as_ptr().calendar() return r @property @@ -489,11 +489,11 @@ cdef class FxSwapRateHelper(RelativeDateRateHelper): @property def trading_calendar(self): cdef Calendar r = Calendar.__new__(Calendar) - r._thisptr = new _cal.Calendar(self.as_ptr().tradingCalendar()) + r._thisptr = self.as_ptr().tradingCalendar() return r @property def adjustment_calendar(self): cdef Calendar r = Calendar.__new__(Calendar) - r._thisptr = new _cal.Calendar(self.as_ptr().adjustmentCalendar()) + r._thisptr = self.as_ptr().adjustmentCalendar() return r diff --git a/quantlib/termstructures/yields/zero_curve.pyx.in b/quantlib/termstructures/yields/zero_curve.pyx.in index e0f9b22ec..9cf7718a0 100644 --- a/quantlib/termstructures/yields/zero_curve.pyx.in +++ b/quantlib/termstructures/yields/zero_curve.pyx.in @@ -60,7 +60,7 @@ cdef class {{I}}InterpolatedZeroCurve(YieldTermStructure): self._curve = new _zc.InterpolatedZeroCurve[intpl.{{I}}]( _dates, yields, deref(day_counter._thisptr), - deref(cal._thisptr), i._thisptr, compounding, frequency + cal._thisptr, i._thisptr, compounding, frequency ) self._thisptr.linkTo(shared_ptr[_yts.YieldTermStructure](self._curve)) diff --git a/quantlib/time/calendar.pxd b/quantlib/time/calendar.pxd index ddf234d02..d4edbdc07 100644 --- a/quantlib/time/calendar.pxd +++ b/quantlib/time/calendar.pxd @@ -3,7 +3,7 @@ cimport quantlib.time._calendar as _calendar from libcpp.vector cimport vector cdef class Calendar: - cdef _calendar.Calendar* _thisptr + cdef _calendar.Calendar _thisptr cdef class TARGET(Calendar): pass diff --git a/quantlib/time/calendar.pyx b/quantlib/time/calendar.pyx index 377c3342e..975db0cbc 100644 --- a/quantlib/time/calendar.pyx +++ b/quantlib/time/calendar.pyx @@ -27,14 +27,6 @@ cdef class Calendar: calendars will be moved to the exchange/country convention. ''' - def __dealloc__(self): - if self._thisptr is not NULL: - del self._thisptr - self._thisptr = NULL - - def __cinit__(self): - self._thisptr = new _calendar.Calendar() - property name: def __get__(self): return self._thisptr.name().decode('utf-8') @@ -143,9 +135,9 @@ cdef class Calendar: elif op == 5: op_str = '>=' elif op == 2: - return deref(self._thisptr) == deref(cal._thisptr) + return self._thisptr == cal._thisptr elif op == 3: - return deref(self._thisptr) != deref(cal._thisptr) + return self._thisptr != cal._thisptr raise TypeError(op_str + " not supported between instances of 'Calendar' and 'Calendar'") def holiday_list(self, date.Date from_date not None, diff --git a/quantlib/time/calendars/_jointcalendar.pxd b/quantlib/time/calendars/_jointcalendar.pxd index cee42bbcf..c2dca6a98 100644 --- a/quantlib/time/calendars/_jointcalendar.pxd +++ b/quantlib/time/calendars/_jointcalendar.pxd @@ -6,16 +6,14 @@ from quantlib.time._calendar cimport Calendar cdef extern from 'ql/time/calendars/jointcalendar.hpp' namespace 'QuantLib': - cdef enum JointCalendarRule: + cdef enum JointCalendarRule: JoinHolidays # A date is a holiday for the joint calendar - # if it is a holiday for any of the given calendars + # if it is a holiday for any of the given calendars JoinBusinessDays # A date is a business day for the joint calendar # if it is a business day for any of the given calendars cdef extern from 'ql/time/calendars/jointcalendar.hpp' namespace 'QuantLib': cdef cppclass JointCalendar(Calendar): - JointCalendar() JointCalendar(Calendar& c1, Calendar& c2, JointCalendarRule r) except + - diff --git a/quantlib/time/calendars/canada.pyx b/quantlib/time/calendars/canada.pyx index b79d24d47..f5757e406 100644 --- a/quantlib/time/calendars/canada.pyx +++ b/quantlib/time/calendars/canada.pyx @@ -6,4 +6,4 @@ cdef class Canada(Calendar): ''' def __cinit__(self, Market market=Market.Settlement): - self._thisptr = new _ca.Canada(market) + self._thisptr = _ca.Canada(market) diff --git a/quantlib/time/calendars/germany.pyx b/quantlib/time/calendars/germany.pyx index e35ba9b53..eefa468e1 100644 --- a/quantlib/time/calendars/germany.pyx +++ b/quantlib/time/calendars/germany.pyx @@ -15,5 +15,4 @@ cdef class Germany(Calendar): def __cinit__(self, Market market=Market.Settlement): - self._thisptr = <_calendar.Calendar*> new \ - _gm.Germany(<_gm.Market>market) + self._thisptr = _gm.Germany(<_gm.Market>market) diff --git a/quantlib/time/calendars/japan.pyx b/quantlib/time/calendars/japan.pyx index a3a8b5ff8..1a83e3eb0 100644 --- a/quantlib/time/calendars/japan.pyx +++ b/quantlib/time/calendars/japan.pyx @@ -8,5 +8,4 @@ cdef class Japan(Calendar): def __cinit__(self): - self._thisptr = <_calendar.Calendar*> new \ - _jp.Japan() + self._thisptr = _jp.Japan() diff --git a/quantlib/time/calendars/jointcalendar.pyx b/quantlib/time/calendars/jointcalendar.pyx index d45a70277..5fbe85eee 100644 --- a/quantlib/time/calendars/jointcalendar.pyx +++ b/quantlib/time/calendars/jointcalendar.pyx @@ -1,4 +1,5 @@ from cython.operator cimport dereference as deref +cimport cython cimport quantlib.time.calendars._jointcalendar as _jc cimport quantlib.time._calendar as _cal from quantlib.time.calendar cimport Calendar @@ -14,14 +15,9 @@ cdef class JointCalendar(Calendar): business days given by either the union or the intersection of the sets of business days of the given calendars. ''' - - def __cinit__(self, Calendar c1, Calendar c2, int jc = JOINHOLIDAYS): - self._thisptr = new _jc.JointCalendar(deref(c1._thisptr), - deref(c2._thisptr), - <_jc.JointCalendarRule> jc) - - def __dealloc__(self): - if self._thisptr is not NULL: - del self._thisptr - self._thisptr = NULL + @cython.cpp_locals(True) + def __cinit__(self, Calendar c1, Calendar c2, int jc = JOINHOLIDAYS): + self._thisptr = _jc.JointCalendar(c1._thisptr, + c2._thisptr, + <_jc.JointCalendarRule> jc) diff --git a/quantlib/time/calendars/null_calendar.pyx b/quantlib/time/calendars/null_calendar.pyx index 8bd6df100..63ba0d26f 100644 --- a/quantlib/time/calendars/null_calendar.pyx +++ b/quantlib/time/calendars/null_calendar.pyx @@ -11,5 +11,5 @@ cdef class NullCalendar(Calendar): ''' def __cinit__(self): - self._thisptr = new _nc.NullCalendar() + self._thisptr = _nc.NullCalendar() diff --git a/quantlib/time/calendars/poland.pyx b/quantlib/time/calendars/poland.pyx index 19dd6417f..47e8512fa 100644 --- a/quantlib/time/calendars/poland.pyx +++ b/quantlib/time/calendars/poland.pyx @@ -7,4 +7,4 @@ cdef class Poland(Calendar): def __cinit__(self): - self._thisptr = new _poland.Poland() + self._thisptr = _poland.Poland() diff --git a/quantlib/time/calendars/switzerland.pyx b/quantlib/time/calendars/switzerland.pyx index 27fecccd8..7da070a6d 100644 --- a/quantlib/time/calendars/switzerland.pyx +++ b/quantlib/time/calendars/switzerland.pyx @@ -8,5 +8,4 @@ cdef class Switzerland(Calendar): def __cinit__(self): - self._thisptr = <_calendar.Calendar*> new \ - _sw.Switzerland() + self._thisptr = _sw.Switzerland() diff --git a/quantlib/time/calendars/target.pyx b/quantlib/time/calendars/target.pyx index a8f175da9..2b5dcd00e 100644 --- a/quantlib/time/calendars/target.pyx +++ b/quantlib/time/calendars/target.pyx @@ -18,4 +18,4 @@ cdef class TARGET(Calendar): ''' def __cinit__(self): - self._thisptr = new _tg.TARGET() + self._thisptr = _tg.TARGET() diff --git a/quantlib/time/calendars/united_kingdom.pyx b/quantlib/time/calendars/united_kingdom.pyx index 21ec5cb4a..d24b74521 100644 --- a/quantlib/time/calendars/united_kingdom.pyx +++ b/quantlib/time/calendars/united_kingdom.pyx @@ -45,4 +45,4 @@ cdef class UnitedKingdom(Calendar): ''' def __cinit__(self, Market market=Market.Settlement): - self._thisptr = new _uk.UnitedKingdom(market) + self._thisptr = _uk.UnitedKingdom(market) diff --git a/quantlib/time/calendars/united_states.pyx b/quantlib/time/calendars/united_states.pyx index 30a64bcf3..6dc4bc80a 100644 --- a/quantlib/time/calendars/united_states.pyx +++ b/quantlib/time/calendars/united_states.pyx @@ -77,4 +77,4 @@ cdef class UnitedStates(Calendar): ''' def __cinit__(self, Market market=Market.Settlement): - self._thisptr = new _us.UnitedStates(market) + self._thisptr = _us.UnitedStates(market) diff --git a/quantlib/time/calendars/weekends_only.pyx b/quantlib/time/calendars/weekends_only.pyx index c678d4622..dca50a4df 100644 --- a/quantlib/time/calendars/weekends_only.pyx +++ b/quantlib/time/calendars/weekends_only.pyx @@ -11,4 +11,4 @@ cdef class WeekendsOnly(Calendar): ''' def __cinit__(self): - self._thisptr = new _wo.WeekendsOnly() + self._thisptr = _wo.WeekendsOnly() diff --git a/quantlib/time/daycounters/simple.pyx b/quantlib/time/daycounters/simple.pyx index 7540d946f..6861cf3e5 100644 --- a/quantlib/time/daycounters/simple.pyx +++ b/quantlib/time/daycounters/simple.pyx @@ -26,12 +26,12 @@ cdef class Actual360(DayCounter): cdef class Business252(DayCounter): def __cinit__(self, *args, calendar=None): - cdef _calendar.Calendar* cl + cdef _calendar.Calendar cl if calendar is None: - cl = new _tg.TARGET() + cl = _tg.TARGET() else: cl = (calendar)._thisptr - self._thisptr = <_daycounter.DayCounter*> new _simple.Business252(deref(cl)) + self._thisptr = <_daycounter.DayCounter*> new _simple.Business252(cl) cdef class OneDayCounter(DayCounter): diff --git a/quantlib/time/schedule.pyx b/quantlib/time/schedule.pyx index 1c48e3db0..aa409e963 100644 --- a/quantlib/time/schedule.pyx +++ b/quantlib/time/schedule.pyx @@ -36,7 +36,7 @@ cdef class Schedule: deref(effective_date._thisptr), deref(termination_date._thisptr), deref(tenor._thisptr), - deref(calendar._thisptr), + calendar._thisptr, business_day_convention, termination_date_convention, date_generation_rule, end_of_month, @@ -64,7 +64,7 @@ cdef class Schedule: cdef optional[BusinessDayConvention] opt_termination_convention = termination_date_convention instance._thisptr = new _schedule.Schedule( _dates, - deref(calendar._thisptr), + calendar._thisptr, business_day_convention, opt_termination_convention, opt_tenor, @@ -89,7 +89,7 @@ cdef class Schedule: deref(effective_date._thisptr), deref(termination_date._thisptr), deref(tenor._thisptr), - deref(calendar._thisptr), + calendar._thisptr, business_day_convention, termination_date_convention, date_generation_rule, end_of_month,