Skip to content

Commit

Permalink
Add MakeVanillaSwap.withPaymentConvention (#1907)
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio committed Feb 12, 2024
2 parents 4a21713 + b0a40f0 commit 8c87dc2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ql/instruments/makevanillaswap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ namespace QuantLib {
VanillaSwap temp(type_, 100.00, fixedSchedule,
0.0, // fixed rate
fixedDayCount, floatSchedule, iborIndex_, floatSpread_, floatDayCount_,
ext::nullopt, useIndexedCoupons_);
paymentConvention_, useIndexedCoupons_);
if (engine_ == nullptr) {
Handle<YieldTermStructure> disc =
iborIndex_->forwardingTermStructure();
Expand All @@ -172,7 +172,7 @@ namespace QuantLib {

ext::shared_ptr<VanillaSwap> swap(new VanillaSwap(
type_, nominal_, fixedSchedule, usedFixedRate, fixedDayCount, floatSchedule, iborIndex_,
floatSpread_, floatDayCount_, ext::nullopt, useIndexedCoupons_));
floatSpread_, floatDayCount_, paymentConvention_, useIndexedCoupons_));

if (engine_ == nullptr) {
Handle<YieldTermStructure> disc =
Expand Down Expand Up @@ -227,6 +227,11 @@ namespace QuantLib {
return *this;
}

MakeVanillaSwap& MakeVanillaSwap::withPaymentConvention(BusinessDayConvention bdc) {
paymentConvention_ = bdc;
return *this;
}

MakeVanillaSwap& MakeVanillaSwap::withDiscountingTermStructure(
const Handle<YieldTermStructure>& d) {
bool includeSettlementDateFlows = false;
Expand Down
2 changes: 2 additions & 0 deletions ql/instruments/makevanillaswap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ namespace QuantLib {
MakeVanillaSwap& withEffectiveDate(const Date&);
MakeVanillaSwap& withTerminationDate(const Date&);
MakeVanillaSwap& withRule(DateGeneration::Rule r);
MakeVanillaSwap& withPaymentConvention(BusinessDayConvention bdc);

MakeVanillaSwap& withFixedLegTenor(const Period& t);
MakeVanillaSwap& withFixedLegCalendar(const Calendar& cal);
Expand Down Expand Up @@ -108,6 +109,7 @@ namespace QuantLib {
Spread floatSpread_ = 0.0;
DayCounter fixedDayCount_, floatDayCount_;
ext::optional<bool> useIndexedCoupons_;
ext::optional<BusinessDayConvention> paymentConvention_;

ext::shared_ptr<PricingEngine> engine_;
};
Expand Down

0 comments on commit 8c87dc2

Please sign in to comment.