Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
blackscholes.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/blackscholes.hpp
20 \brief black scholes model for n underlyings (fx, equity or commodity)
21 \ingroup utilities
22*/
23
24#pragma once
25
27
29
30namespace ore {
31namespace data {
32
34public:
35 /* ctor for multiple underlyings, see BlackScholesBase, plus:
36 - processes: hold spot, rate and div ts and vol for each given index
37 - we assume that the given correlations are constant and read the value only at t = 0
38 - calibration strikes are given as a map indexName => strike, if an index is missing in this map, the calibration
39 strike will be atmf */
41 const Size paths, const std::vector<std::string>& currencies,
42 const std::vector<Handle<YieldTermStructure>>& curves, const std::vector<Handle<Quote>>& fxSpots,
43 const std::vector<std::pair<std::string, QuantLib::ext::shared_ptr<InterestRateIndex>>>& irIndices,
44 const std::vector<std::pair<std::string, QuantLib::ext::shared_ptr<ZeroInflationIndex>>>& infIndices,
45 const std::vector<std::string>& indices, const std::vector<std::string>& indexCurrencies,
46 const Handle<BlackScholesModelWrapper>& model,
47 const std::map<std::pair<std::string, std::string>, Handle<QuantExt::CorrelationTermStructure>>& correlations,
48 const McParams& mcParams, const std::set<Date>& simulationDates,
49 const IborFallbackConfig& iborFallbackConfig = IborFallbackConfig::defaultConfig(),
50 const std::string& calibration = "ATM",
51 const std::map<std::string, std::vector<Real>>& calibrationStrikes = {});
52
53 // ctor for one underlying
54 BlackScholes(const Size paths, const std::string& currency, const Handle<YieldTermStructure>& curve,
55 const std::string& index, const std::string& indexCurrency,
56 const Handle<BlackScholesModelWrapper>& model, const McParams& mcParams,
57 const std::set<Date>& simulationDates,
58 const IborFallbackConfig& iborFallbackConfig = IborFallbackConfig::defaultConfig(),
59 const std::string& calibration = "ATM", const std::vector<Real>& calibrationStrikes = {});
60
61private:
62 // ModelImpl interface implementation
63 RandomVariable getFutureBarrierProb(const std::string& index, const Date& obsdate1, const Date& obsdate2,
64 const RandomVariable& barrier, const bool above) const override;
65 // BlackScholesBase interface implementation
66 void performCalculations() const override;
67
68 void populatePathValues(const Size nSamples, std::map<Date, std::vector<RandomVariable>>& paths,
69 const QuantLib::ext::shared_ptr<MultiPathVariateGeneratorBase>& gen,
70 const std::vector<Array>& drift, const std::vector<Matrix>& sqrtCov) const;
71 // covariance per effective simulation date
72 mutable std::vector<Matrix> covariance_;
73
74 // the calibration to use, ATM or Deal
75 const std::string calibration_;
76
77 // map indexName => calibration strike (for missing indices we'll assume atmf)
78 const std::map<std::string, std::vector<Real>> calibrationStrikes_;
79};
80
81} // namespace data
82} // namespace ore
black scholes model base class for n underlyings (fx, equity or commodity)
void performCalculations() const override
RandomVariable getFutureBarrierProb(const std::string &index, const Date &obsdate1, const Date &obsdate2, const RandomVariable &barrier, const bool above) const override
void populatePathValues(const Size nSamples, std::map< Date, std::vector< RandomVariable > > &paths, const QuantLib::ext::shared_ptr< MultiPathVariateGeneratorBase > &gen, const std::vector< Array > &drift, const std::vector< Matrix > &sqrtCov) const
std::vector< Matrix > covariance_
const std::map< std::string, std::vector< Real > > calibrationStrikes_
const std::string calibration_
static IborFallbackConfig defaultConfig()
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23