Skip to content

Commit

Permalink
rename to DateGeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
thrasibule committed Nov 21, 2023
1 parent a59ca89 commit 8b9d0ba
Show file tree
Hide file tree
Showing 30 changed files with 90 additions and 91 deletions.
4 changes: 2 additions & 2 deletions quantlib/instruments/_bonds.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ from quantlib.time._schedule cimport Schedule
from quantlib._cashflow cimport Leg
from quantlib.indexes._ibor_index cimport IborIndex
from quantlib.indexes._inflation_index cimport ZeroInflationIndex
from quantlib.time._schedule cimport Rule
from quantlib.time._schedule cimport DateGeneration
from quantlib._compounding cimport Compounding

cdef extern from 'ql/instruments/bond.hpp' namespace 'QuantLib':
Expand Down Expand Up @@ -110,7 +110,7 @@ cdef extern from 'ql/instruments/bonds/floatingratebond.hpp' namespace 'QuantLib
Real redemption,
Date& issueDate,
Date& stubDate,
Rule rule) except +
DateGeneration rule) except +

cdef extern from 'ql/cashflows/cpicoupon.hpp' namespace 'QuantLib::CPI':
cdef enum InterpolationType:
Expand Down
4 changes: 2 additions & 2 deletions quantlib/instruments/_credit_default_swap.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ from quantlib._cashflow cimport CashFlow, Leg
from quantlib.time._calendar cimport BusinessDayConvention
from quantlib.time._date cimport Date, Period
from quantlib.time._daycounter cimport DayCounter
from quantlib.time._schedule cimport Schedule, Rule
from quantlib.time._schedule cimport Schedule, DateGeneration

cdef extern from 'ql/default.hpp' namespace 'QuantLib::Protection':
enum Side:
Expand Down Expand Up @@ -95,4 +95,4 @@ cdef extern from 'ql/instruments/creditdefaultswap.hpp' namespace 'QuantLib':
Real accuracy, # = 1.0e-8
PricingModel model # = Midpoint
) except +
Date cdsMaturity(const Date& tradeDate, const Period& tenor, Rule rule) except +ValueError
Date cdsMaturity(const Date& tradeDate, const Period& tenor, DateGeneration rule) except +ValueError
4 changes: 2 additions & 2 deletions quantlib/instruments/_make_cds.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ from quantlib.time._calendar cimport Calendar
from quantlib.time._daycounter cimport DayCounter
from quantlib.time._date cimport Date
from quantlib.time._period cimport Period
from quantlib.time._schedule cimport Rule
from quantlib.time.dategeneration cimport DateGeneration
from ._credit_default_swap cimport Side, CreditDefaultSwap

cdef extern from 'ql/instruments/makecds.hpp' namespace 'QuantLib':
Expand All @@ -28,7 +28,7 @@ cdef extern from 'ql/instruments/makecds.hpp' namespace 'QuantLib':
MakeCreditDefaultSwap& withCouponTenor(Period)
MakeCreditDefaultSwap& withDayCounter(DayCounter&)
MakeCreditDefaultSwap& withLastPeriodDayCounter(DayCounter&)
MakeCreditDefaultSwap& withDateGenerationRule(Rule rule)
MakeCreditDefaultSwap& withDateGenerationRule(DateGeneration rule)
MakeCreditDefaultSwap& withCashSettlementDays(Natural cashSettlementDays)

MakeCreditDefaultSwap& withPricingEngine(const shared_ptr[PricingEngine]&)
Expand Down
6 changes: 3 additions & 3 deletions quantlib/instruments/_make_cms.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ from quantlib.time._calendar cimport Calendar
from quantlib.time._daycounter cimport DayCounter
from quantlib.time._date cimport Date
from quantlib.time._period cimport Period
from quantlib.time._schedule cimport Rule
from quantlib.time.dategeneration cimport DateGeneration
from quantlib.handle cimport Handle
from quantlib.termstructures._yield_term_structure cimport YieldTermStructure

