Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
fixingdates.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2019 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
24
25#include <ql/cashflow.hpp>
26#include <ql/cashflows/averagebmacoupon.hpp>
27#include <ql/cashflows/capflooredcoupon.hpp>
28#include <ql/cashflows/cpicoupon.hpp>
29#include <ql/cashflows/digitalcoupon.hpp>
30#include <ql/cashflows/floatingratecoupon.hpp>
31#include <ql/cashflows/inflationcoupon.hpp>
32#include <ql/cashflows/overnightindexedcoupon.hpp>
33#include <ql/cashflows/simplecashflow.hpp>
34#include <ql/cashflows/yoyinflationcoupon.hpp>
35#include <ql/experimental/coupons/cmsspreadcoupon.hpp>
36#include <ql/experimental/coupons/strippedcapflooredcoupon.hpp>
37#include <ql/time/calendars/weekendsonly.hpp>
59
60using namespace QuantLib;
61using namespace QuantExt;
62
63using std::map;
64using std::pair;
65using std::set;
66using std::string;
67using std::tuple;
68using std::vector;
69
70namespace {
71
72// Generate lookback dates
73set<Date> generateLookbackDates(const Date& asof, const Period& lookbackPeriod, const Calendar& calendar) {
74
75 set<Date> dates;
76 Date lookback = calendar.advance(asof, -lookbackPeriod);
77 do {
78 TLOG("Adding date " << io::iso_date(lookback) << " to fixings.");
79 dates.insert(lookback);
80 lookback = calendar.advance(lookback, 1 * Days);
81 } while (lookback <= asof);
82
83 return dates;
84}
85
86} // namespace
87
88namespace ore {
89namespace data {
90
91namespace {
92
93// Return the set of dates on which a fixing will be required, if any.
94RequiredFixings::FixingDates needsForecast(const Date& fixingDate, const Date& today, const bool interpolated,
95 const Frequency frequency, const Period& availabilityLag,
96 const bool mandatory) {
97
98 RequiredFixings::FixingDates result;
99
100 Date todayMinusLag = today - availabilityLag;
101 Date historicalFixingKnown = inflationPeriod(todayMinusLag, frequency).first - 1;
102
103 pair<Date, Date> lim = inflationPeriod(fixingDate, frequency);
104 result.addDate(lim.first, mandatory);
105 Date latestNeededDate = fixingDate;
106 if (interpolated) {
107 if (fixingDate > lim.first) {
108 latestNeededDate += Period(frequency);
109 result.addDate(lim.second + 1, mandatory);
110 }
111 }
112
113 if (latestNeededDate <= historicalFixingKnown) {
114 // Know that fixings are available
115 return result;
116 } else if (latestNeededDate > today) {
117 // Know that fixings are not available
118 return RequiredFixings::FixingDates();
119 } else {
120 // Grey area here but for now return nothing
121 return RequiredFixings::FixingDates();
122 }
123}
124
125// Common code for zero inflation index based coupons
126void addZeroInflationDates(RequiredFixings::FixingDates& dates, const Date& fixingDate, const Date& today,
127 const bool indexInterpolated, const Frequency indexFrequency,
128 const Period& indexAvailabilityLag, const CPI::InterpolationType interpolation,
129 const Frequency f, const bool mandatory) {
130
131 RequiredFixings::FixingDates fixingDates;
132
133 if (interpolation == CPI::AsIndex) {
134 fixingDates =
135 needsForecast(fixingDate, today, indexInterpolated, indexFrequency, indexAvailabilityLag, mandatory);
136 } else {
137 pair<Date, Date> lim = inflationPeriod(fixingDate, f);
138 fixingDates =
139 needsForecast(lim.first, today, indexInterpolated, indexFrequency, indexAvailabilityLag, mandatory);
140 if (interpolation == CPI::Linear) {
141 auto moreDates = needsForecast(lim.second + 1, today, indexInterpolated, indexFrequency,
142 indexAvailabilityLag, mandatory);
143 fixingDates.addDates(moreDates);
144 }
145 }
146 dates.addDates(fixingDates);
147}
148} // namespace
149
151 return std::tie(lhs.indexName, lhs.fixingDate, lhs.payDate, lhs.alwaysAddIfPaysOnSettlement, lhs.mandatory) <
152 std::tie(rhs.indexName, rhs.fixingDate, rhs.payDate, rhs.alwaysAddIfPaysOnSettlement, rhs.mandatory);
153}
154
156 return std::tie(lhs.indexName, lhs.fixingDate, lhs.payDate, lhs.alwaysAddIfPaysOnSettlement, lhs.mandatory,
158 std::tie(rhs.indexName, rhs.fixingDate, rhs.payDate, rhs.alwaysAddIfPaysOnSettlement, rhs.mandatory,
160}
161
164 return std::tie(lhs.indexName, lhs.fixingDate, lhs.payDate, lhs.alwaysAddIfPaysOnSettlement, lhs.mandatory,
166 lhs.couponInterpolation) < std::tie(rhs.indexName, rhs.fixingDate, rhs.payDate,
170}
171
173 fixingDates_.clear();
176}
177
178void RequiredFixings::addData(const RequiredFixings& requiredFixings) {
179 fixingDates_.insert(requiredFixings.fixingDates_.begin(), requiredFixings.fixingDates_.end());
180 zeroInflationFixingDates_.insert(requiredFixings.zeroInflationFixingDates_.begin(),
181 requiredFixings.zeroInflationFixingDates_.end());
182 yoyInflationFixingDates_.insert(requiredFixings.yoyInflationFixingDates_.begin(),
183 requiredFixings.yoyInflationFixingDates_.end());
184}
185
187 // we can't modify the elements of a set directly, need to make a copy and reassign
188 std::set<FixingEntry> newFixingDates;
189 std::set<ZeroInflationFixingEntry> newZeroInflationFixingDates;
190 std::set<InflationFixingEntry> newYoYInflationFixingDates;
191 for (auto f : fixingDates_) {
192 f.payDate = Date::maxDate();
193 f.alwaysAddIfPaysOnSettlement = true;
194 newFixingDates.insert(f);
195 }
196 for (auto f : zeroInflationFixingDates_) {
197 f.payDate = Date::maxDate();
198 f.alwaysAddIfPaysOnSettlement = true;
199 newZeroInflationFixingDates.insert(f);
200 }
201 for (auto f : yoyInflationFixingDates_) {
202 f.payDate = Date::maxDate();
203 f.alwaysAddIfPaysOnSettlement = true;
204 newYoYInflationFixingDates.insert(f);
205 }
206 fixingDates_ = newFixingDates;
207 zeroInflationFixingDates_ = newZeroInflationFixingDates;
208 yoyInflationFixingDates_ = newYoYInflationFixingDates;
209}
210
212 RequiredFixings result(*this);
213 // we can't modify the elements of a set directly, need to make a copy and reassign
214 std::set<FixingEntry> newFixingDates;
215 std::set<ZeroInflationFixingEntry> newZeroInflationFixingDates;
216 std::set<InflationFixingEntry> newYoYInflationFixingDates;
217 for (auto f : result.fixingDates_) {
218 f.mandatory = mandatory;
219 newFixingDates.insert(f);
220 }
221 for (auto f : result.zeroInflationFixingDates_) {
222 f.mandatory = mandatory;
223 newZeroInflationFixingDates.insert(f);
224 }
225 for (auto f : yoyInflationFixingDates_) {
226 f.mandatory = mandatory;
227 newYoYInflationFixingDates.insert(f);
228 }
229 result.fixingDates_ = newFixingDates;
230 result.zeroInflationFixingDates_ = newZeroInflationFixingDates;
231 result.yoyInflationFixingDates_ = newYoYInflationFixingDates;
232 return result;
233}
234
237 // If settlement date is an empty date, update to evaluation date.
238 Date d = settlementDate == Date() ? Settings::instance().evaluationDate() : settlementDate;
239 // handle the general case
240 for (auto f : fixingDates_) {
241 // get the data
242 std::string indexName = f.indexName;
243 Date fixingDate = f.fixingDate;
244 Date payDate = f.payDate;
245 bool alwaysAddIfPaysOnSettlement = f.alwaysAddIfPaysOnSettlement;
246 // add to result
247 if (fixingDate > d)
248 continue;
249 SimpleCashFlow dummyCf(0.0, payDate);
250 if (!dummyCf.hasOccurred(d) || (alwaysAddIfPaysOnSettlement && dummyCf.date() == d)) {
251 f.payDate = Date::maxDate();
252 f.alwaysAddIfPaysOnSettlement = true;
253 rf.addFixingDate(f);
254 }
255 }
256
257 // handle zero inflation index based coupons
258 for (auto f : zeroInflationFixingDates_) {
259 // get the data
260 std::string indexName = f.indexName;
261 Date payDate = f.payDate;
262 bool alwaysAddIfPaysOnSettlement = f.alwaysAddIfPaysOnSettlement;
263 // add to result
264 SimpleCashFlow dummyCf(0.0, payDate);
265 if (!dummyCf.hasOccurred(d) || (alwaysAddIfPaysOnSettlement && dummyCf.date() == d)) {
266 f.payDate = Date::maxDate();
267 f.alwaysAddIfPaysOnSettlement = true;
269 }
270 }
271
272 // handle yoy inflation index based coupons
273 for (auto f : yoyInflationFixingDates_) {
274 // get the data
275 std::string indexName = f.indexName;
276 Date payDate = f.payDate;
277 bool alwaysAddIfPaysOnSettlement = f.alwaysAddIfPaysOnSettlement;
278 // add to result
279 SimpleCashFlow dummyCf(0.0, payDate);
280 if (!dummyCf.hasOccurred(d) || (alwaysAddIfPaysOnSettlement && dummyCf.date() == d)) {
281 f.payDate = Date::maxDate();
282 f.alwaysAddIfPaysOnSettlement = true;
284 }
285 }
286 return rf;
287}
288
289std::map<std::string, RequiredFixings::FixingDates>
290RequiredFixings::fixingDatesIndices(const Date& settlementDate) const {
291
292 // If settlement date is an empty date, update to evaluation date.
293 Date d = settlementDate == Date() ? Settings::instance().evaluationDate() : settlementDate;
294
295 std::map<std::string, FixingDates> result;
296
297 // handle the general case
298 for (auto const& f : fixingDates_) {
299 // get the data
300 std::string indexName = f.indexName;
301 Date fixingDate = f.fixingDate;
302 Date payDate = f.payDate;
303 bool alwaysAddIfPaysOnSettlement = f.alwaysAddIfPaysOnSettlement;
304 // add to result
305 if (fixingDate > d)
306 continue;
307 SimpleCashFlow dummyCf(0.0, payDate);
308 if (!dummyCf.hasOccurred(d) || (alwaysAddIfPaysOnSettlement && dummyCf.date() == d)) {
309 result[indexName].addDate(fixingDate, f.mandatory);
310 }
311 }
312
313 // handle zero inflation index based coupons
314 for (auto const& f : zeroInflationFixingDates_) {
315 // get the data
316 std::string indexName = f.indexName;
317 Date fixingDate = f.fixingDate;
318 Date payDate = f.payDate;
319 bool alwaysAddIfPaysOnSettlement = f.alwaysAddIfPaysOnSettlement;
320 bool indexInterpolated = f.indexInterpolated;
321 Frequency indexFrequency = f.indexFreq;
322 Period indexAvailabilityLag = f.availabilityLeg;
323 CPI::InterpolationType couponInterpolation = f.couponInterpolation;
324 Frequency couponFrequency = f.couponFrequency;
325 // add to result
326 SimpleCashFlow dummyCf(0.0, payDate);
327 if (!dummyCf.hasOccurred(d) || (alwaysAddIfPaysOnSettlement && dummyCf.date() == d)) {
329 addZeroInflationDates(tmp, fixingDate, d, indexInterpolated, indexFrequency, indexAvailabilityLag,
330 couponInterpolation, couponFrequency, f.mandatory);
331 if (!tmp.empty())
332 result[indexName].addDates(tmp);
333 }
334 }
335
336 // handle yoy inflation index based coupons
337 for (auto const& f : yoyInflationFixingDates_) {
338 // get the data
339 std::string indexName = f.indexName;
340 Date fixingDate = f.fixingDate;
341 Date payDate = f.payDate;
342 bool alwaysAddIfPaysOnSettlement = f.alwaysAddIfPaysOnSettlement;
343 bool indexInterpolated = f.indexInterpolated;
344 Frequency indexFrequency = f.indexFreq;
345 Period indexAvailabilityLag = f.availabilityLeg;
346 // add to result
347 SimpleCashFlow dummyCf(0.0, payDate);
348 if (!dummyCf.hasOccurred(d) || (alwaysAddIfPaysOnSettlement && dummyCf.date() == d)) {
349 auto fixingDates =
350 needsForecast(fixingDate, d, indexInterpolated, indexFrequency, indexAvailabilityLag, f.mandatory);
351 if (!fixingDates.empty())
352 result[indexName].addDates(fixingDates);
353 // Add the previous year's date(s) also if any.
354 for (const auto& [d, mandatory] : fixingDates) {
355 Date previousYear = d - 1 * Years;
356 result[indexName].addDate(previousYear, mandatory);
357 }
358 }
359 }
360
361 return result;
362}
363
364void RequiredFixings::addFixingDate(const QuantLib::Date& fixingDate, const std::string& indexName,
365 const QuantLib::Date& payDate, const bool alwaysAddIfPaysOnSettlement,
366 const bool mandatory) {
367 fixingDates_.insert(
368 {indexName, fixingDate, payDate, payDate == Date::maxDate() || alwaysAddIfPaysOnSettlement, mandatory});
369}
370
371void RequiredFixings::addFixingDate(const FixingEntry& fixingEntry) { fixingDates_.insert(fixingEntry); }
372
373void RequiredFixings::addFixingDates(const std::vector<std::pair<QuantLib::Date, bool>>& fixingDates,
374 const std::string& indexName, const QuantLib::Date& payDate,
375 const bool alwaysAddIfPaysOnSettlement) {
376 for (auto const& [date, mandatory] : fixingDates) {
377 fixingDates_.insert({indexName, date, payDate, alwaysAddIfPaysOnSettlement, mandatory});
378 }
379}
380
381void RequiredFixings::addFixingDates(const std::vector<QuantLib::Date>& fixingDates, const std::string& indexName,
382 const QuantLib::Date& payDate, const bool alwaysAddIfPaysOnSettlement,
383 const bool mandatory) {
384 for (auto const& date : fixingDates) {
385 fixingDates_.insert({indexName, date, payDate, alwaysAddIfPaysOnSettlement, mandatory});
386 }
387}
388
389void RequiredFixings::addZeroInflationFixingDate(const QuantLib::Date& fixingDate, const std::string& indexName,
390 const bool indexInterpolated, const Frequency indexFrequency,
391 const Period& indexAvailabilityLag,
392 const CPI::InterpolationType couponInterpolation,
393 const Frequency couponFrequency, const QuantLib::Date& payDate,
394 const bool alwaysAddIfPaysOnSettlement, const bool mandatory) {
396 entry.indexName = indexName;
397 entry.fixingDate = fixingDate;
398 entry.payDate = payDate;
399 entry.alwaysAddIfPaysOnSettlement = alwaysAddIfPaysOnSettlement;
400 entry.mandatory = mandatory;
401 entry.indexInterpolated = indexInterpolated;
402 entry.indexFreq = indexFrequency;
403 entry.availabilityLeg = indexAvailabilityLag;
404 entry.couponFrequency = couponFrequency;
405 entry.couponInterpolation = couponInterpolation;
407}
408
410 zeroInflationFixingDates_.insert(fixingEntry);
411}
412
413void RequiredFixings::addYoYInflationFixingDate(const QuantLib::Date& fixingDate, const std::string& indexName,
414 const bool indexInterpolated, const Frequency indexFrequency,
415 const Period& indexAvailabilityLag, const QuantLib::Date& payDate,
416 const bool alwaysAddIfPaysOnSettlement, const bool mandatory) {
418 entry.indexName = indexName;
419 entry.fixingDate = fixingDate;
420 entry.payDate = payDate;
421 entry.alwaysAddIfPaysOnSettlement = alwaysAddIfPaysOnSettlement;
422 entry.mandatory = mandatory;
423 entry.indexInterpolated = indexInterpolated;
424 entry.indexFreq = indexFrequency;
425 entry.availabilityLeg = indexAvailabilityLag;
427}
428
430 yoyInflationFixingDates_.insert(fixingEntry);
431}
432
433std::ostream& operator<<(std::ostream& out, const ore::data::RequiredFixings::FixingEntry& f) {
434
435 std::string indexName = f.indexName;
436 Date fixingDate = f.fixingDate;
437 Date payDate = f.payDate;
438 bool alwaysAddIfPaysOnSettlement = f.alwaysAddIfPaysOnSettlement;
439 bool mandatory = f.mandatory;
440 out << indexName << " " << QuantLib::io::iso_date(fixingDate) << " " << QuantLib::io::iso_date(payDate) << " "
441 << std::boolalpha << alwaysAddIfPaysOnSettlement << " " << std::boolalpha << mandatory << "\n";
442 return out;
443}
444
445std::ostream& operator<<(std::ostream& out, const std::set<ore::data::RequiredFixings::FixingEntry>& entries) {
446 for (auto const& f : entries) {
447 out << f;
448 }
449 return out;
450}
451
452std::ostream& operator<<(std::ostream& out, const std::set<ore::data::RequiredFixings::InflationFixingEntry>& entries) {
453 for (auto const& f : entries) {
454 out << f;
455 }
456 return out;
457}
458
459std::ostream& operator<<(std::ostream& out,
460 const std::set<ore::data::RequiredFixings::ZeroInflationFixingEntry>& entries) {
461 for (auto const& f : entries) {
462 out << f;
463 }
464 return out;
465}
466
467std::ostream& operator<<(std::ostream& out, const RequiredFixings& requiredFixings) {
468 out << "IndexName FixingDate PayDate AlwaysAddIfPaysOnSettlement\n";
469 out << requiredFixings.fixingDates_;
470 out << requiredFixings.zeroInflationFixingDates_;
471 out << requiredFixings.yoyInflationFixingDates_;
472 return out;
473}
474
475void FixingDateGetter::visit(CashFlow& c) {
476 // Do nothing if we fall through to here
477}
478
480 // Enforce fixing to be added even if coupon pays on settlement.
481 requiredFixings_.addFixingDate(c.fixingDate(), IndexNameTranslator::instance().oreName(c.index()->name()), c.date(),
482 true);
483}
484
485void FixingDateGetter::visit(IborCoupon& c) {
486 if (auto bma = QuantLib::ext::dynamic_pointer_cast<QuantExt::BMAIndexWrapper>(c.index())) {
487 // Handle bma indices which we allow in IborCoupon as an approximation to BMA
488 // coupons. For these we allow fixing dates that are invalid as BMA fixing dates
489 // and adjust these dates to the last valid BMA fixing date in the BMAIndexWrapper.
490 // It is this adjusted date that we want to record here.
491 // Enforce fixing to be added even if coupon pays on settlement.
492 requiredFixings_.addFixingDate(bma->adjustedFixingDate(c.fixingDate()),
493 IndexNameTranslator::instance().oreName(c.index()->name()), c.date(), true);
494 } else {
495 auto fallback = QuantLib::ext::dynamic_pointer_cast<FallbackIborIndex>(c.index());
496 if (fallback != nullptr && c.fixingDate() >= fallback->switchDate()) {
497 requiredFixings_.addFixingDates(fallback->onCoupon(c.fixingDate())->fixingDates(),
498 IndexNameTranslator::instance().oreName(fallback->rfrIndex()->name()),
499 c.date());
500 } else {
501 visit(static_cast<FloatingRateCoupon&>(c));
502 }
503 }
504}
505
506void FixingDateGetter::visit(CappedFlooredCoupon& c) {
507 // handle the underlying
508 c.underlying()->accept(*this);
509}
510
511void FixingDateGetter::visit(IndexedCashFlow& c) {
512 if (CPICashFlow* cc = dynamic_cast<CPICashFlow*>(&c)) {
513 visit(*cc);
514 }
515}
516
517void FixingDateGetter::visit(CPICashFlow& c) {
518 // CPICashFlow must have a ZeroInflationIndex
519 auto zeroInflationIndex = QuantLib::ext::dynamic_pointer_cast<ZeroInflationIndex>(c.index());
520 QL_REQUIRE(zeroInflationIndex, "Expected CPICashFlow to have an index of type ZeroInflationIndex");
521
522 QL_DEPRECATED_DISABLE_WARNING
523 bool isInterpolated = c.interpolation() == QuantLib::CPI::Linear ||
524 (c.interpolation() == QuantLib::CPI::AsIndex && zeroInflationIndex->interpolated());
525 QL_DEPRECATED_ENABLE_WARNING
526
528 c.baseDate(), IndexNameTranslator::instance().oreName(c.index()->name()), isInterpolated,
529 zeroInflationIndex->frequency(), zeroInflationIndex->availabilityLag(), c.interpolation(), c.frequency(),
530 c.date());
531
533 c.fixingDate(), IndexNameTranslator::instance().oreName(c.index()->name()), isInterpolated,
534 zeroInflationIndex->frequency(), zeroInflationIndex->availabilityLag(), c.interpolation(), c.frequency(),
535 c.date());
536}
537
539
540 QL_DEPRECATED_DISABLE_WARNING
541 bool isInterpolated = c.observationInterpolation() == QuantLib::CPI::Linear ||
542 (c.observationInterpolation() == QuantLib::CPI::AsIndex && c.cpiIndex()->interpolated());
543 QL_DEPRECATED_ENABLE_WARNING
544
546 c.baseDate(), IndexNameTranslator::instance().oreName(c.cpiIndex()->name()), isInterpolated,
547 c.cpiIndex()->frequency(), c.cpiIndex()->availabilityLag(), c.observationInterpolation(),
548 c.cpiIndex()->frequency(), c.date());
549
551 c.fixingDate(), IndexNameTranslator::instance().oreName(c.cpiIndex()->name()), isInterpolated,
552 c.cpiIndex()->frequency(), c.cpiIndex()->availabilityLag(), c.observationInterpolation(),
553 c.cpiIndex()->frequency(), c.date());
554}
555
558 c.fixingDate(), IndexNameTranslator::instance().oreName(c.yoyIndex()->name()), c.yoyIndex()->interpolated(),
559 c.yoyIndex()->frequency(), c.yoyIndex()->availabilityLag(), c.date());
560}
561
562void FixingDateGetter::visit(QuantLib::OvernightIndexedCoupon& c) {
563 requiredFixings_.addFixingDates(c.fixingDates(), IndexNameTranslator::instance().oreName(c.index()->name()),
564 c.date());
565}
566
568 auto fallback = QuantLib::ext::dynamic_pointer_cast<FallbackOvernightIndex>(c.index());
569 string indexName;
570 if (fallback && c.fixingDate() >= fallback->switchDate())
571 indexName = fallback->rfrIndex()->name();
572 else
573 indexName = c.index()->name();
574 requiredFixings_.addFixingDates(c.fixingDates(), IndexNameTranslator::instance().oreName(indexName), c.date());
575}
576
578
579void FixingDateGetter::visit(AverageBMACoupon& c) {
580 requiredFixings_.addFixingDates(c.fixingDates(), IndexNameTranslator::instance().oreName(c.index()->name()),
581 c.date());
582}
583
585
586void FixingDateGetter::visit(CmsSpreadCoupon& c) {
587 // Enforce fixing to be added even if coupon pays on settlement.
588 requiredFixings_.addFixingDate(c.fixingDate(),
589 IndexNameTranslator::instance().oreName(c.swapSpreadIndex()->swapIndex1()->name()),
590 c.date(), true);
591 requiredFixings_.addFixingDate(c.fixingDate(),
592 IndexNameTranslator::instance().oreName(c.swapSpreadIndex()->swapIndex2()->name()),
593 c.date(), true);
594}
595
596void FixingDateGetter::visit(DigitalCoupon& c) { c.underlying()->accept(*this); }
597
598void FixingDateGetter::visit(StrippedCappedFlooredCoupon& c) { c.underlying()->accept(*this); }
599
601 requiredFixings_.addFixingDates(c.fixingDates(), IndexNameTranslator::instance().oreName(c.index()->name()),
602 c.date());
603}
604
606
608 requiredFixings_.addFixingDates(c.fixingDates(), IndexNameTranslator::instance().oreName(c.equityCurve()->name()),
609 c.date());
610 if (c.fxIndex() != nullptr) {
612 IndexNameTranslator::instance().oreName(c.fxIndex()->name()), c.date());
613 requiredFixings_.addFixingDate(c.fixingEndDate(), IndexNameTranslator::instance().oreName(c.fxIndex()->name()),
614 c.date());
615 }
616}
617
619 requiredFixings_.addFixingDate(c.fxFixingDate(), IndexNameTranslator::instance().oreName(c.fxIndex()->name()),
620 c.date());
621 c.underlying()->accept(*this);
622}
623
625 requiredFixings_.addFixingDate(c.fxFixingDate(), IndexNameTranslator::instance().oreName(c.fxIndex()->name()),
626 c.date());
627}
628
630 requiredFixings_.addFixingDates(c.fxFixingDates(), IndexNameTranslator::instance().oreName(c.fxIndex()->name()),
631 c.date());
632}
633
635 requiredFixings_.addFixingDates(c.fixingDates(), IndexNameTranslator::instance().oreName(c.index()->name()),
636 c.date());
637}
638
640 // the coupon's index might be null if an initial fixing is provided
641 if (c.index())
642 requiredFixings_.addFixingDate(c.fixingDate(), IndexNameTranslator::instance().oreName(c.index()->name()),
643 c.date());
644 QL_REQUIRE(c.underlying(), "FixingDateGetter::visit(IndexedCoupon): underlying() is null");
645 c.underlying()->accept(*this);
646}
647
649 // the cf's index might be null if an initial fixing is provided
650 if (c.index())
651 requiredFixings_.addFixingDate(c.fixingDate(), IndexNameTranslator::instance().oreName(c.index()->name()),
652 c.date());
653 QL_REQUIRE(c.underlying(), "FixingDateGetter::visit(IndexWrappedCashFlow): underlying() is null");
654 c.underlying()->accept(*this);
655}
656
658
659 bool isInterpolated = c.isInterpolated();
661 c.fixingDateNumerator(), IndexNameTranslator::instance().oreName(c.cpiIndex()->name()), isInterpolated,
662 c.cpiIndex()->frequency(), c.cpiIndex()->availabilityLag(), CPI::Flat, c.cpiIndex()->frequency(), c.date());
664 c.fixingDateDenumerator(), IndexNameTranslator::instance().oreName(c.cpiIndex()->name()), isInterpolated,
665 c.cpiIndex()->frequency(), c.cpiIndex()->availabilityLag(), CPI::Flat, c.cpiIndex()->frequency(), c.date());
666}
667
669 requiredFixings_.addFixingDate(c.fixingDate(), IndexNameTranslator::instance().oreName(c.bondIndex()->name()),
670 c.date());
671}
672
674 requiredFixings_.addFixingDates(c.fixingDates(), IndexNameTranslator::instance().oreName(c.equityCurve()->name()),
675 c.date());
676 if (c.fxIndex() != nullptr)
678 IndexNameTranslator::instance().oreName(c.fxIndex()->name()), c.date());
679}
680
682 auto indices = c.indices();
683 for (const auto& [pricingDate, index] : indices) {
684 // todays fixing is not mandatory, we will fallback to estimate it if its not there.
685 bool isTodaysFixing = Settings::instance().evaluationDate() == pricingDate;
686 if (auto powerIndex = QuantLib::ext::dynamic_pointer_cast<OffPeakPowerIndex>(index)) {
687 // if powerindex, we need the offpeak index fixing and the peak index fixings
688 requiredFixings_.addFixingDate(pricingDate, powerIndex->offPeakIndex()->name(), c.date(), false,
689 !isTodaysFixing);
690 bool isOffPeakDay = powerIndex->peakCalendar().isHoliday(pricingDate);
691 requiredFixings_.addFixingDate(pricingDate, powerIndex->peakIndex()->name(), c.date(), false,
692 isOffPeakDay && !isTodaysFixing);
693 // if the pricing date is > future expiry, add the future expiry itself as well
694 if (auto d = index->expiryDate(); d != Date() && d < pricingDate) {
695 requiredFixings_.addFixingDate(d, powerIndex->offPeakIndex()->name(), c.date(), false, !isTodaysFixing);
696 requiredFixings_.addFixingDate(d, powerIndex->peakIndex()->name(), c.date(), false,
697 isOffPeakDay && !isTodaysFixing);
698 }
699 } else {
700 requiredFixings_.addFixingDate(pricingDate, index->name(), c.date(), false, !isTodaysFixing);
701 // if the pricing date is > future expiry, add the future expiry itself as well
702 if (auto d = index->expiryDate(); d != Date() && d < pricingDate) {
703 requiredFixings_.addFixingDate(d, index->name(), c.date(), false, !isTodaysFixing);
704 }
705 }
706 if (auto baseFutureIndex = QuantLib::ext::dynamic_pointer_cast<CommodityBasisFutureIndex>(index)) {
707 RequiredFixings tmpFixings;
708 FixingDateGetter baseCashflowGetter(tmpFixings);
709 baseFutureIndex->baseCashflow(c.date())->accept(baseCashflowGetter);
710 auto optionalFixings = tmpFixings.makeCopyWithMandatoryOverride(false);
711 requiredFixings_.addData(optionalFixings);
712 }
713 }
714}
715
717 if (bc.initialPrice() == Null<Real>() || requireFixingStartDates_) {
718 requiredFixings_.addFixingDate(bc.fixingStartDate(), bc.index()->name(), bc.date());
719 }
720 requiredFixings_.addFixingDate(bc.fixingEndDate(), bc.index()->name(), bc.date());
721 if (bc.fxIndex()) {
722 requiredFixings_.addFixingDate(bc.fxIndex()->fixingCalendar().adjust(bc.fixingStartDate(), Preceding),
723 IndexNameTranslator::instance().oreName(bc.fxIndex()->name()), bc.date());
724 requiredFixings_.addFixingDate(bc.fxIndex()->fixingCalendar().adjust(bc.fixingEndDate(), Preceding),
725 IndexNameTranslator::instance().oreName(bc.fxIndex()->name()), bc.date());
726 }
727}
728
730 vector<QuantLib::ext::shared_ptr<Index>> indexes;
731 vector<QuantLib::ext::shared_ptr<FxIndex>> fxIndexes;
732
733 if (auto e = QuantLib::ext::dynamic_pointer_cast<QuantExt::CompositeIndex>(bc.index())) {
734 indexes = e->indices();
735 fxIndexes = e->fxConversion();
736
737 // Dividends date can require FX fixings for conversion, add any required fixing
738 std::vector<std::pair<QuantLib::Date, std::string>> fixings =
739 e->dividendFixingDates(bc.fixingStartDate(), bc.fixingEndDate());
740
741 for (const auto& f : fixings)
742 requiredFixings_.addFixingDate(f.first, ore::data::IndexNameTranslator::instance().oreName(f.second));
743 } else {
744 indexes.push_back(bc.index());
745 }
746
747 // always add the top level fxIndex, for a CompositeIndex we may need to convert underlyings to the CompositeIndex
748 // ccy and then to the leg currency
749 fxIndexes.push_back(bc.fxIndex());
751 fxIndexes.push_back(additionalFxIndex_);
752
753 for (const auto& ind : indexes) {
754 if (ind) {
755 auto startDate = ind->fixingCalendar().adjust(bc.fixingStartDate(), Preceding);
756 auto endDate = ind->fixingCalendar().adjust(bc.fixingEndDate(), Preceding);
757
758 auto gi = QuantLib::ext::dynamic_pointer_cast<QuantExt::GenericIndex>(ind);
759
760 if (!gi || gi->expiry() == Date() || startDate < gi->expiry()) {
761 if (bc.initialPrice() == Null<Real>() || requireFixingStartDates_)
762 requiredFixings_.addFixingDate(startDate, IndexNameTranslator::instance().oreName(ind->name()),
763 bc.date());
764 }
765
766 if (!gi || gi->expiry() == Date() || endDate < gi->expiry())
767 requiredFixings_.addFixingDate(endDate, IndexNameTranslator::instance().oreName(ind->name()),
768 bc.date());
769 }
770 }
771
772 for (const auto& fx : fxIndexes) {
773 if (fx) {
774 requiredFixings_.addFixingDate(fx->fixingCalendar().adjust(bc.fixingStartDate(), Preceding),
775 IndexNameTranslator::instance().oreName(fx->name()), bc.date());
776 requiredFixings_.addFixingDate(fx->fixingCalendar().adjust(bc.fixingEndDate(), Preceding),
777 IndexNameTranslator::instance().oreName(fx->name()), bc.date());
778
779 // also add using the underlyingIndex calendar, as FX Conversion is done within a CompositeIndex
780 // for a basket of underlyings
781 requiredFixings_.addFixingDate(bc.index()->fixingCalendar().adjust(bc.fixingStartDate(), Preceding),
782 IndexNameTranslator::instance().oreName(fx->name()), bc.date(), false);
783 requiredFixings_.addFixingDate(bc.index()->fixingCalendar().adjust(bc.fixingEndDate(), Preceding),
784 IndexNameTranslator::instance().oreName(fx->name()), bc.date(), false);
785 }
786 }
787}
788
789void addToRequiredFixings(const QuantLib::Leg& leg, const QuantLib::ext::shared_ptr<FixingDateGetter>& fixingDateGetter) {
790 for (auto const& c : leg) {
791 QL_REQUIRE(c, "addToRequiredFixings(), got null cashflow, this is unexpected");
792 c->accept(*fixingDateGetter);
793 }
794}
795
796void amendInflationFixingDates(std::map<std::string, RequiredFixings::FixingDates>& fixings) {
797 // Loop over indices and amend any that are of type InflationIndex
798 for (auto& [indexName, fixingDates] : fixings) {
799 auto [isInfIndex, infIndex] = isInflationIndex(indexName);
800 if (isInfIndex) {
801 // We have an inflation index
802 RequiredFixings::FixingDates amendedFixingDates;
803 Frequency f = infIndex->frequency();
804 for (const auto& [d, mandatory] : fixingDates) {
805 auto period = inflationPeriod(d, f);
806 if (d == period.first) {
807 // If the fixing date is the start of the inflation period, move it to the end.
808 amendedFixingDates.addDate(period.second, mandatory);
809 } else {
810 // If the fixing date is not the start of the inflation period, leave it as it is.
811 amendedFixingDates.addDate(d, mandatory);
812 }
813 }
814 // Update the fixings map that was passed in with the new set of dates
815 fixings[indexName] = amendedFixingDates;
816 }
817 }
818}
819
820void addMarketFixingDates(const Date& asof, map<string, RequiredFixings::FixingDates>& fixings, const TodaysMarketParameters& mktParams,
821 const Period& iborLookback, const Period& oisLookback, const Period& bmaLookback,
822 const Period& inflationLookback) {
823
824 for (auto const& [configuration, _] : mktParams.configurations()) {
825
826 LOG("Start adding market fixing dates for configuration '" << configuration << "'");
827
828 QuantLib::ext::shared_ptr<Conventions> conventions = InstrumentConventions::instance().conventions();
829
830 // If there are ibor indices in the market parameters, add the lookback fixings
831 // IF there are SIFMA / BMA indices, add lookback fixings for the Libor basis index
833
834 QL_REQUIRE(iborLookback >= 0 * Days, "Ibor lookback period must be non-negative");
835
836 DLOG("Start adding market fixing dates for interest rate indices.");
837
838 set<Date> iborDates;
839 set<Date> oisDates;
840 set<Date> bmaDates;
841 WeekendsOnly calendar;
842
843 std::set<std::string> indices;
844 for (auto const& [i, _] : mktParams.mapping(MarketObject::IndexCurve, configuration)) {
845 indices.insert(i);
846 }
847 for (auto const& [i, _] : mktParams.mapping(MarketObject::YieldCurve, configuration)) {
848 QuantLib::ext::shared_ptr<IborIndex> dummy;
849 if (tryParseIborIndex(i, dummy))
850 indices.insert(i);
851 }
852 for (auto const& [_, s] : mktParams.mapping(MarketObject::DiscountCurve, configuration)) {
853 auto spec = parseCurveSpec(s);
854 QuantLib::ext::shared_ptr<IborIndex> dummy;
855 if (tryParseIborIndex(spec->curveConfigID(), dummy))
856 indices.insert(spec->curveConfigID());
857 }
858
859 // For each of the IR indices in market parameters, insert the dates
860 for (const auto& i : indices) {
861 if (isOvernightIndex(i)) {
862 if (oisDates.empty()) {
863 TLOG("Generating fixing dates for overnight indices.");
864 oisDates = generateLookbackDates(asof, oisLookback, calendar);
865 }
866 TLOG("Adding extra fixing dates for overnight index " << i);
867 fixings[i].addDates(oisDates, false);
868
869 } else if (isBmaIndex(i)) {
870 if (bmaDates.empty()) {
871 TLOG("Generating fixing dates for bma/sifma indices.");
872 bmaDates = generateLookbackDates(asof, bmaLookback, calendar);
873 }
874 fixings[i].addDates(bmaDates, false);
875 if (iborDates.empty()) {
876 TLOG("Generating fixing dates for ibor indices.");
877 iborDates = generateLookbackDates(asof, iborLookback, calendar);
878 }
879 std::set<string> liborNames;
880 for (auto const& c : conventions->get(Convention::Type::BMABasisSwap)) {
881 auto bma = QuantLib::ext::dynamic_pointer_cast<BMABasisSwapConvention>(c);
882 QL_REQUIRE(
883 bma, "internal error, could not cast to BMABasisSwapConvention in addMarketFixingDates()");
884 if (bma->bmaIndexName() == i) {
885 liborNames.insert(bma->liborIndexName());
886 }
887 }
888 for (auto const& l : liborNames) {
889 TLOG("Adding extra fixing dates for libor index " << l << " from bma/sifma index " << i);
890 fixings[l].addDates(iborDates, false);
891 }
892 } else {
893 if (iborDates.empty()) {
894 TLOG("Generating fixing dates for ibor indices.");
895 iborDates = generateLookbackDates(asof, iborLookback, calendar);
896 }
897 TLOG("Adding extra fixing dates for ibor index " << i);
898 fixings[i].addDates(iborDates, false);
899 }
900 }
901
902 DLOG("Finished adding market fixing dates for interest rate indices.");
903 }
904
905 // If there are inflation indices in the market parameters, add the lookback fixings
908
909 QL_REQUIRE(inflationLookback >= 0 * Days, "Inflation lookback period must be non-negative");
910
911 // Dates that will be used for each of the inflation indices
912 Date lookback = NullCalendar().advance(asof, -inflationLookback);
913 lookback = Date(1, lookback.month(), lookback.year());
914 set<Date> dates;
915 do {
916 TLOG("Adding date " << io::iso_date(lookback) << " to fixings for inflation indices");
917 dates.insert(lookback);
918 lookback = NullCalendar().advance(lookback, 1 * Months);
919 } while (lookback <= asof);
920
921 // For each of the inflation indices in market parameters, insert the dates
923 for (const auto& kv : mktParams.mapping(MarketObject::ZeroInflationCurve, configuration)) {
924 TLOG("Adding extra fixing dates for (zero) inflation index " << kv.first);
925 fixings[kv.first].addDates(dates, false);
926 }
927 }
928
930 for (const auto& kv : mktParams.mapping(MarketObject::YoYInflationCurve, configuration)) {
931 TLOG("Adding extra fixing dates for (yoy) inflation index " << kv.first);
932 fixings[kv.first].addDates(dates, false);
933 }
934 }
935 }
936
937 // If there are commodity curves, add "fixings" for this month and two previous months. We add "fixings" for
938 // future contracts with expiry from two months hence to two months prior.
940
941 // "Fixing" dates for commodities.
942 Period commodityLookback = 2 * Months;
943 Date lookback = asof - commodityLookback;
944 lookback = Date(1, lookback.month(), lookback.year());
945 set<Date> dates;
946 do {
947 TLOG("Adding date " << io::iso_date(lookback) << " to fixings for commodities");
948 dates.insert(lookback++);
949 } while (lookback <= asof);
950
951 // Expiry months and years for which we require future contract fixings. For our purposes here, using the
952 // 1st of the month does not matter. We will just use the date to get the appropriate commodity future
953 // index name below when adding the dates and the "-01" will be removed (for non-daily contracts).
954 Size numberMonths = 2;
955 vector<Date> contractExpiries;
956 Date startContract = asof - numberMonths * Months;
957 Date endContract = asof + numberMonths * Months;
958 do {
959 Month m = startContract.month();
960 Year y = startContract.year();
961 TLOG("Adding contract month and year (" << m << "," << y << ")");
962 contractExpiries.push_back(Date(1, m, y));
963 startContract += 1 * Months;
964 } while (startContract <= endContract);
965
966 // For each of the commodity names, create the future contract name with the relevant expiry and insert
967 // the dates. Skip commodity names that do not have future conventions.
968 for (const auto& kv : mktParams.mapping(MarketObject::CommodityCurve, configuration)) {
969
970 QuantLib::ext::shared_ptr<CommodityFutureConvention> cfc;
971 if (conventions->has(kv.first)) {
972 cfc = QuantLib::ext::dynamic_pointer_cast<CommodityFutureConvention>(conventions->get(kv.first));
973 }
974
975 auto commIdx = parseCommodityIndex(kv.first, false);
976 if (cfc) {
977 if (auto oppIdx = QuantLib::ext::dynamic_pointer_cast<OffPeakPowerIndex>(commIdx)) {
978 DLOG("Commodity " << kv.first << " is off-peak power so adding underlying daily contracts.");
979 const auto& opIndex = oppIdx->offPeakIndex();
980 const auto& pIndex = oppIdx->peakIndex();
981 for (const Date& expiry : dates) {
982 auto tmpIdx = oppIdx->clone(expiry);
983 auto opName = opIndex->clone(expiry)->name();
984 TLOG("Adding (date, id) = (" << io::iso_date(expiry) << "," << opName << ")");
985 fixings[opName].addDate(expiry, false);
986 auto pName = pIndex->clone(expiry)->name();
987 TLOG("Adding (date, id) = (" << io::iso_date(expiry) << "," << pName << ")");
988 fixings[pName].addDate(expiry, false);
989 }
990 } else if (cfc->contractFrequency() == Daily) {
991 DLOG("Commodity " << kv.first << " has daily frequency so adding daily contracts.");
992 for (const Date& expiry : dates) {
993 auto indexName = commIdx->clone(expiry)->name();
994 TLOG("Adding (date, id) = (" << io::iso_date(expiry) << "," << indexName << ")");
995 fixings[indexName].addDate(expiry, false);
996 }
997 } else {
998 DLOG("Commodity " << kv.first << " is not daily so adding the monthly contracts.");
999 for (const Date& expiry : contractExpiries) {
1000 auto indexName = commIdx->clone(expiry)->name();
1001 TLOG("Adding extra fixing dates for commodity future " << indexName);
1002 fixings[indexName].addDates(dates, false);
1003 }
1004 }
1005 } else {
1006 // Assumption here is that we have a spot index.
1007 DLOG("Commodity " << kv.first << " does not have future conventions so adding daily fixings.");
1008 auto indexName = commIdx->name();
1009 TLOG("Adding extra fixing dates for commodity spot " << indexName);
1010 fixings[indexName].addDates(dates, false);
1011 }
1012 }
1013 }
1014
1015 LOG("Finished adding market fixing dates for configuration '" << configuration << "'");
1016 }
1017}
1018
1019} // namespace data
1020} // namespace ore
Date date() const override
const boost::shared_ptr< FxIndex > & fxIndex() const
const std::vector< Date > & fxFixingDates() const
const std::vector< Date > & fixingDates() const
ext::shared_ptr< AverageBMACoupon > underlying() const
ext::shared_ptr< AverageONIndexedCoupon > underlying() const
ext::shared_ptr< OvernightIndexedCoupon > underlying() const
const ext::shared_ptr< ConstantMaturityBondIndex > & bondIndex() const
virtual const std::vector< std::pair< QuantLib::Date, ext::shared_ptr< CommodityIndex > > > & indices() const=0
const boost::shared_ptr< FxIndex > & fxIndex() const
std::vector< Date > fixingDates() const
Date fixingEndDate() const
const boost::shared_ptr< QuantExt::EquityIndex2 > & equityCurve() const
Date fixingStartDate() const
const boost::shared_ptr< FxIndex > & fxIndex() const
std::vector< Date > fixingDates() const
const boost::shared_ptr< QuantExt::EquityIndex2 > & equityCurve() const
Date date() const override
const boost::shared_ptr< FxIndex > & fxIndex() const
Date fxFixingDate() const
boost::shared_ptr< FloatingRateCoupon > underlying() const
boost::shared_ptr< Index > index() const
boost::shared_ptr< CashFlow > underlying() const
Date date() const override
const Date & fixingDate() const
boost::shared_ptr< Coupon > underlying() const
boost::shared_ptr< Index > index() const
const Date & fixingDate() const
virtual Date fixingDateNumerator() const
virtual ext::shared_ptr< ZeroInflationIndex > cpiIndex() const
virtual Date fixingDateDenumerator() const
const std::vector< Date > & fixingDates() const
Date fixingDate() const override
const std::vector< Date > & fixingDates() const
const boost::shared_ptr< FxIndex > & fxIndex() const
const boost::shared_ptr< Index > & index() const
const Real initialPrice() const
const Date & fixingEndDate() const
Date date() const override
const Date & fixingStartDate() const
RequiredFixings & requiredFixings_
void visit(QuantLib::CashFlow &c) override
QuantLib::ext::shared_ptr< QuantExt::FxIndex > additionalFxIndex_
void addDate(const QuantLib::Date &date, const bool mandatory)
Definition: fixingdates.hpp:93
void addFixingDates(const std::vector< std::pair< QuantLib::Date, bool > > &fixingDates, const std::string &indexName, const QuantLib::Date &payDate=Date::maxDate(), const bool alwaysAddIfPaysOnSettlement=false)
std::set< ZeroInflationFixingEntry > zeroInflationFixingDates_
std::set< InflationFixingEntry > yoyInflationFixingDates_
void addData(const RequiredFixings &requiredFixings)
std::map< std::string, FixingDates > fixingDatesIndices(const QuantLib::Date &settlementDate=QuantLib::Date()) const
void addZeroInflationFixingDate(const QuantLib::Date &fixingDate, const std::string &indexName, const bool indexInterpolated, const Frequency indexFrequency, const Period &indexAvailabilityLag, const CPI::InterpolationType coupopnInterpolation, const Frequency couponFrequency, const QuantLib::Date &payDate=Date::maxDate(), const bool alwaysAddIfPaysOnSettlement=false, const bool mandatoryFixing=true)
RequiredFixings filteredFixingDates(const QuantLib::Date &settlementDate=QuantLib::Date())
void addFixingDate(const QuantLib::Date &fixingDate, const std::string &indexName, const QuantLib::Date &payDate=Date::maxDate(), const bool alwaysAddIfPaysOnSettlement=false, const bool mandatoryFixing=true)
std::set< FixingEntry > fixingDates_
void addYoYInflationFixingDate(const QuantLib::Date &fixingDate, const std::string &indexName, const bool indexInterpolated, const Frequency indexFrequency, const Period &indexAvailabilityLag, const QuantLib::Date &payDate=Date::maxDate(), const bool alwaysAddIfPaysOnSettlement=false, const bool mandatoryFixing=true)
RequiredFixings makeCopyWithMandatoryOverride(bool mandatory)
const vector< pair< string, MarketConfiguration > > & configurations() const
const map< string, string > & mapping(const MarketObject o, const string &configuration) const
EUR => Yield/EUR/EUR6M, USD => Yield/USD/USD3M etc.
bool hasMarketObject(const MarketObject &o) const
CurveSpec parser.
Logic for calculating required fixing dates on legs.
QuantLib::ext::shared_ptr< CurveSpec > parseCurveSpec(const string &s)
function to convert a string into a curve spec
bool isOvernightIndex(const string &indexName)
Return true if the indexName is that of an overnight index, otherwise false.
bool isBmaIndex(const string &indexName)
Return true if the indexName is that of an bma/sifma index, otherwise false.
pair< bool, QuantLib::ext::shared_ptr< ZeroInflationIndex > > isInflationIndex(const string &indexName)
bool tryParseIborIndex(const string &s, QuantLib::ext::shared_ptr< IborIndex > &index)
Try to convert std::string to QuantLib::IborIndex.
ibor fallback configuration
translates between QuantLib::Index::name() and ORE names
Map text representations to QuantLib/QuantExt types.
@ data
Definition: log.hpp:77
#define LOG(text)
Logging Macro (Level = Notice)
Definition: log.hpp:552
#define DLOG(text)
Logging Macro (Level = Debug)
Definition: log.hpp:554
#define TLOG(text)
Logging Macro (Level = Data)
Definition: log.hpp:556
Calendar calendar
Definition: utilities.cpp:441
QuantLib::Date fixingDate(const QuantLib::Date &d, const QuantLib::Period obsLag, const QuantLib::Frequency freq, bool interpolated)
bool operator<(const Dividend &d1, const Dividend &d2)
std::ostream & operator<<(std::ostream &out, EquityReturnType t)
void amendInflationFixingDates(std::map< std::string, RequiredFixings::FixingDates > &fixings)
void addMarketFixingDates(const Date &asof, map< string, RequiredFixings::FixingDates > &fixings, const TodaysMarketParameters &mktParams, const Period &iborLookback, const Period &oisLookback, const Period &bmaLookback, const Period &inflationLookback)
void addToRequiredFixings(const QuantLib::Leg &leg, const QuantLib::ext::shared_ptr< FixingDateGetter > &fixingDateGetter)
QuantLib::ext::shared_ptr< QuantExt::CommodityIndex > parseCommodityIndex(const string &name, bool hasPrefix, const Handle< PriceTermStructure > &ts, const Calendar &cal, const bool enforceFutureIndex)
Serializable Credit Default Swap.
Definition: namespaces.docs:23
std::string indexName
QuantLib::Date fixingDate
bool mandatory
QuantLib::Date payDate
bool alwaysAddIfPaysOnSettlement
friend bool operator<(const InflationFixingEntry &lhs, const InflationFixingEntry &rhs)
QuantLib::Period availabilityLeg
bool indexInterpolated
QuantLib::Frequency indexFreq
QuantLib::Frequency couponFrequency
CPI::InterpolationType couponInterpolation