/usr/include/ql/models/equity/hestonmodel.hpp is in libquantlib0-dev 1.9.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Copyright (C) 2005 Klaus Spanderen
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it
under the terms of the QuantLib license. You should have received a
copy of the license along with this program; if not, please email
<quantlib-dev@lists.sf.net>. The license is also available online at
<http://quantlib.org/license.shtml>.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
/*! \file hestonmodel.hpp
\brief Heston model for the stochastic volatility of an asset
*/
#ifndef quantlib_heston_model_hpp
#define quantlib_heston_model_hpp
#include <ql/models/model.hpp>
#include <ql/processes/hestonprocess.hpp>
namespace QuantLib {
//! Heston model for the stochastic volatility of an asset
/*! References:
Heston, Steven L., 1993. A Closed-Form Solution for Options
with Stochastic Volatility with Applications to Bond and
Currency Options. The review of Financial Studies, Volume 6,
Issue 2, 327-343.
\test calibration is tested against known good values.
*/
class HestonModel : public CalibratedModel {
public:
HestonModel(const boost::shared_ptr<HestonProcess>& process);
// variance mean version level
Real theta() const { return arguments_[0](0.0); }
// variance mean reversion speed
Real kappa() const { return arguments_[1](0.0); }
// volatility of the volatility
Real sigma() const { return arguments_[2](0.0); }
// correlation
Real rho() const { return arguments_[3](0.0); }
// spot variance
Real v0() const { return arguments_[4](0.0); }
// underlying process
boost::shared_ptr<HestonProcess> process() const { return process_; }
class FellerConstraint;
protected:
void generateArguments();
boost::shared_ptr<HestonProcess> process_;
};
class HestonModel::FellerConstraint : public Constraint {
private:
class Impl : public Constraint::Impl {
public:
bool test(const Array& params) const {
const Real theta = params[0];
const Real kappa = params[1];
const Real sigma = params[2];
return (sigma >= 0.0 && sigma*sigma < 2.0*kappa*theta);
}
};
public:
FellerConstraint()
: Constraint(boost::shared_ptr<Constraint::Impl>(
new FellerConstraint::Impl)) {}
};
}
#endif
|