Skip to content

Commit 70d9371

Browse files
committed
QPR-11512 resolve merge conflict after merging 1.29
1 parent e706ef7 commit 70d9371

7 files changed

Lines changed: 33 additions & 18 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ if (QL_TAGGED_LAYOUT)
216216
endif()
217217
set(DEBUG_POSTFIX ${DEBUG_POSTFIX}-mt)
218218
set(RELEASE_POSTFIX ${RELEASE_POSTFIX}-mt)
219-
if (CMAKE_MSVC_RUNTIME_LIBRARY MATCHES ".*DLL$")
219+
if (MSVC_LINK_DYNAMIC_RUNTIME)
220220
set(DEBUG_POSTFIX ${DEBUG_POSTFIX}-gd)
221221
else()
222222
set(DEBUG_POSTFIX ${DEBUG_POSTFIX}-sgd)

ql/cashflows/cpicoupon.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,23 @@ namespace QuantLib {
214214
return baseFixing_;
215215
}
216216

217+
Real CPICashFlow::amount() const {
218+
Real I0 = baseFixing();
219+
Real I1;
220+
221+
// Added to handle cases with null baseCPI, look up from index
222+
if (I0 == Null<Real>()) {
223+
I0 = CPI::laggedFixing(cpiIndex(), baseDate() + observationLag(), observationLag(), interpolation());
224+
}
225+
226+
I1 = indexFixing();
227+
228+
if (growthOnly())
229+
return notional() * (I1 / I0 - 1.0);
230+
else
231+
return notional() * (I1 / I0);
232+
}
233+
217234
Real CPICashFlow::indexFixing() const {
218235
if (observationDate_ != Date()) {
219236
return CPI::laggedFixing(cpiIndex(), observationDate_, observationLag_, interpolation_);

ql/cashflows/cpicoupon.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ namespace QuantLib {
214214

215215
ext::shared_ptr<ZeroInflationIndex> cpiIndex() const;
216216

217+
//! redefined to use baseFixing() and interpolation
218+
Real amount() const override;
217219
Real indexFixing() const override;
218220

219221
protected:

ql/cashflows/cpicouponpricer.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,6 @@ namespace QuantLib {
122122

123123
if (fixing == Null<Rate>())
124124
fixing = I1 / I0;
125-
//std::cout << " adjustedFixing " << fixing << std::endl;
126-
// no adjustment
127-
// QL 1.27:
128-
//if (fixing == Null<Rate>())
129-
// fixing = coupon_->indexFixing() / coupon_->baseCPI();
130-
// no further adjustment
131125
return fixing;
132126
}
133127

ql/indexes/inflation/aucpi.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace QuantLib {
3737
bool revised,
3838
const Handle<ZeroInflationTermStructure>& ts = {})
3939
: ZeroInflationIndex(
40-
"CPI", AustraliaRegion(), revised, frequency, Period(2, Months), AUDCurrency(), ts) {}
40+
"CPI", AustraliaRegion(), revised, frequency, Period(1, Months), AUDCurrency(), ts) {}
4141
// QL1.29 MergeConflict ours
4242
// Period(1, Months)
4343
/*! \deprecated Use the constructor without the "interpolated" parameter.

ql/indexes/inflationindex.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,15 @@ namespace QuantLib {
143143
Date historicalFixingKnown = lastAvailableFixingPeriod.first - 1;
144144
Date historicalFixingUnkown = std::min(today, lastAvailableFixingPeriod.second);
145145
Date latestNeededDate = fixingDate;
146-
146+
147+
QL_DEPRECATED_DISABLE_WARNING
147148
if (interpolated_) { // might need the next one too
148149
std::pair<Date, Date> p = inflationPeriod(fixingDate, frequency_);
149150
if (fixingDate > p.first)
150151
latestNeededDate += Period(frequency_);
151152
}
152-
153+
QL_DEPRECATED_ENABLE_WARNING
154+
153155
if (latestNeededDate <= historicalFixingKnown) {
154156
// the fixing date is well before the availability lag, so
155157
// we know that fixings were provided.

test-suite/CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,10 @@ if (QL_BUILD_TEST_SUITE)
381381
target_link_libraries(ql_test_suite PRIVATE
382382
ql_library
383383
ql_unit_test_main
384-
// QL1.29 MergeConflict ours
385-
//Boost::unit_test_framework
386-
//${QL_TEST_SUITE_LIBRARIES})
387-
// QL1.29 MergeConflict theirs
384+
#QL1.29 MergeConflict ours
385+
#Boost::unit_test_framework
386+
#${QL_TEST_SUITE_LIBRARIES})
387+
# QL1.29 MergeConflict theirs
388388
${QL_THREAD_LIBRARIES})
389389
if(MSVC AND CMAKE_UNITY_BUILD)
390390
# for Unity builds, we need to add /bigobj
@@ -408,16 +408,16 @@ IF (QL_BUILD_BENCHMARK)
408408
endif()
409409
target_link_libraries(ql_benchmark PRIVATE
410410
ql_library
411-
// QL1.29 MergeConflict theirs
411+
#QL1.29 MergeConflict theirs
412412
ql_unit_test_main
413413
${QL_THREAD_LIBRARIES})
414414
if(MSVC AND CMAKE_UNITY_BUILD)
415415
# for Unity builds, we need to add /bigobj
416416
target_compile_options(ql_benchmark PRIVATE "/bigobj")
417417
endif()
418-
// QL1.29 MergeConflict ours
419-
//Boost::unit_test_framework
420-
//${QL_BENCHMARK_LIBRARIES})
418+
#QL1.29 MergeConflict ours
419+
#Boost::unit_test_framework
420+
#{QL_BENCHMARK_LIBRARIES})
421421
if (QL_INSTALL_BENCHMARK)
422422
install(TARGETS ql_benchmark RUNTIME DESTINATION ${QL_INSTALL_BINDIR})
423423
endif()

0 commit comments

Comments
 (0)