Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
commodityschwartzstateprocess.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 commodityschwartzstateprocess.hpp
20 \brief COM state process for the one-factor Schwartz model
21 \ingroup processes
22*/
23
24#ifndef quantext_com_schwartz_stateprocess_hpp
25#define quantext_com_schwartz_stateprocess_hpp
26
27#include <ql/stochasticprocess.hpp>
30
31namespace QuantExt {
32using namespace QuantLib;
33
34//! COM Schwartz model one-factor state process
35/*! \ingroup processes
36 */
38public:
39 CommoditySchwartzStateProcess(const QuantLib::ext::shared_ptr<CommoditySchwartzParametrization>& parametrization,
40 const CommoditySchwartzModel::Discretization discretization);
41 //! \name StochasticProcess interface
42 //@{
43 Real x0() const override { return 0.0; }
44 Real drift(Time t, Real x) const override;
45 Real diffusion(Time t, Real x) const override;
46 //@}
47
48 class ExactDiscretization : public StochasticProcess1D::discretization {
49 public:
50 ExactDiscretization(const QuantLib::ext::shared_ptr<CommoditySchwartzParametrization>& p) : p_(p) {}
51 Real drift(const StochasticProcess1D& p, Time t0, Real x0, Time dt) const override;
52 Real diffusion(const StochasticProcess1D& p, Time t0, Real x0, Time dt) const override;
53 Real variance(const StochasticProcess1D& p, Time t0, Real x0, Time dt) const override;
54
55 private:
56 const QuantLib::ext::shared_ptr<CommoditySchwartzParametrization> p_;
57 };
58
59private:
60 const QuantLib::ext::shared_ptr<CommoditySchwartzParametrization> p_;
61};
62
63} // namespace QuantExt
64
65#endif
Real drift(const StochasticProcess1D &p, Time t0, Real x0, Time dt) const override
const QuantLib::ext::shared_ptr< CommoditySchwartzParametrization > p_
Real diffusion(const StochasticProcess1D &p, Time t0, Real x0, Time dt) const override
ExactDiscretization(const QuantLib::ext::shared_ptr< CommoditySchwartzParametrization > &p)
Real variance(const StochasticProcess1D &p, Time t0, Real x0, Time dt) const override
COM Schwartz model one-factor state process.
const QuantLib::ext::shared_ptr< CommoditySchwartzParametrization > p_
Schwartz (1997) one-factor model of the commodity price termstructure.
Schwartz commodity model parametrization.