Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
spreadedpricetermstructure.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2020 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
19/*! \file qle/termstructures/spreadedpricetermstructure.hpp
20 \brief Spreaded Term structure of prices
21*/
22
23#pragma once
24
26
27#include <ql/math/interpolation.hpp>
28#include <ql/patterns/lazyobject.hpp>
29
30namespace QuantExt {
31
32//! Spreaded Price term structure
33class SpreadedPriceTermStructure : public PriceTermStructure, public QuantLib::LazyObject {
34public:
35 //! times should be consistent with reference curve day counter
36 SpreadedPriceTermStructure(const QuantLib::Handle<PriceTermStructure>& referenceCurve,
37 const std::vector<QuantLib::Real>& times,
38 const std::vector<QuantLib::Handle<QuantLib::Quote>>& priceSpreads);
39
40 QuantLib::Date maxDate() const override;
41 void update() override;
42 const QuantLib::Date& referenceDate() const override;
43 QuantLib::Calendar calendar() const override;
44 QuantLib::Natural settlementDays() const override;
45
46 QuantLib::Time minTime() const override;
47 const QuantLib::Currency& currency() const override;
48 std::vector<QuantLib::Date> pillarDates() const override;
49
50private:
51 void performCalculations() const override;
52 QuantLib::Real priceImpl(QuantLib::Time) const override;
53
54 QuantLib::Handle<PriceTermStructure> referenceCurve_;
55 mutable std::vector<QuantLib::Real> times_;
56 std::vector<QuantLib::Handle<QuantLib::Quote>> priceSpreads_;
57
58 mutable std::vector<QuantLib::Real> data_;
59 QuantLib::ext::shared_ptr<QuantLib::Interpolation> interpolation_;
60};
61
62} // namespace QuantExt
QuantLib::ext::shared_ptr< QuantLib::Interpolation > interpolation_
QuantLib::Time minTime() const override
The minimum time for which the curve can return values.
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
QuantLib::Natural settlementDays() const override
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.
Term structure of prices.