28 const QuantLib::Handle<PriceTermStructure>& referenceCurve,
const std::vector<QuantLib::Real>& times,
29 const std::vector<QuantLib::Handle<QuantLib::Quote>>& priceSpreads)
30 :
PriceTermStructure(referenceCurve->dayCounter()), referenceCurve_(referenceCurve), times_(times),
31 priceSpreads_(priceSpreads), data_(times.size()) {
32 QL_REQUIRE(
times_.size() > 1,
"SpreadedPriceTermStructure: at least two times required");
34 "SpreadedPriceTermStructure: size of time and quote vectors do not match");
35 QL_REQUIRE(
times_[0] == 0.0,
"SpreadedPriceTermStructure: first time must be 0, got " <<
times_[0]);
39 QuantLib::ext::make_shared<LinearInterpolation>(
times_.begin(),
times_.end(),
data_.begin()));
48 TermStructure::update();
64 for (Size i = 0; i <
times_.size(); ++i) {
65 QL_REQUIRE(!
priceSpreads_[i].empty(),
"SpreadedPriceTermStructure: quote at index " << i <<
" is empty");
QuantLib::ext::shared_ptr< QuantLib::Interpolation > interpolation_
QuantLib::Time minTime() const override
The minimum time for which the curve can return values.
void performCalculations() const override
QuantLib::Calendar calendar() const override
const QuantLib::Currency & currency() const override
The currency in which prices are expressed.
std::vector< QuantLib::Handle< QuantLib::Quote > > priceSpreads_
const QuantLib::Date & referenceDate() const override
SpreadedPriceTermStructure(const QuantLib::Handle< PriceTermStructure > &referenceCurve, const std::vector< QuantLib::Real > ×, const std::vector< QuantLib::Handle< QuantLib::Quote > > &priceSpreads)
times should be consistent with reference curve day counter
QuantLib::Natural settlementDays() const override
QuantLib::Date maxDate() const override
std::vector< QuantLib::Real > times_
QuantLib::Handle< PriceTermStructure > referenceCurve_
std::vector< QuantLib::Date > pillarDates() const override
The pillar dates for the PriceTermStructure.
QuantLib::Real priceImpl(QuantLib::Time) const override
Price calculation.
std::vector< QuantLib::Real > data_
Spreaded Term structure of prices.