Skip to content

Commit

Permalink
Merge 565175e into d06527e
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-giltinan committed Jul 21, 2020
2 parents d06527e + 565175e commit c4a9ff0
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions ql/instruments/makevanillaswap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <ql/currencies/asia.hpp>
#include <ql/currencies/europe.hpp>
#include <ql/currencies/oceania.hpp>
#include <ql/utilities/null.hpp>

namespace QuantLib {

Expand Down Expand Up @@ -72,15 +73,23 @@ namespace QuantLib {
// if the evaluation date is not a business day
// then move to the next business day
refDate = floatCalendar_.adjust(refDate);
Date spotDate = floatCalendar_.advance(refDate,
settlementDays_*Days);
// use index valueDate interface wherever possible to estimate spot date.
// Unless we pass an explicit settlementDays_ which does not match the index-defined number of fixing days.
Date spotDate;
if ((settlementDays_ == Null<Natural>()) || (settlementDays_ == iborIndex_->fixingDays())) {
spotDate = iborIndex_->valueDate(refDate);
}
else {
spotDate = floatCalendar_.advance(refDate, settlementDays_ * Days);
}
startDate = spotDate+forwardStart_;
if (forwardStart_.length()<0)
startDate = floatCalendar_.adjust(startDate,
Preceding);
else
else if (forwardStart_.length()>0)
startDate = floatCalendar_.adjust(startDate,
Following);
// no explicit date adjustment needed for forwardStart_.length()==0 (already handled by spotDate arithmetic above)
}

Date endDate = terminationDate_;
Expand Down

0 comments on commit c4a9ff0

Please sign in to comment.