@@ -169,17 +169,29 @@ namespace QuantLib {
169169 return *this ;
170170 }
171171
172+ FixedRateLeg& FixedRateLeg::withPaymentDates (const std::vector<Date>& paymentDates) {
173+ paymentDates_ = paymentDates;
174+ return *this ;
175+ }
176+
177+
172178 FixedRateLeg::operator Leg () const {
173179
174180 QL_REQUIRE (!couponRates_.empty (), " no coupon rates given" );
175181 QL_REQUIRE (!notionals_.empty (), " no notional given" );
182+ QL_REQUIRE (paymentDates_.empty () || paymentDates_.size () == schedule_.size () - 1 ,
183+ " Expected the number of explicit payment dates ("
184+ << paymentDates_.size () << " ) to equal the number of calculation periods ("
185+ << schedule_.size () - 1 << " )" );
176186
177187 Leg leg;
178188 leg.reserve (schedule_.size ()-1 );
179189
180190 // first period might be short or long
181191 Date start = schedule_.date (0 ), end = schedule_.date (1 );
182- Date paymentDate = paymentCalendar_.advance (end, paymentLag_, Days, paymentAdjustment_);
192+ Date paymentDate = paymentDates_.empty () ? paymentCalendar_.advance (end, paymentLag_, Days,
193+ paymentAdjustment_) :
194+ paymentDates_[0 ];
183195 Date exCouponDate;
184196 InterestRate rate = couponRates_[0 ];
185197 Real nominal = notionals_[0 ];
@@ -208,7 +220,10 @@ namespace QuantLib {
208220 // regular periods
209221 for (Size i=2 ; i<schedule_.size ()-1 ; ++i) {
210222 start = end; end = schedule_.date (i);
211- Date paymentDate = paymentCalendar_.advance (end, paymentLag_, Days, paymentAdjustment_);
223+ Date paymentDate =
224+ paymentDates_.empty () ?
225+ paymentCalendar_.advance (end, paymentLag_, Days, paymentAdjustment_) :
226+ paymentDates_[i - 1 ];
212227 if (exCouponPeriod_ != Period ())
213228 {
214229 exCouponDate = exCouponCalendar_.advance (paymentDate,
@@ -232,7 +247,10 @@ namespace QuantLib {
232247 // last period might be short or long
233248 Size N = schedule_.size ();
234249 start = end; end = schedule_.date (N-1 );
235- Date paymentDate = paymentCalendar_.advance (end, paymentLag_, Days, paymentAdjustment_);
250+ Date paymentDate =
251+ paymentDates_.empty () ?
252+ paymentCalendar_.advance (end, paymentLag_, Days, paymentAdjustment_) :
253+ paymentDates_[N - 2 ];
236254 if (exCouponPeriod_ != Period ())
237255 {
238256 exCouponDate = exCouponCalendar_.advance (paymentDate,
0 commit comments