Skip to content

Commit 26fcccc

Browse files
QPR-11180 fix rebates accrual edge case
1 parent 6199917 commit 26fcccc

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

ql/instruments/creditdefaultswap.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include <ql/quotes/simplequote.hpp>
3232
#include <ql/math/solvers1d/brent.hpp>
3333
#include <ql/time/calendars/weekendsonly.hpp>
34-
#include <iostream>
3534

3635
namespace QuantLib {
3736

@@ -242,12 +241,13 @@ namespace QuantLib {
242241
// Deal with the accrual rebate. We use the standard conventions for accrual calculation introduced with the
243242
// CDS Big Bang in 2009
244243
if (rebatesAccrual && postBigBang) {
245-
accrualRebate_ = boost::make_shared<SimpleCashFlow>(CashFlows::accruedAmount(leg_, false, tradeDate_ + 1),
246-
effectiveUpfrontDate);
244+
accrualRebate_ = boost::make_shared<SimpleCashFlow>(
245+
CashFlows::accruedAmount(leg_, leg_.back()->date() == tradeDate_ + 1, tradeDate_ + 1),
246+
effectiveUpfrontDate);
247247
Date current = std::max((Date)Settings::instance().evaluationDate(), tradeDate_);
248248
accrualRebateCurrent_ = boost::make_shared<SimpleCashFlow>(
249249
CashFlows::accruedAmount(leg_, false, current + 1),
250-
schedule.calendar().advance(current, cashSettlementDays_, Days, paymentConvention));
250+
schedule.calendar().advance(current, cashSettlementDays_, Days, paymentConvention));
251251
}
252252

253253
if (!claim_)

0 commit comments

Comments
 (0)