QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
quantotermstructure.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2003 Ferdinando Ametrano
5 Copyright (C) 2008 StatPro Italia srl
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
21/*! \file quantotermstructure.hpp
22 \brief Quanto term structure
23*/
24
25#ifndef quantlib_quanto_term_structure_hpp
26#define quantlib_quanto_term_structure_hpp
27
30#include <utility>
31
32namespace QuantLib {
33
34 //! Quanto term structure
35 /*! Quanto term structure for modelling quanto effect in
36 option pricing.
37
38 \note This term structure will remain linked to the original
39 structures, i.e., any changes in the latters will be
40 reflected in this structure as well.
41 */
43 public:
44 QuantoTermStructure(const Handle<YieldTermStructure>& underlyingDividendTS,
46 Handle<YieldTermStructure> foreignRiskFreeTS,
47 Handle<BlackVolTermStructure> underlyingBlackVolTS,
48 Real strike,
49 Handle<BlackVolTermStructure> exchRateBlackVolTS,
50 Real exchRateATMlevel,
51 Real underlyingExchRateCorrelation);
52 //! \name YieldTermStructure interface
53 //@{
54 DayCounter dayCounter() const override;
55 Calendar calendar() const override;
56 Natural settlementDays() const override;
57 const Date& referenceDate() const override;
58 Date maxDate() const override;
59 //@}
60 protected:
61 //! returns the zero yield as seen from the evaluation date
62 Rate zeroYieldImpl(Time) const override;
63
64 private:
70 };
71
72
73 // inline definitions
74
76 const Handle<YieldTermStructure>& underlyingDividendTS,
78 Handle<YieldTermStructure> foreignRiskFreeTS,
79 Handle<BlackVolTermStructure> underlyingBlackVolTS,
80 Real strike,
81 Handle<BlackVolTermStructure> exchRateBlackVolTS,
82 Real exchRateATMlevel,
83 Real underlyingExchRateCorrelation)
84 : ZeroYieldStructure(underlyingDividendTS->dayCounter()),
85 underlyingDividendTS_(underlyingDividendTS), riskFreeTS_(std::move(riskFreeTS)),
86 foreignRiskFreeTS_(std::move(foreignRiskFreeTS)),
87 underlyingBlackVolTS_(std::move(underlyingBlackVolTS)),
88 exchRateBlackVolTS_(std::move(exchRateBlackVolTS)),
89 underlyingExchRateCorrelation_(underlyingExchRateCorrelation), strike_(strike),
90 exchRateATMlevel_(exchRateATMlevel) {
96 }
97
99 return underlyingDividendTS_->dayCounter();
100 }
101
103 return underlyingDividendTS_->calendar();
104 }
105
107 return underlyingDividendTS_->settlementDays();
108 }
109
111 return underlyingDividendTS_->referenceDate();
112 }
113
115 Date maxDate = std::min(underlyingDividendTS_->maxDate(),
116 riskFreeTS_->maxDate());
117 maxDate = std::min(maxDate, foreignRiskFreeTS_->maxDate());
118 maxDate = std::min(maxDate, underlyingBlackVolTS_->maxDate());
119 maxDate = std::min(maxDate, exchRateBlackVolTS_->maxDate());
120 return maxDate;
121 }
122
124 // warning: here it is assumed that all TS have the same daycount.
125 // It should be QL_REQUIREd
126 return underlyingDividendTS_->zeroRate(t, Continuous, NoFrequency, true).rate()
127 + riskFreeTS_->zeroRate(t, Continuous, NoFrequency, true).rate()
128 - foreignRiskFreeTS_->zeroRate(t, Continuous, NoFrequency, true).rate()
130 * underlyingBlackVolTS_->blackVol(t, strike_, true)
131 * exchRateBlackVolTS_->blackVol(t, exchRateATMlevel_, true);
132 }
133
134}
135
136
137#endif
Black volatility term structure base classes.
calendar class
Definition: calendar.hpp:61
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
Shared handle to an observable.
Definition: handle.hpp:41
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
Definition: observable.hpp:228
Handle< YieldTermStructure > foreignRiskFreeTS_
Calendar calendar() const override
the calendar used for reference and/or option date calculation
Handle< BlackVolTermStructure > exchRateBlackVolTS_
Rate zeroYieldImpl(Time) const override
returns the zero yield as seen from the evaluation date
Handle< BlackVolTermStructure > underlyingBlackVolTS_
const Date & referenceDate() const override
the date at which discount = 1.0 and/or variance = 0.0
QuantoTermStructure(const Handle< YieldTermStructure > &underlyingDividendTS, Handle< YieldTermStructure > riskFreeTS, Handle< YieldTermStructure > foreignRiskFreeTS, Handle< BlackVolTermStructure > underlyingBlackVolTS, Real strike, Handle< BlackVolTermStructure > exchRateBlackVolTS, Real exchRateATMlevel, Real underlyingExchRateCorrelation)
Natural settlementDays() const override
the settlementDays used for reference date calculation
DayCounter dayCounter() const override
the day counter used for date/time conversion
Handle< YieldTermStructure > riskFreeTS_
Date maxDate() const override
the latest date for which the curve can return values
Handle< YieldTermStructure > underlyingDividendTS_
Zero-yield term structure.
const DefaultType & t
@ NoFrequency
null frequency
Definition: frequency.hpp:37
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
Real Rate
interest rates
Definition: types.hpp:70
Definition: any.hpp:35
STL namespace.
Zero-yield based term structure.