Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
fxbsparametrization.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 fxbsparametrization.hpp
20 \brief FX Black Scholes parametrization
21 \ingroup models
22*/
23
24#ifndef quantext_fxbs_parametrization_hpp
25#define quantext_fxbs_parametrization_hpp
26
27#include <ql/handle.hpp>
28#include <ql/termstructures/yieldtermstructure.hpp>
30
31namespace QuantExt {
32using namespace QuantLib;
33
34//! FX Black Scholes parametrizations
35/*! Base class for FX Black Scholes parametrizations
36 \ingroup models
37*/
39public:
40 /*! The currency refers to the foreign currency, the spot
41 is as of today (i.e. the discounted spot) */
42 FxBsParametrization(const Currency& foreignCurrency, const Handle<Quote>& fxSpotToday);
43 /*! must satisfy variance(0) = 0.0, variance'(t) >= 0 */
44 virtual Real variance(const Time t) const = 0;
45 /*! is supposed to be positive */
46 virtual Real sigma(const Time t) const;
47 virtual Real stdDeviation(const Time t) const;
48 const Handle<Quote> fxSpotToday() const;
49
50 Size numberOfParameters() const override { return 1; }
51
52private:
53 const Handle<Quote> fxSpotToday_;
54};
55
56// inline
57
58inline Real FxBsParametrization::sigma(const Time t) const {
59 return std::sqrt((variance(tr(t)) - variance(tl(t))) / h_);
60}
61
62inline Real FxBsParametrization::stdDeviation(const Time t) const { return std::sqrt(variance(t)); }
63
64inline const Handle<Quote> FxBsParametrization::fxSpotToday() const { return fxSpotToday_; }
65
66} // namespace QuantExt
67
68#endif
FX Black Scholes parametrizations.
const Handle< Quote > fxSpotToday_
virtual Real variance(const Time t) const =0
Size numberOfParameters() const override
virtual Real stdDeviation(const Time t) const
const Handle< Quote > fxSpotToday() const
virtual Real sigma(const Time t) const
Time tl(const Time t) const
Time tr(const Time t) const
base class for model parametrizations