Skip to content

Commit cfcda9a

Browse files
authored
Export fixing-convention parameter for floating-rate coupon constructors (#833)
2 parents c2d851d + 154c7e3 commit cfcda9a

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

SWIG/bonds.i

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,8 @@ class FloatingRateBond : public Bond {
274274
const Period& exCouponPeriod = Period(),
275275
const Calendar& exCouponCalendar = Calendar(),
276276
BusinessDayConvention exCouponConvention = Unadjusted,
277-
bool exCouponEndOfMonth = false);
277+
bool exCouponEndOfMonth = false,
278+
BusinessDayConvention fixingConvention = Preceding);
278279
};
279280

280281

SWIG/cashflows.i

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ class FloatingRateCoupon : public Coupon {
191191
public:
192192
Date fixingDate() const;
193193
Integer fixingDays() const;
194+
BusinessDayConvention fixingConvention() const;
194195
bool isInArrears() const;
195196
Real gearing() const;
196197
Rate spread() const;
@@ -348,7 +349,8 @@ class IborCoupon : public FloatingRateCoupon {
348349
const Date& refPeriodEnd = Date(),
349350
const DayCounter& dayCounter = DayCounter(),
350351
bool isInArrears = false,
351-
const Date& exCouponDate = Date());
352+
const Date& exCouponDate = Date(),
353+
BusinessDayConvention fixingConvention = Preceding);
352354
bool hasFixed() const;
353355
%extend {
354356
static void createAtParCoupons() {
@@ -380,7 +382,8 @@ class CappedFlooredIborCoupon : public CappedFlooredCoupon {
380382
const Date& refPeriodEnd = Date(),
381383
const DayCounter& dayCounter = DayCounter(),
382384
bool isInArrears = false,
383-
const Date& exCouponDate = Date());
385+
const Date& exCouponDate = Date(),
386+
BusinessDayConvention fixingConvention = Preceding);
384387
};
385388

386389
%shared_ptr(MultipleResetsCoupon)
@@ -517,7 +520,8 @@ class CmsCoupon : public FloatingRateCoupon {
517520
const Date& refPeriodEnd = Date(),
518521
const DayCounter& dayCounter = DayCounter(),
519522
bool isInArrears = false,
520-
const Date& exCouponDate = Date());
523+
const Date& exCouponDate = Date(),
524+
BusinessDayConvention fixingConvention = Preceding);
521525
};
522526

523527
%shared_ptr(CmsSpreadCoupon)
@@ -538,7 +542,8 @@ class CmsSpreadCoupon : public FloatingRateCoupon {
538542
const Date& refPeriodEnd = Date(),
539543
const DayCounter& dayCounter = DayCounter(),
540544
bool isInArrears = false,
541-
const Date& exCouponDate = Date());
545+
const Date& exCouponDate = Date(),
546+
BusinessDayConvention fixingConvention = Preceding);
542547
};
543548

544549
%{
@@ -615,7 +620,8 @@ class CappedFlooredCmsCoupon: public CappedFlooredCoupon {
615620
const Date& refPeriodEnd = Date(),
616621
const DayCounter& dayCounter = DayCounter(),
617622
bool isInArrears = false,
618-
const Date& exCouponDate = Date());
623+
const Date& exCouponDate = Date(),
624+
BusinessDayConvention fixingConvention = Preceding);
619625
};
620626

621627
%shared_ptr(CappedFlooredCmsSpreadCoupon)
@@ -636,7 +642,8 @@ class CappedFlooredCmsSpreadCoupon: public CappedFlooredCoupon {
636642
const Date& refPeriodEnd = Date(),
637643
const DayCounter& dayCounter = DayCounter(),
638644
bool isInArrears = false,
639-
const Date& exCouponDate = Date());
645+
const Date& exCouponDate = Date(),
646+
BusinessDayConvention fixingConvention = Preceding);
640647
};
641648

642649
%rename (LinearTsrPricerSettings) LinearTsrPricer::Settings;
@@ -863,14 +870,16 @@ Leg _IborLeg(const std::vector<Real>& nominals,
863870
bool exCouponEndOfMonth = false,
864871
const Calendar& paymentCalendar = Calendar(),
865872
const Integer paymentLag = 0,
866-
ext::optional<bool> withIndexedCoupons = ext::nullopt) {
873+
ext::optional<bool> withIndexedCoupons = ext::nullopt,
874+
BusinessDayConvention fixingConvention = Preceding) {
867875
return QuantLib::IborLeg(schedule, index)
868876
.withNotionals(nominals)
869877
.withPaymentDayCounter(paymentDayCounter)
870878
.withPaymentAdjustment(paymentConvention)
871879
.withPaymentCalendar(paymentCalendar.empty() ? schedule.calendar() : paymentCalendar)
872880
.withPaymentLag(paymentLag)
873881
.withFixingDays(fixingDays)
882+
.withFixingConvention(fixingConvention)
874883
.withGearings(gearings)
875884
.withSpreads(spreads)
876885
.withCaps(caps)
@@ -991,12 +1000,14 @@ Leg _CmsLeg(const std::vector<Real>& nominals,
9911000
const Period& exCouponPeriod = Period(),
9921001
const Calendar& exCouponCalendar = Calendar(),
9931002
const BusinessDayConvention exCouponConvention = Unadjusted,
994-
bool exCouponEndOfMonth = false) {
1003+
bool exCouponEndOfMonth = false,
1004+
BusinessDayConvention fixingConvention = Preceding) {
9951005
return QuantLib::CmsLeg(schedule, index)
9961006
.withNotionals(nominals)
9971007
.withPaymentDayCounter(paymentDayCounter)
9981008
.withPaymentAdjustment(paymentConvention)
9991009
.withFixingDays(fixingDays)
1010+
.withFixingConvention(fixingConvention)
10001011
.withGearings(gearings)
10011012
.withSpreads(spreads)
10021013
.withCaps(caps)
@@ -1024,7 +1035,8 @@ Leg _CmsLeg(const std::vector<Real>& nominals,
10241035
const Period& exCouponPeriod = Period(),
10251036
const Calendar& exCouponCalendar = Calendar(),
10261037
const BusinessDayConvention exCouponConvention = Unadjusted,
1027-
bool exCouponEndOfMonth = false);
1038+
bool exCouponEndOfMonth = false,
1039+
BusinessDayConvention fixingConvention = Preceding);
10281040

10291041
%{
10301042
Leg _CmsZeroLeg(const std::vector<Real>& nominals,

0 commit comments

Comments
 (0)