关于 C++ Quantlib 中的 date-advance 函数,我有一个小问题。我想为具有付款工作日约定“之前”的产品使用付款抵消(以天为单位),但付款日期始终设置为周末后的第一天,而付款日期在周末。这是因为,当“天”被移交给“提前”功能时,“提前”功能会忽略工作日约定,请参见此处:
Date Calendar::advance(const Date& d,
Integer n, TimeUnit unit,
BusinessDayConvention c,
bool endOfMonth) const {
QL_REQUIRE(d!=Date(), "null date");
if (n == 0) {
return adjust(d,c);
} else if (unit == Days) {
Date d1 = d;
if (n > 0) {
while (n > 0) {
d1++;
while (isHoliday(d1))
d1++;
n--;
}
} else {
while (n < 0) {
d1--;
while(isHoliday(d1))
d1--;
n++;
}
}
return d1;
} else if (unit == Weeks) {
Date d1 = d + n*unit;
return adjust(d1,c);
} else {
Date d1 = d + n*unit;
// we are sure the unit is Months or Years
if (endOfMonth && isEndOfMonth(d))
return Calendar::endOfMonth(d1);
return adjust(d1, c);
}
}
这是故意实施的吗?ps“调整”功能正确使用工作日约定!