Skip to content

Commit 1d4bec4

Browse files
committed
Merge branch '72_into_master' into 'master'
72 patch into master See merge request qs/quantlib!61
2 parents f94a36d + 47170d3 commit 1d4bec4

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

ql/termstructure.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,18 @@ namespace QuantLib {
3939
const Date& TermStructure::referenceDate() const {
4040
if (!updated_) {
4141
Date today = Settings::instance().evaluationDate();
42-
referenceDate_ = calendar().advance(today, settlementDays(), Days);
42+
if (adjustReferenceDate_)
43+
referenceDate_ = calendar().advance(today, settlementDays(), Days);
44+
else
45+
referenceDate_ = today;
4346
updated_ = true;
4447
}
4548
return referenceDate_;
4649
}
50+
51+
void TermStructure::setAdjustReferenceDate(const bool b) {
52+
adjustReferenceDate_ = b;
53+
}
4754

4855
void TermStructure::update() {
4956
if (moving_)

ql/termstructure.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ namespace QuantLib {
9090
//! the settlementDays used for reference date calculation
9191
virtual Natural settlementDays() const;
9292
//@}
93+
//! \name Setter
94+
//! adjust the reference date
95+
void setAdjustReferenceDate(const bool b);
96+
//@{
9397
//! \name Observer interface
9498
//@{
9599
void update() override;
@@ -108,6 +112,7 @@ namespace QuantLib {
108112
mutable Date referenceDate_;
109113
Natural settlementDays_;
110114
DayCounter dayCounter_;
115+
bool adjustReferenceDate_ = true;
111116
};
112117

113118
// inline definitions

0 commit comments

Comments
 (0)