Expand All @@ -34,7 +34,7 @@ cdef extern from 'ql/instruments/makecms.hpp' namespace 'QuantLib':
MakeCms& withCmsLegCalendar(const Calendar& cal)
MakeCms& withCmsLegConvention(BusinessDayConvention bdc)
MakeCms& withCmsLegTerminationDateConvention(BusinessDayConvention)
MakeCms& withCmsLegRule(Rule r)
MakeCms& withCmsLegRule(DateGeneration r)
MakeCms& withCmsLegEndOfMonth(bool flag = True)
MakeCms& withCmsLegFirstDate(const Date& d)
MakeCms& withCmsLegNextToLastDate(const Date& d)
Expand All @@ -45,7 +45,7 @@ cdef extern from 'ql/instruments/makecms.hpp' namespace 'QuantLib':
MakeCms& withFloatingLegConvention(BusinessDayConvention bdc)
MakeCms& withFloatingLegTerminationDateConvention(
BusinessDayConvention bdc)
MakeCms& withFloatingLegRule(Rule r)
MakeCms& withFloatingLegRule(DateGeneration r)
MakeCms& withFloatingLegEndOfMonth(bool flag = True)
MakeCms& withFloatingLegFirstDate(const Date& d)
MakeCms& withFloatingLegNextToLastDate(const Date& d)
Expand Down
4 changes: 2 additions & 2 deletions quantlib/instruments/_make_ois.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ from quantlib.types cimport Natural, Real, Rate, Spread
from quantlib.handle cimport shared_ptr, Handle
from libcpp cimport bool
from quantlib.time.businessdayconvention cimport BusinessDayConvention
from quantlib.time._schedule cimport Rule
from quantlib.time._schedule cimport DateGeneration
from quantlib.time._date cimport Date
from quantlib.time._period cimport Period, Frequency
from quantlib.time._daycounter cimport DayCounter
Expand Down Expand Up @@ -30,7 +30,7 @@ cdef extern from 'ql/instruments/makeois.hpp' namespace 'QuantLib':
MakeOIS& withSettlementDays(Natural settlementDays)
MakeOIS& withEffectiveDate(const Date&)
MakeOIS& withTerminationDate(const Date&)
MakeOIS& withRule(Rule r)
MakeOIS& withRule(DateGeneration r)

MakeOIS& withPaymentFrequency(Frequency f)
MakeOIS& withPaymentAdjustment(BusinessDayConvention convention)
Expand Down
8 changes: 4 additions & 4 deletions quantlib/instruments/_make_vanilla_swap.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ from quantlib.time._date cimport Date
from quantlib.time._period cimport Period
from quantlib.time._calendar cimport Calendar
from quantlib.time.businessdayconvention cimport BusinessDayConvention
from quantlib.time._schedule cimport Rule
from quantlib.time._schedule cimport DateGeneration
from quantlib.time._daycounter cimport DayCounter
from quantlib.indexes._ibor_index cimport IborIndex
from quantlib.instruments._vanillaswap cimport VanillaSwap
Expand All @@ -30,14 +30,14 @@ cdef extern from 'ql/instruments/makevanillaswap.hpp' namespace 'QuantLib':
MakeVanillaSwap& withSettlementDays(Natural settlementDays)
MakeVanillaSwap& withEffectiveDate(const Date&)
MakeVanillaSwap& withTerminationDate(const Date&)
MakeVanillaSwap& withRule(Rule r)
MakeVanillaSwap& withRule(DateGeneration r)

MakeVanillaSwap& withFixedLegTenor(const Period& t)
MakeVanillaSwap& withFixedLegCalendar(const Calendar& cal)
MakeVanillaSwap& withFixedLegConvention(BusinessDayConvention bdc)
MakeVanillaSwap& withFixedLegTerminationDateConvention(
BusinessDayConvention bdc)
MakeVanillaSwap& withFixedLegRule(Rule r)
MakeVanillaSwap& withFixedLegRule(DateGeneration r)
MakeVanillaSwap& withFixedLegEndOfMonth(bool flag) # = true)
MakeVanillaSwap& withFixedLegFirstDate(const Date& d)
MakeVanillaSwap& withFixedLegNextToLastDate(const Date& d)
Expand All @@ -48,7 +48,7 @@ cdef extern from 'ql/instruments/makevanillaswap.hpp' namespace 'QuantLib':
MakeVanillaSwap& withFloatingLegConvention(BusinessDayConvention bdc)
MakeVanillaSwap& withFloatingLegTerminationDateConvention(
BusinessDayConvention bdc)
MakeVanillaSwap& withFloatingLegRule(Rule r)
MakeVanillaSwap& withFloatingLegRule(DateGeneration r)
MakeVanillaSwap& withFloatingLegEndOfMonth(bool flag)# = true)
MakeVanillaSwap& withFloatingLegFirstDate(const Date& d)
MakeVanillaSwap& withFloatingLegNextToLastDate(const Date& d)
Expand Down
6 changes: 3 additions & 3 deletions quantlib/instruments/credit_default_swap.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cimport quantlib.instruments._credit_default_swap as _cds
cimport quantlib._instrument as _instrument
cimport quantlib.pricingengines._pricing_engine as _pe
cimport quantlib.time._calendar as _calendar
cimport quantlib.time._schedule as _schedule
from quantlib.time.dategeneration cimport DateGeneration

