Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
commodityschwartzmodeldata.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2022 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 model/commodityschwartzmodeldata.hpp
20 \brief COM component data for the cross asset model
21 \ingroup models
22*/
23
24#pragma once
25
26#include <vector>
27
28#include <ql/time/daycounters/actualactual.hpp>
29#include <ql/types.hpp>
30#include <ql/math/optimization/levenbergmarquardt.hpp>
31
33
38
39namespace ore {
40namespace data {
41using namespace QuantLib;
42
43//! COM Schwartz Model Parameters
44/*!
45 Specification for a COM model component with lognormal forwards in the Cross Asset LGM.
46 This class covers the CommoditySchwartz parametrization.
47 \ingroup models
48*/
50public:
51 //! Default constructor
53 QuantLib::ext::shared_ptr<OptimizationMethod> optimizationMethod = QuantLib::ext::make_shared<LevenbergMarquardt>(1E-8, 1E-8, 1E-8),
54 EndCriteria endCriteria = EndCriteria(1000, 500, 1E-8, 1E-8, 1E-8),
56 BlackCalibrationHelper::CalibrationErrorType calibrationErrorType = BlackCalibrationHelper::RelativePriceError)
59
60 //! Detailed constructor
62 bool calibrateSigma, Real sigma,
63 bool calibrateKappa, Real kappa,
64 std::vector<std::string> optionExpiries = std::vector<std::string>(),
65 std::vector<std::string> optionStrikes = std::vector<std::string>(),
66 QuantLib::ext::shared_ptr<OptimizationMethod> optimizationMethod = QuantLib::ext::make_shared<LevenbergMarquardt>(1E-8, 1E-8, 1E-8),
67 EndCriteria endCriteria = EndCriteria(1000, 500, 1E-8, 1E-8, 1E-8),
69 BlackCalibrationHelper::CalibrationErrorType calibrationErrorType = BlackCalibrationHelper::RelativePriceError,
70 bool driftFreeState = false)
77
78 //! \name Setters/Getters
79 //@{
80 std::string& name() { return name_; }
81 std::string& currency() { return ccy_; }
83 bool& calibrateSigma() { return calibrateSigma_; }
85 Real& sigmaValue() { return sigmaValue_; }
86 bool& calibrateKappa() { return calibrateKappa_; }
88 Real& kappaValue() { return kappaValue_; }
89 std::vector<std::string>& optionExpiries() { return optionExpiries_; }
90 std::vector<std::string>& optionStrikes() { return optionStrikes_; }
91 bool& driftFreeState() { return driftFreeState_; }
92 QuantLib::ext::shared_ptr<OptimizationMethod>& optimizationMethod() { return optimizationMethod_; }
93 EndCriteria& endCriteria() { return endCriteria_; }
95 BlackCalibrationHelper::CalibrationErrorType calibrationErrorType() { return calibrationErrorType_; }
96 //@}
97
98 //! \name Serialisation
99 //@{
100 void fromXML(XMLNode* node);
102 //@}
103
104 //! \name Operators
105 //@{
106 bool operator==(const CommoditySchwartzData& rhs);
107 bool operator!=(const CommoditySchwartzData& rhs);
108 //@}
109
110private:
111 std::string name_;
112 std::string ccy_;
114 bool calibrateSigma_ = false;
116 Real sigmaValue_ = 0.0;
117 bool calibrateKappa_ = false;
119 Real kappaValue_ = 0.0;
120 std::vector<std::string> optionExpiries_;
121 std::vector<std::string> optionStrikes_;
122 bool driftFreeState_ = false;
123 QuantLib::ext::shared_ptr<OptimizationMethod> optimizationMethod_;
124 EndCriteria endCriteria_;
126 BlackCalibrationHelper::CalibrationErrorType calibrationErrorType_ = BlackCalibrationHelper::RelativePriceError;
127};
128} // namespace data
129} // namespace ore
bool operator!=(const CommoditySchwartzData &rhs)
BlackCalibrationHelper::CalibrationErrorType calibrationErrorType_
CommoditySchwartzData(std::string name, std::string currency, CalibrationType calibrationType, bool calibrateSigma, Real sigma, bool calibrateKappa, Real kappa, std::vector< std::string > optionExpiries=std::vector< std::string >(), std::vector< std::string > optionStrikes=std::vector< std::string >(), QuantLib::ext::shared_ptr< OptimizationMethod > optimizationMethod=QuantLib::ext::make_shared< LevenbergMarquardt >(1E-8, 1E-8, 1E-8), EndCriteria endCriteria=EndCriteria(1000, 500, 1E-8, 1E-8, 1E-8), Constraint constraint=Constraint(), BlackCalibrationHelper::CalibrationErrorType calibrationErrorType=BlackCalibrationHelper::RelativePriceError, bool driftFreeState=false)
Detailed constructor.
std::vector< std::string > & optionStrikes()
CommoditySchwartzData(bool driftFreeState=false, QuantLib::ext::shared_ptr< OptimizationMethod > optimizationMethod=QuantLib::ext::make_shared< LevenbergMarquardt >(1E-8, 1E-8, 1E-8), EndCriteria endCriteria=EndCriteria(1000, 500, 1E-8, 1E-8, 1E-8), Constraint constraint=Constraint(), BlackCalibrationHelper::CalibrationErrorType calibrationErrorType=BlackCalibrationHelper::RelativePriceError)
Default constructor.
QuantLib::ext::shared_ptr< OptimizationMethod > optimizationMethod_
BlackCalibrationHelper::CalibrationErrorType calibrationErrorType()
std::vector< std::string > & optionExpiries()
bool operator==(const CommoditySchwartzData &rhs)
QuantLib::ext::shared_ptr< OptimizationMethod > & optimizationMethod()
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
Currency and instrument specific conventions/defaults.
Linear Gauss Markov model data.
@ data
Definition: log.hpp:77
Base Market class.
CalibrationType
Supported calibration types.
Definition: irmodeldata.hpp:46
ParamType
Supported calibration parameter type.
Definition: irmodeldata.hpp:35
Serializable Credit Default Swap.
Definition: namespaces.docs:23
XML utility functions.