24using QuantLib::Period;
27std::pair<QuantLib::Date, QuantLib::Period>
getStartAndLag(
const QuantLib::Date& asof,
34 return make_pair(asof, Period());
41 Date dateInPeriod = d - Period(conv.
index()->frequency());
44 QL_REQUIRE(dateInPeriod < asof,
"InflationCurve: expected date in inflation period ("
45 << io::iso_date(dateInPeriod) <<
") to be before the as of date ("
46 << io::iso_date(asof) <<
").");
47 Period curveObsLag = (asof - dateInPeriod) * Days;
49 return make_pair(d, curveObsLag);
63 QL_REQUIRE(!ps.empty(),
"InflationCurve: roll on publication is true for "
64 << conv.
id() <<
" but the publication schedule is empty.");
67 const vector<Date>& ds = ps.dates();
68 QL_REQUIRE(ds.front() < asof,
"InflationCurve: first date in the publication schedule ("
69 << io::iso_date(ds.front()) <<
") should be before the as of date ("
70 << io::iso_date(asof) <<
").");
71 QL_REQUIRE(asof < ds.back(),
"InflationCurve: last date in the publication schedule ("
72 << io::iso_date(ds.back()) <<
") should be after the as of date ("
73 << io::iso_date(asof) <<
").");
77 auto it = lower_bound(ds.begin(), ds.end(), asof);
85 d -= conv.
index()->availabilityLag();
87 return Date(15, d.month(), d.year());
const string & id() const
PublicationRoll publicationRoll() const
QuantLib::ext::shared_ptr< ZeroInflationIndex > index() const
PublicationRoll
Rule for determining when inflation swaps roll to observing latest inflation index release.
const Schedule & publicationSchedule() const
QuantLib::Date getInflationSwapStart(const Date &asof, const InflationSwapConvention &convention)
std::pair< QuantLib::Date, QuantLib::Period > getStartAndLag(const QuantLib::Date &asof, const InflationSwapConvention &conv)
Serializable Credit Default Swap.