Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
eqbsconstantparametrization.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 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 eqbsconstantparametrization.hpp
20 \brief Constant equity model parametrization
21 \ingroup models
22*/
23
24#ifndef quantext_constant_eqbs_parametrization_hpp
25#define quantext_constant_eqbs_parametrization_hpp
26
28
29namespace QuantExt {
30//! EQ Black Scholes parametrization
31/*! EQ Black Scholes parametrization, with constant volatility
32 \ingroup models
33*/
35public:
36 /*! The currency refers to the equity currency, the
37 spots are as of today (i.e. the discounted spot) */
38 EqBsConstantParametrization(const Currency& currency, const std::string& eqName, const Handle<Quote>& eqSpotToday,
39 const Handle<Quote>& fxSpotToday, const Real sigma,
40 const Handle<YieldTermStructure>& eqIrCurveToday,
41 const Handle<YieldTermStructure>& eqDivYieldCurveToday);
42 Real variance(const Time t) const override;
43 Real sigma(const Time t) const override;
44 const QuantLib::ext::shared_ptr<Parameter> parameter(const Size) const override;
45
46protected:
47 Real direct(const Size i, const Real x) const override;
48 Real inverse(const Size i, const Real y) const override;
49
50private:
51 const QuantLib::ext::shared_ptr<PseudoParameter> sigma_;
52};
53
54// inline
55
56inline Real EqBsConstantParametrization::direct(const Size, const Real x) const { return x * x; }
57
58inline Real EqBsConstantParametrization::inverse(const Size, const Real y) const { return std::sqrt(y); }
59
60inline Real EqBsConstantParametrization::variance(const Time t) const {
61 return direct(0, sigma_->params()[0]) * direct(0, sigma_->params()[0]) * t;
62}
63
64inline Real EqBsConstantParametrization::sigma(const Time) const { return direct(0, sigma_->params()[0]); }
65
66inline const QuantLib::ext::shared_ptr<Parameter> EqBsConstantParametrization::parameter(const Size i) const {
67 QL_REQUIRE(i == 0, "parameter " << i << " does not exist, only have 0");
68 return sigma_;
69}
70
71} // namespace QuantExt
72
73#endif
Real inverse(const Size i, const Real y) const override
Real variance(const Time t) const override
Real direct(const Size i, const Real x) const override
const QuantLib::ext::shared_ptr< PseudoParameter > sigma_
const QuantLib::ext::shared_ptr< Parameter > parameter(const Size) const override
EQ Black Scholes parametrizations.
const Handle< Quote > eqSpotToday() const
const Handle< Quote > fxSpotToday() const
virtual const Currency & currency() const
EQ Black Scholes parametrization.