Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
localvol.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 ored/scripting/models/localvol.hpp
20 \brief local vol model for n underlyings (fx, equity or commodity)
21 \ingroup utilities
22*/
23
24#pragma once
25
27
29
30namespace ore {
31namespace data {
32
33class LocalVol : public BlackScholesBase {
34public:
35 /* ctor for multiple underlyings, see BlackScholesBase, plus:
36 - processes: hold spot, rate and div ts and vol for each given index
37 - calibrationMoneyness: a vector of relative forward atm moneyness used to calibrate the Andrease-Huge volatility
38 surface to
39 - we assume that the given correlations are constant and read the value only at t = 0
40 */
42 const Size paths, const std::vector<std::string>& currencies,
43 const std::vector<Handle<YieldTermStructure>>& curves, const std::vector<Handle<Quote>>& fxSpots,
44 const std::vector<std::pair<std::string, QuantLib::ext::shared_ptr<InterestRateIndex>>>& irIndices,
45 const std::vector<std::pair<std::string, QuantLib::ext::shared_ptr<ZeroInflationIndex>>>& infIndices,
46 const std::vector<std::string>& indices, const std::vector<std::string>& indexCurrencies,
47 const Handle<BlackScholesModelWrapper>& model,
48 const std::map<std::pair<std::string, std::string>, Handle<QuantExt::CorrelationTermStructure>>& correlations,
49 const McParams& mcparams, const std::set<Date>& simulationDates,
50 const IborFallbackConfig& iborFallbackConfig = IborFallbackConfig::defaultConfig());
51
52 // ctor for a single underlying
53 LocalVol(const Size paths, const std::string& currency, const Handle<YieldTermStructure>& curve,
54 const std::string& index, const std::string& indexCurrency, const Handle<BlackScholesModelWrapper>& model,
55 const McParams& mcparams, const std::set<Date>& simulationDates,
56 const IborFallbackConfig& iborFallbackConfig = IborFallbackConfig::defaultConfig());
57
58private:
59 // ModelImpl interface implementation
60 RandomVariable getFutureBarrierProb(const std::string& index, const Date& obsdate1, const Date& obsdate2,
61 const RandomVariable& barrier, const bool above) const override;
62
63 // BlackScholesBase interface implementation
64 void performCalculations() const override;
65
66 // helper method to populate path values
67 void populatePathValues(const Size nSamples, std::map<Date, std::vector<RandomVariable>>& paths,
68 const QuantLib::ext::shared_ptr<MultiPathVariateGeneratorBase>& gen, const Matrix& correlation,
69 const Matrix& sqrtCorr, const std::vector<Array>& deterministicDrift,
70 const std::vector<Size>& eqComIdx, const std::vector<Real>& t, const std::vector<Real>& dt,
71 const std::vector<Real>& sqrtdt) const;
72};
73
74} // namespace data
75} // namespace ore
black scholes model base class for n underlyings (fx, equity or commodity)
static IborFallbackConfig defaultConfig()
void performCalculations() const override
Definition: localvol.cpp:53
RandomVariable getFutureBarrierProb(const std::string &index, const Date &obsdate1, const Date &obsdate2, const RandomVariable &barrier, const bool above) const override
Definition: localvol.cpp:216
void populatePathValues(const Size nSamples, std::map< Date, std::vector< RandomVariable > > &paths, const QuantLib::ext::shared_ptr< MultiPathVariateGeneratorBase > &gen, const Matrix &correlation, const Matrix &sqrtCorr, const std::vector< Array > &deterministicDrift, const std::vector< Size > &eqComIdx, const std::vector< Real > &t, const std::vector< Real > &dt, const std::vector< Real > &sqrtdt) const
Definition: localvol.cpp:150
Real dt(const Date &d1, const Date &d2) const override
Definition: modelimpl.hpp:73
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23