Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
crosscurrencypricetermstructure.hpp
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
19/*! \file qle/termstructures/crosscurrencypricetermstructure.hpp
20 \brief Price term structure in a given currency derived from a price term structure in another currency
21*/
22
23#ifndef quantext_cross_currency_price_term_structure_hpp
24#define quantext_cross_currency_price_term_structure_hpp
25
26#include <ql/termstructures/yieldtermstructure.hpp>
28
29namespace QuantExt {
30
31//! Cross currency price term structure
32/*! This class creates a price term structure in a given currency using an already constructed price term structure
33 in a different currency.
34
35 \ingroup termstructures
36*/
38public:
39 //! \name Constructors
40 //@{
41 /*! Fixed reference date based price term structure.
42 \param referenceDate This price term structure's reference date.
43 \param basePriceTs The price term structure in base currency units.
44 \param fxSpot The number of units of this price term structure's currency per unit of the base price
45 term structure's currency.
46 \param baseCurrencyYts The yield term structure for the base currency.
47 \param yts The yield term structure for this price term structure's currency.
48 \param currency The price term structure's currency.
49 */
50 CrossCurrencyPriceTermStructure(const QuantLib::Date& referenceDate,
51 const QuantLib::Handle<PriceTermStructure>& basePriceTs,
52 const QuantLib::Handle<QuantLib::Quote>& fxSpot,
53 const QuantLib::Handle<QuantLib::YieldTermStructure>& baseCurrencyYts,
54 const QuantLib::Handle<QuantLib::YieldTermStructure>& yts,
55 const QuantLib::Currency& currency);
56
57 /*! Floating reference date based price term structure.
58 \param settlementDays This price term structure's settlement days.
59 \param basePriceTs The price term structure in base currency units.
60 \param fxSpot The number of units of this price term structure's currency per unit of the base price
61 term structure's currency.
62 \param baseCurrencyYts The yield term structure for the base currency.
63 \param yts The yield term structure for this price term structure's currency.
64 \param currency The price term structure's currency.
65 */
66 CrossCurrencyPriceTermStructure(QuantLib::Natural settlementDays,
67 const QuantLib::Handle<PriceTermStructure>& basePriceTs,
68 const QuantLib::Handle<QuantLib::Quote>& fxSpot,
69 const QuantLib::Handle<QuantLib::YieldTermStructure>& baseCurrencyYts,
70 const QuantLib::Handle<QuantLib::YieldTermStructure>& yts,
71 const QuantLib::Currency& currency);
72 //@}
73
74 //! \name TermStructure interface
75 //@{
76 QuantLib::Date maxDate() const override;
77 QuantLib::Time maxTime() const override;
78 //@}
79
80 //! \name PriceTermStructure interface
81 //@{
82 QuantLib::Time minTime() const override;
83 std::vector<QuantLib::Date> pillarDates() const override;
84 const QuantLib::Currency& currency() const override { return currency_; }
85 //@}
86
87 //! \name Inspectors
88 //@{
89 //! The price term structure in base currency
90 const QuantLib::Handle<PriceTermStructure>& basePriceTs() const { return basePriceTs_; }
91
92 //! The FX spot rate, number of units of this price term structure's currency per unit of the base currency
93 const QuantLib::Handle<QuantLib::Quote>& fxSpot() const { return fxSpot_; }
94
95 //! The yield term structure for the base currency
96 const QuantLib::Handle<QuantLib::YieldTermStructure>& baseCurrencyYts() const { return baseCurrencyYts_; }
97
98 //! The yield term structure for this price term structure's currency
99 const QuantLib::Handle<QuantLib::YieldTermStructure>& yts() const { return yts_; }
100 //@}
101
102protected:
103 //! Price calculation
104 QuantLib::Real priceImpl(QuantLib::Time t) const override;
105
106private:
107 //! Register with underlying market data
108 void registration();
109
110 QuantLib::Handle<PriceTermStructure> basePriceTs_;
111 QuantLib::Handle<QuantLib::Quote> fxSpot_;
112 QuantLib::Handle<QuantLib::YieldTermStructure> baseCurrencyYts_;
113 QuantLib::Handle<QuantLib::YieldTermStructure> yts_;
114 QuantLib::Currency currency_;
115};
116
117} // namespace QuantExt
118
119#endif
const QuantLib::Handle< QuantLib::YieldTermStructure > & baseCurrencyYts() const
The yield term structure for the base currency.
QuantLib::Time minTime() const override
The minimum time for which the curve can return values.
CrossCurrencyPriceTermStructure(QuantLib::Natural settlementDays, const QuantLib::Handle< PriceTermStructure > &basePriceTs, const QuantLib::Handle< QuantLib::Quote > &fxSpot, const QuantLib::Handle< QuantLib::YieldTermStructure > &baseCurrencyYts, const QuantLib::Handle< QuantLib::YieldTermStructure > &yts, const QuantLib::Currency &currency)
const QuantLib::Handle< QuantLib::YieldTermStructure > & yts() const
The yield term structure for this price term structure's currency.
const QuantLib::Currency & currency() const override
The currency in which prices are expressed.
const QuantLib::Handle< QuantLib::Quote > & fxSpot() const
The FX spot rate, number of units of this price term structure's currency per unit of the base curren...
const QuantLib::Handle< PriceTermStructure > & basePriceTs() const
The price term structure in base currency.
void registration()
Register with underlying market data.
QuantLib::Handle< QuantLib::YieldTermStructure > baseCurrencyYts_
std::vector< QuantLib::Date > pillarDates() const override
The pillar dates for the PriceTermStructure.
QuantLib::Handle< QuantLib::YieldTermStructure > yts_
QuantLib::Handle< PriceTermStructure > basePriceTs_
QuantLib::Real priceImpl(QuantLib::Time t) const override
Price calculation.
Term structure of prices.