Class HestonModel
- java.lang.Object
-
- net.finmath.montecarlo.model.AbstractProcessModel
-
- net.finmath.montecarlo.assetderivativevaluation.models.HestonModel
-
- All Implemented Interfaces:
ProcessModel
public class HestonModel extends AbstractProcessModel
This class implements a Heston Model, that is, it provides the drift and volatility specification and performs the calculation of the numeraire (consistent with the dynamics, i.e. the drift). The model is \[ dS(t) = r^{\text{c}} S(t) dt + \sqrt{V(t)} S(t) dW_{1}(t), \quad S(0) = S_{0}, \] \[ dV(t) = \kappa ( \theta - V(t) ) dt + \xi \sqrt{V(t)} dW_{2}(t), \quad V(0) = \sigma^2, \] \[ dW_{1} dW_{2} = \rho dt \] \[ dN(t) = r^{\text{d}} N(t) dt, \quad N(0) = N_{0}, \] where \( W \) is a Brownian motion. The class provides the model of (S,V) to anvia the specification of \( f_{1} = exp , f_{2} = identity \), \( \mu_{1} = r^{\text{c}} - \frac{1}{2} V^{+}(t) , \mu_{2} = \kappa ( \theta - V^{+}(t) ) \), \( \lambda_{1,1} = \sqrt{V^{+}(t)} , \lambda_{1,2} = 0 ,\lambda_{2,1} = \xi \sqrt{V^+(t)} \rho , \lambda_{2,2} = \xi \sqrt{V^+(t)} \sqrt{1-\rho^{2}} \), i.e., of the SDE \[ dX_{1} = \mu_{1} dt + \lambda_{1,1} dW_{1} + \lambda_{1,2} dW_{2}, \quad X_{1}(0) = \log(S_{0}), \] \[ dX_{2} = \mu_{2} dt + \lambda_{2,1} dW_{1} + \lambda_{2,2} dW_{2}, \quad X_{2}(0) = V_{0} = \sigma^2, \] with \( S = f_{1}(X_{1}) , V = f_{2}(X_{2}) \). SeeMonteCarloProcessMonteCarloProcessfor the notation. Here \( V^{+} \) denotes a truncated value of V. Different truncation schemes are available:FULL_TRUNCATION: \( V^{+} = max(V,0) \),REFLECTION: \( V^{+} = abs(V) \). The model allows to specify two independent rate for forwarding (\( r^{\text{c}} \)) and discounting (\( r^{\text{d}} \)). It thus allow for a simple modelling of a funding / collateral curve (via (\( r^{\text{d}} \)) and/or the specification of a dividend yield. The free parameters of this model are:- \( S_{0} \)
- spot - initial value of S
- \( r^{\text{c}} \)
- the risk free rate
- \( \sigma \)
- the initial volatility level
- \( r^{\text{d}} \)
- the discount rate
- \( \xi \)
- the volatility of volatility
- \( \theta \)
- the mean reversion level of the stochastic volatility
- \( \kappa \)
- the mean reversion speed of the stochastic volatility
- \( \rho \)
- the correlation of the Brownian drivers
- Version:
- 1.0
- Author:
- Christian Fries
- See Also:
The interface for numerical schemes.,The interface for models provinding parameters to numerical schemes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHestonModel.SchemeTruncation schemes to be used in the calculation of drift and diffusion coefficients.
-
Constructor Summary
Constructors Constructor Description HestonModel(double initialValue, double riskFreeRate, double volatility, double discountRate, double theta, double kappa, double xi, double rho, HestonModel.Scheme scheme)Create a Heston model.HestonModel(double initialValue, double riskFreeRate, double volatility, double discountRate, double theta, double kappa, double xi, double rho, HestonModel.Scheme scheme, RandomVariableFactory abstractRandomVariableFactory)Create a Heston model.HestonModel(double initialValue, double riskFreeRate, double volatility, double theta, double kappa, double xi, double rho, HestonModel.Scheme scheme)Create a Heston model.HestonModel(HestonModelDescriptor descriptor, HestonModel.Scheme scheme, RandomVariableFactory abstractRandomVariableFactory)Create the model from a descriptor.HestonModel(RandomVariable initialValue, DiscountCurve discountCurveForForwardRate, RandomVariable volatility, DiscountCurve discountCurveForDiscountRate, RandomVariable theta, RandomVariable kappa, RandomVariable xi, RandomVariable rho, HestonModel.Scheme scheme, RandomVariableFactory abstractRandomVariableFactory)Create a Heston model.HestonModel(RandomVariable initialValue, RandomVariable riskFreeRate, RandomVariable volatility, RandomVariable discountRate, RandomVariable theta, RandomVariable kappa, RandomVariable xi, RandomVariable rho, HestonModel.Scheme scheme, RandomVariableFactory abstractRandomVariableFactory)Create a Heston model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RandomVariableapplyStateSpaceTransform(int componentIndex, RandomVariable randomVariable)Applies the state space transform fi to the given state random variable such that Yi → fi(Yi) =: Xi.RandomVariableapplyStateSpaceTransformInverse(int componentIndex, RandomVariable randomVariable)HestonModelgetCloneWithModifiedData(Map<String,Object> dataModified)Returns a clone of this model where the specified properties have been modified.RandomVariable[]getDrift(int timeIndex, RandomVariable[] realizationAtTimeIndex, RandomVariable[] realizationPredictor)This method has to be implemented to return the drift, i.e.RandomVariable[]getFactorLoading(int timeIndex, int component, RandomVariable[] realizationAtTimeIndex)This method has to be implemented to return the factor loadings, i.e.RandomVariable[]getInitialState()Returns the initial value of the state variable of the process Y, not to be confused with the initial value of the model X (which is the state space transform applied to this state value.intgetNumberOfComponents()Returns the number of componentsRandomVariablegetNumeraire(double time)Return the numeraire at a given time index.RandomVariablegetRandomVariableForConstant(double value)Return a random variable initialized with a constant using the models random variable factory.RandomVariablegetRiskFreeRate()Returns the risk free rate parameter of this model.RandomVariablegetVolatility()Returns the volatility parameter of this model.StringtoString()-
Methods inherited from class net.finmath.montecarlo.model.AbstractProcessModel
getInitialValue, getMonteCarloWeights, getNumberOfFactors, getProcess, getProcessValue, getReferenceDate, getTime, getTimeDiscretization, getTimeIndex, setProcess
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.finmath.montecarlo.model.ProcessModel
getDrift, getFactorLoading, getInitialState, getNumeraire
-
-
-
-
Constructor Detail
-
HestonModel
public HestonModel(HestonModelDescriptor descriptor, HestonModel.Scheme scheme, RandomVariableFactory abstractRandomVariableFactory)
Create the model from a descriptor.- Parameters:
descriptor- A descriptor of the model.scheme- The scheme.abstractRandomVariableFactory- A random variable factory to be used for the parameters.
-
HestonModel
public HestonModel(RandomVariable initialValue, DiscountCurve discountCurveForForwardRate, RandomVariable volatility, DiscountCurve discountCurveForDiscountRate, RandomVariable theta, RandomVariable kappa, RandomVariable xi, RandomVariable rho, HestonModel.Scheme scheme, RandomVariableFactory abstractRandomVariableFactory)
Create a Heston model.- Parameters:
initialValue- \( S_{0} \) - spot - initial value of SdiscountCurveForForwardRate- the discount curve \( df^{\text{c}} \) used to calculate the risk free rate \( r^{\text{c}}(t_{i},t_{i+1}) = \frac{\ln(\frac{df^{\text{c}}(t_{i})}{df^{\text{c}}(t_{i+1})}}{t_{i+1}-t_{i}} \)volatility- \( \sigma \) the initial volatility leveldiscountCurveForDiscountRate- the discount curve \( df^{\text{d}} \) used to calculate the numeraire, \( r^{\text{d}}(t_{i},t_{i+1}) = \frac{\ln(\frac{df^{\text{d}}(t_{i})}{df^{\text{d}}(t_{i+1})}}{t_{i+1}-t_{i}} \)theta- \( \theta \) - the mean reversion level of the stochastic volatilitykappa- \( \kappa \) - the mean reversion speed of the stochastic volatilityxi- \( \xi \) - the volatility of volatilityrho- \( \rho \) - the correlation of the Brownian driversscheme- The truncation scheme, that is, either reflection (V → abs(V)) or truncation (V → max(V,0)).abstractRandomVariableFactory- The factory to be used to construct random variables.
-
HestonModel
public HestonModel(RandomVariable initialValue, RandomVariable riskFreeRate, RandomVariable volatility, RandomVariable discountRate, RandomVariable theta, RandomVariable kappa, RandomVariable xi, RandomVariable rho, HestonModel.Scheme scheme, RandomVariableFactory abstractRandomVariableFactory)
Create a Heston model.- Parameters:
initialValue- \( S_{0} \) - spot - initial value of SriskFreeRate- \( r^{\text{c}} \) - the risk free ratevolatility- \( \sigma \) the initial volatility leveldiscountRate- \( r^{\text{d}} \) - the discount ratetheta- \( \theta \) - the mean reversion level of the stochastic volatilitykappa- \( \kappa \) - the mean reversion speed of the stochastic volatilityxi- \( \xi \) - the volatility of volatilityrho- \( \rho \) - the correlation of the Brownian driversscheme- The truncation scheme, that is, either reflection (V → abs(V)) or truncation (V → max(V,0)).abstractRandomVariableFactory- The factory to be used to construct random variables.
-
HestonModel
public HestonModel(double initialValue, double riskFreeRate, double volatility, double discountRate, double theta, double kappa, double xi, double rho, HestonModel.Scheme scheme, RandomVariableFactory abstractRandomVariableFactory)Create a Heston model.- Parameters:
initialValue- Spot value.riskFreeRate- The risk free rate.volatility- The log volatility.discountRate- The discount rate used in the numeraire.theta- The longterm mean reversion level of V (a reasonable value is volatility*volatility).kappa- The mean reversion speed.xi- The volatility of the volatility (of V).rho- The instantaneous correlation of the Brownian drivers (aka leverage).scheme- The truncation scheme, that is, either reflection (V → abs(V)) or truncation (V → max(V,0)).abstractRandomVariableFactory- The factory to be used to construct random variables..
-
HestonModel
public HestonModel(double initialValue, double riskFreeRate, double volatility, double discountRate, double theta, double kappa, double xi, double rho, HestonModel.Scheme scheme)Create a Heston model.- Parameters:
initialValue- Spot value.riskFreeRate- The risk free rate.volatility- The log volatility.discountRate- The discount rate used in the numeraire.theta- The longterm mean reversion level of V (a reasonable value is volatility*volatility).kappa- The mean reversion speed.xi- The volatility of the volatility (of V).rho- The instantaneous correlation of the Brownian drivers (aka leverage).scheme- The truncation scheme, that is, either reflection (V → abs(V)) or truncation (V → max(V,0)).
-
HestonModel
public HestonModel(double initialValue, double riskFreeRate, double volatility, double theta, double kappa, double xi, double rho, HestonModel.Scheme scheme)Create a Heston model.- Parameters:
initialValue- Spot value.riskFreeRate- The risk free rate.volatility- The log volatility.theta- The longterm mean reversion level of V (a reasonable value is volatility*volatility).kappa- The mean reversion speed.xi- The volatility of the volatility (of V).rho- The instantaneous correlation of the Brownian drivers (aka leverage).scheme- The truncation scheme, that is, either reflection (V → abs(V)) or truncation (V → max(V,0)).
-
-
Method Detail
-
getInitialState
public RandomVariable[] getInitialState()
Description copied from interface:ProcessModelReturns the initial value of the state variable of the process Y, not to be confused with the initial value of the model X (which is the state space transform applied to this state value.- Returns:
- The initial value of the state variable of the process Y(t=0).
-
getDrift
public RandomVariable[] getDrift(int timeIndex, RandomVariable[] realizationAtTimeIndex, RandomVariable[] realizationPredictor)
Description copied from interface:ProcessModelThis method has to be implemented to return the drift, i.e. the coefficient vector
μ = (μ1, ..., μn) such that X = f(Y) and
dYj = μj dt + λ1,j dW1 + ... + λm,j dWm
in an m-factor model. Here j denotes index of the component of the resulting process. Since the model is provided only on a time discretization, the method may also (should try to) return the drift as \( \frac{1}{t_{i+1}-t_{i}} \int_{t_{i}}^{t_{i+1}} \mu(\tau) \mathrm{d}\tau \).- Parameters:
timeIndex- The time index (related to the model times discretization).realizationAtTimeIndex- The given realization at timeIndexrealizationPredictor- The given realization attimeIndex+1or null if no predictor is available.- Returns:
- The drift or average drift from timeIndex to timeIndex+1, i.e. \( \frac{1}{t_{i+1}-t_{i}} \int_{t_{i}}^{t_{i+1}} \mu(\tau) \mathrm{d}\tau \) (or a suitable approximation).
-
getFactorLoading
public RandomVariable[] getFactorLoading(int timeIndex, int component, RandomVariable[] realizationAtTimeIndex)
Description copied from interface:ProcessModelThis method has to be implemented to return the factor loadings, i.e. the coefficient vector
λj = (λ1,j, ..., λm,j) such that X = f(Y) and
dYj = μj dt + λ1,j dW1 + ... + λm,j dWm
in an m-factor model. Here j denotes index of the component of the resulting process.- Parameters:
timeIndex- The time index (related to the model times discretization).component- The index j of the driven component.realizationAtTimeIndex- The realization of X at the time corresponding to timeIndex (in order to implement local and stochastic volatlity models).- Returns:
- The factor loading for given factor and component.
-
applyStateSpaceTransform
public RandomVariable applyStateSpaceTransform(int componentIndex, RandomVariable randomVariable)
Description copied from interface:ProcessModelApplies the state space transform fi to the given state random variable such that Yi → fi(Yi) =: Xi.- Parameters:
componentIndex- The component index i.randomVariable- The state random variable Yi.- Returns:
- New random variable holding the result of the state space transformation.
-
applyStateSpaceTransformInverse
public RandomVariable applyStateSpaceTransformInverse(int componentIndex, RandomVariable randomVariable)
-
getNumeraire
public RandomVariable getNumeraire(double time)
Description copied from interface:ProcessModelReturn the numeraire at a given time index. Note: The random variable returned is a defensive copy and may be modified.- Parameters:
time- The time t for which the numeraire N(t) should be returned.- Returns:
- The numeraire at the specified time as
RandomVariableFromDoubleArray
-
getNumberOfComponents
public int getNumberOfComponents()
Description copied from interface:ProcessModelReturns the number of components- Returns:
- The number of components
-
getRandomVariableForConstant
public RandomVariable getRandomVariableForConstant(double value)
Description copied from interface:ProcessModelReturn a random variable initialized with a constant using the models random variable factory.- Parameters:
value- The constant value.- Returns:
- A new random variable initialized with a constant value.
-
getCloneWithModifiedData
public HestonModel getCloneWithModifiedData(Map<String,Object> dataModified)
Description copied from interface:ProcessModelReturns a clone of this model where the specified properties have been modified. Note that there is no guarantee that a model reacts on a specification of a properties in the parameter mapdataModified. If data is provided which is ignored by the model no exception may be thrown.- Parameters:
dataModified- Key-value-map of parameters to modify.- Returns:
- A clone of this model (or this model if no parameter was modified).
-
getRiskFreeRate
public RandomVariable getRiskFreeRate()
Returns the risk free rate parameter of this model.- Returns:
- Returns the riskFreeRate.
-
getVolatility
public RandomVariable getVolatility()
Returns the volatility parameter of this model.- Returns:
- Returns the volatility.
-
-