from quantlib.termstructures.yield_term_structure cimport YieldTermStructure
from quantlib.pricingengines.engine cimport PricingEngine
Expand Down Expand Up @@ -328,14 +328,14 @@ cdef class CreditDefaultSwap(Instrument):
<_cds.PricingModel>model)


def cds_maturity(Date trade_date, Period tenor, _schedule.Rule rule):
def cds_maturity(Date trade_date, Period tenor, DateGeneration rule):
"""Computes a CDS maturity date.
Parameters
----------
trade_date : Date
tenor : Period
rule : Rule
rule : DateGeneration
Returns
-------
Expand Down
4 changes: 2 additions & 2 deletions quantlib/instruments/make_cds.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ from quantlib.handle cimport static_pointer_cast, shared_ptr
from quantlib.time.date cimport Date, Period
from quantlib.time.daycounter cimport DayCounter
from quantlib.time._date cimport Date as QlDate, Period as QlPeriod
from quantlib.time._schedule cimport Rule
from quantlib.time.dategeneration cimport DateGeneration
from quantlib.pricingengines.engine cimport PricingEngine
from . cimport _credit_default_swap as _cds
from .. cimport _instrument as _in
Expand Down Expand Up @@ -51,7 +51,7 @@ cdef class MakeCreditDefaultSwap:
self._thisptr.withLastPeriodDayCounter(deref(dc._thisptr))
return self

def with_date_generation_rule(self, Rule rule):
def with_date_generation_rule(self, DateGeneration rule):
self._thisptr.withDateGenerationRule(rule)
return self

Expand Down
4 changes: 2 additions & 2 deletions quantlib/instruments/make_ois.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ from quantlib.time._period cimport Days, Frequency
from quantlib.time.businessdayconvention cimport BusinessDayConvention
from quantlib.time.calendar cimport Calendar
from quantlib.time.daycounter cimport DayCounter
from quantlib.time._schedule cimport Rule
from quantlib.time.dategeneration cimport DateGeneration
from quantlib.termstructures.yield_term_structure cimport YieldTermStructure
from quantlib.pricingengines.engine cimport PricingEngine
cimport quantlib.indexes._ibor_index as _ii
Expand Down Expand Up @@ -65,7 +65,7 @@ cdef class MakeOIS:
self._thisptr.withTerminationDate(deref(d._thisptr))
return self

def with_rule(self, Rule r):
def with_rule(self, DateGeneration r):
self._thisptr.withRule(r)
return self

Expand Down
4 changes: 2 additions & 2 deletions quantlib/instruments/make_vanilla_swap.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ from quantlib.time.date cimport Period, Date
from quantlib.time.businessdayconvention cimport BusinessDayConvention
from quantlib.time.daycounter cimport DayCounter
from quantlib.time._period cimport Days
from quantlib.time._schedule cimport Rule
from quantlib.time.dategeneration cimport DateGeneration
from quantlib.termstructures.yield_term_structure cimport YieldTermStructure
from quantlib.pricingengines.engine cimport PricingEngine
cimport quantlib.indexes._ibor_index as _ii
Expand Down Expand Up @@ -62,7 +62,7 @@ cdef class MakeVanillaSwap:
self._thisptr.withTerminationDate(deref(termination_date._thisptr))
return self

def with_rule(self, Rule rule):
def with_rule(self, DateGeneration rule):
self._thisptr.withRule(rule)
return self

Expand Down
8 changes: 4 additions & 4 deletions quantlib/market/market.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from quantlib.time.api import (
Date, Period, Years, Days, JointCalendar, UnitedStates, UnitedKingdom,
pydate_from_qldate, qldate_from_pydate, DayCounter,
BusinessDayConvention, Rule, Following, calendar_from_name,
BusinessDayConvention, DateGeneration, Following, calendar_from_name,
Schedule, Frequency

)
Expand Down Expand Up @@ -121,7 +121,7 @@ def make_eurobond_helper(
index.fixing_calendar,
index.business_day_convention,
index.business_day_convention,
Rule.Backward, # Date generation rule
DateGeneration.Backward, # Date generation rule
index.end_of_month,
)

Expand Down Expand Up @@ -374,13 +374,13 @@ def create_fixed_float_swap(self, settlement_date, length, fixed_rate,
fixed_schedule = Schedule.from_rule(settlement_date, maturity,
fixed_frequency, calendar,
fixed_convention, fixed_convention,
Rule.Forward, False)
DateGeneration.Forward, False)

float_schedule = Schedule.from_rule(settlement_date, maturity,
floating_frequency,
calendar, floating_convention,
floating_convention,
Rule.Forward, False)
DateGeneration.Forward, False)

swap = VanillaSwap(swap_type, nominal, fixed_schedule, fixed_rate,
fixed_daycount, float_schedule, index,
Expand Down
6 changes: 3 additions & 3 deletions quantlib/mlab/fixed_income.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
Date, Days, Period, Years, str_to_frequency)

from quantlib.time.schedule import Schedule
from quantlib.time.dategeneration import Rule
from quantlib.time.dategeneration import DateGeneration
from quantlib.settings import Settings
from quantlib.termstructures.yields.api import (
FlatForward, YieldTermStructure
Expand Down Expand Up @@ -119,7 +119,7 @@ def _bndprice(bond_yield, coupon_rate, pricing_date, maturity_date,
calendar,
ModifiedFollowing,
ModifiedFollowing,
Rule.Backward
DateGeneration.Backward
)

issue_date = effective_date
Expand Down Expand Up @@ -229,7 +229,7 @@ def _cfamounts(coupon_rate, pricing_date, maturity_date,
calendar,
ModifiedFollowing,
ModifiedFollowing,
Rule.Backward
DateGeneration.Backward
)

issue_date = effective_date
Expand Down
12 changes: 6 additions & 6 deletions quantlib/termstructures/credit/_credit_helpers.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ from quantlib.time._date cimport Date
from quantlib.time._daycounter cimport DayCounter
from quantlib.time._period cimport Period, Frequency
from quantlib.termstructures.yields._flat_forward cimport YieldTermStructure
from quantlib.time._schedule cimport Rule
from quantlib.time._schedule cimport DateGeneration

from quantlib.termstructures._default_term_structure cimport DefaultProbabilityTermStructure
from quantlib.termstructures._helpers cimport BootstrapHelper, \
Expand All @@ -38,7 +38,7 @@ cdef extern from 'ql/termstructures/credit/defaultprobabilityhelpers.hpp' namesp
Calendar& calendar,
Frequency frequency,
BusinessDayConvention paymentConvention,
Rule rule,
DateGeneration rule,
DayCounter& dayCounter,
Real recoveryRate,
Handle[YieldTermStructure]& discountCurve,
Expand All @@ -57,7 +57,7 @@ cdef extern from 'ql/termstructures/credit/defaultprobabilityhelpers.hpp' namesp
const Calendar& calendar,
Frequency frequency,
BusinessDayConvention paymentConvention,
Rule rule,
DateGeneration rule,
const DayCounter& dayCounter,
Real recoveryRate,
const Handle[YieldTermStructure]& discountCurve,
Expand All @@ -74,7 +74,7 @@ cdef extern from 'ql/termstructures/credit/defaultprobabilityhelpers.hpp' namesp
const Calendar& calendar,
Frequency frequency,
BusinessDayConvention paymentConvention,
Rule rule,
DateGeneration rule,
const DayCounter& dayCounter,
Real recoveryRate,
const Handle[YieldTermStructure]& discountCurve,
Expand All @@ -93,7 +93,7 @@ cdef extern from 'ql/termstructures/credit/defaultprobabilityhelpers.hpp' namesp
const Calendar& calendar,
Frequency frequency,
BusinessDayConvention paymentConvention,
Rule rule,
DateGeneration rule,
const DayCounter& dayCounter,
Real recoveryRate,
const Handle[YieldTermStructure]& discountCurve,
Expand All @@ -112,7 +112,7 @@ cdef extern from 'ql/termstructures/credit/defaultprobabilityhelpers.hpp' namesp
const Calendar& calendar,
Frequency frequency,
BusinessDayConvention paymentConvention,
Rule rule,
DateGeneration rule,
const DayCounter& dayCounter,
Real recoveryRate,
const Handle[YieldTermStructure]& discountCurve,
Expand Down
12 changes: 6 additions & 6 deletions quantlib/termstructures/credit/default_probability_helpers.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ from quantlib.handle cimport shared_ptr, static_pointer_cast
cimport quantlib.termstructures.credit._credit_helpers as _ci
cimport quantlib.termstructures._yield_term_structure as _yts
from quantlib.time._period cimport Frequency
from quantlib.time._schedule cimport Rule
from quantlib.time.dategeneration cimport DateGeneration
from quantlib.time._calendar cimport BusinessDayConvention


Expand Down Expand Up @@ -112,7 +112,7 @@ cdef class SpreadCdsHelper(CdsHelper):

def __init__(self, running_spread, Period tenor, Integer settlement_days,
Calendar calendar not None, int frequency,
int paymentConvention, Rule date_generation_rule,
int paymentConvention, DateGeneration date_generation_rule,
DayCounter daycounter, Real recovery_rate,
YieldTermStructure discount_curve=YieldTermStructure(),
bool settles_accrual=True,
Expand Down Expand Up @@ -145,7 +145,7 @@ cdef class SpreadCdsHelper(CdsHelper):
(<Quote>running_spread).handle(), deref(tenor._thisptr),
settlement_days, deref(calendar._thisptr),
<Frequency>frequency,
<BusinessDayConvention>paymentConvention, <Rule>date_generation_rule,
<BusinessDayConvention>paymentConvention, date_generation_rule,
deref(daycounter._thisptr),
recovery_rate, discount_curve._thisptr, settles_accrual,
pays_at_default_time,
Expand All @@ -162,7 +162,7 @@ cdef class UpfrontCdsHelper(CdsHelper):

def __init__(self, upfront, Rate running_spread, Period tenor not None,
Integer settlement_days, Calendar calendar not None, int frequency,
int paymentConvention, Rule date_generation_rule,
int paymentConvention, DateGeneration rule,
DayCounter daycounter not None, Real recovery_rate,
YieldTermStructure discount_curve=YieldTermStructure(),
Natural upfront_settlement_days=3,
Expand All @@ -179,7 +179,7 @@ cdef class UpfrontCdsHelper(CdsHelper):
new _ci.UpfrontCdsHelper(
<Rate>upfront, running_spread, deref(tenor._thisptr.get()),
settlement_days, deref(calendar._thisptr), <Frequency>frequency,
<BusinessDayConvention>paymentConvention, <Rule>date_generation_rule,
<BusinessDayConvention>paymentConvention, rule,
deref(daycounter._thisptr),
recovery_rate, discount_curve._thisptr, upfront_settlement_days, settles_accrual,
pays_at_default_time,
Expand All @@ -193,7 +193,7 @@ cdef class UpfrontCdsHelper(CdsHelper):
new _ci.UpfrontCdsHelper(
(<Quote>upfront).handle(), running_spread, deref(tenor._thisptr),
settlement_days, deref(calendar._thisptr), <Frequency>frequency,
<BusinessDayConvention>paymentConvention, date_generation_rule,
<BusinessDayConvention>paymentConvention, rule,
deref(daycounter._thisptr),
recovery_rate, discount_curve._thisptr, upfront_settlement_days, settles_accrual,
pays_at_default_time,
Expand Down
Loading

0 comments on commit 8b9d0ba

Please sign in to comment.