Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
fxbspiecewiseconstantparametrization.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 fxbspiecewiseconstantparametrization.hpp
20 \brief piecewise constant model parametrization
21 \ingroup models
22*/
23
24#ifndef quantext_piecewiseconstant_fxbs_parametrization_hpp
25#define quantext_piecewiseconstant_fxbs_parametrization_hpp
26
29
30namespace QuantExt {
31//! FX Black Scholes constant parametrization
32/*! FX Black Scholes parametrization with piecewise
33 constant volatility
34 \ingroup models
35*/
37public:
38 /*! The currency refers to the foreign currency, the spot
39 is as of today (i.e. the discounted spot) */
40 FxBsPiecewiseConstantParametrization(const Currency& currency, const Handle<Quote>& fxSpotToday, const Array& times,
41 const Array& sigma,
42 const QuantLib::ext::shared_ptr<QuantLib::Constraint>& sigmaConstraint = QuantLib::ext::make_shared<QuantLib::NoConstraint>());
43 /*! The term structure is needed in addition because it
44 it's day counter and reference date is needed to
45 convert dates to times. It should be the term structure
46 of the domestic IR component in the cross asset model,
47 since this is defining the model's date-time conversion
48 in more general terms. */
49 FxBsPiecewiseConstantParametrization(const Currency& currency, const Handle<Quote>& fxSpotToday,
50 const std::vector<Date>& dates, const Array& sigma,
51 const Handle<YieldTermStructure>& domesticTermStructure,
52 const QuantLib::ext::shared_ptr<QuantLib::Constraint>& sigmaConstraint = QuantLib::ext::make_shared<QuantLib::NoConstraint>());
53
54 Real variance(const Time t) const override;
55 Real sigma(const Time t) const override;
56 const Array& parameterTimes(const Size) const override;
57 const QuantLib::ext::shared_ptr<Parameter> parameter(const Size) const override;
58 void update() const override;
59
60protected:
61 Real direct(const Size i, const Real x) const override;
62 Real inverse(const Size i, const Real y) const override;
63
64private:
65 void initialize(const Array& sigma);
66};
67
68// inline
69
70inline Real FxBsPiecewiseConstantParametrization::direct(const Size, const Real x) const {
72}
73
74inline Real FxBsPiecewiseConstantParametrization::inverse(const Size, const Real y) const {
76}
77
78inline Real FxBsPiecewiseConstantParametrization::variance(const Time t) const {
80}
81
83
84inline const Array& FxBsPiecewiseConstantParametrization::parameterTimes(const Size i) const {
85 QL_REQUIRE(i == 0, "parameter " << i << " does not exist, only have 0");
87}
88
89inline const QuantLib::ext::shared_ptr<Parameter> FxBsPiecewiseConstantParametrization::parameter(const Size i) const {
90 QL_REQUIRE(i == 0, "parameter " << i << " does not exist, only have 0");
92}
93
95
96} // namespace QuantExt
97
98#endif
FX Black Scholes parametrizations.
const Handle< Quote > fxSpotToday() const
FxBsPiecewiseConstantParametrization(const Currency &currency, const Handle< Quote > &fxSpotToday, const std::vector< Date > &dates, const Array &sigma, const Handle< YieldTermStructure > &domesticTermStructure, const QuantLib::ext::shared_ptr< QuantLib::Constraint > &sigmaConstraint=QuantLib::ext::make_shared< QuantLib::NoConstraint >())
FxBsPiecewiseConstantParametrization(const Currency &currency, const Handle< Quote > &fxSpotToday, const Array &times, const Array &sigma, const QuantLib::ext::shared_ptr< QuantLib::Constraint > &sigmaConstraint=QuantLib::ext::make_shared< QuantLib::NoConstraint >())
Real inverse(const Size i, const Real y) const override
Real direct(const Size i, const Real x) const override
const QuantLib::ext::shared_ptr< Parameter > parameter(const Size) const override
virtual const Currency & currency() const
const QuantLib::ext::shared_ptr< PseudoParameter > y_
Real int_y_sqr(const Time t) const
int_0^t y^2(s) ds
FX Black Scholes parametrization.
helper classes for piecewise constant parametrizations