Module net.finmath.lib
Class MultiAssetBlackScholesModel
- java.lang.Object
-
- net.finmath.montecarlo.model.AbstractProcessModel
-
- net.finmath.montecarlo.assetderivativevaluation.models.MultiAssetBlackScholesModel
-
- All Implemented Interfaces:
ProcessModel
public class MultiAssetBlackScholesModel extends AbstractProcessModel
This class implements a multi-asset Black Scholes model providing anAbstractProcessModel. The class can be used with an EulerSchemeFromProcessModel to create a Monte-Carlo simulation. The model can be specified by general factor loadings, that is, in the form \[ dS_{i} = r S_{i} dt + S_{i} \sum_{j=0}^{m-1} f{i,j} dW_{j}, \quad S_{i}(0) = S_{i,0}, \] \[ dN = r N dt, \quad N(0) = N_{0}. \] Alternatively, the model can be specifies by providing volatilities and correlations from which the factor loadings \( f_{i,j} \) are derived such that \[ \sum_{k=0}^{m-1} f{i,k} f{j,k} = \sigma_{i} \sigma_{j} \rho_{i,j} \] such that the effective model is \[ dS_{i} = r S_{i} dt + \sigma_{i} S_{i} dW_{i}, \quad S_{i}(0) = S_{i,0}, \] \[ dN = r N dt, \quad N(0) = N_{0}, \] \[ dW_{i} dW_{j} = \rho_{i,j} dt, \] Note that in case the model is used with an EulerSchemeFromProcessModel, the BrownianMotion used can have a correlation, which alters the simulation (which is admissible). The specification above hold, provided that the BrownianMotion used has independent components. The class provides the model of \( S_{i} \) to anvia the specification of \( f = exp \), \( \mu_{i} = r - \frac{1}{2} \sigma_{i}^2 \), \( \lambda_{i,j} = \sigma_{i} g_{i,j} \), i.e., of the SDE \[ dX_{i} = \mu_{i} dt + \sum_{j=0}^{m-1} \lambda_{i,j} dW_{j}, \quad X_{i}(0) = \log(S_{i,0}), \] with \( S = f(X) \). SeeMonteCarloProcessMonteCarloProcessfor the notation.- Version:
- 1.1
- Author:
- Christian Fries
- See Also:
The interface for numerical schemes.,The interface for models provinding parameters to numerical schemes.
-
-
Constructor Summary
Constructors Constructor Description MultiAssetBlackScholesModel(double[] initialValues, double riskFreeRate, double[][] factorLoadings)Create a multi-asset Black-Scholes model.MultiAssetBlackScholesModel(double[] initialValues, double riskFreeRate, double[] volatilities, double[][] correlations)Create a multi-asset Black-Scholes model.MultiAssetBlackScholesModel(RandomVariableFactory randomVariableFactory, double[] initialValues, double riskFreeRate, double[][] factorLoadings)Create a multi-asset Black-Scholes model.MultiAssetBlackScholesModel(RandomVariableFactory randomVariableFactory, double[] initialValues, double riskFreeRate, double[] volatilities, double[][] correlations)Create a multi-asset Black-Scholes model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RandomVariableapplyStateSpaceTransform(MonteCarloProcess process, int timeIndex, int componentIndex, RandomVariable randomVariable)Applies the state space transform fi to the given state random variable such that Yi → fi(Yi) =: Xi.RandomVariableapplyStateSpaceTransformInverse(MonteCarloProcess process, int timeIndex, int componentIndex, RandomVariable randomVariable)Applies the inverse state space transform f-1i to the given random variable such that Xi → f-1i(Xi) =: Yi.MultiAssetBlackScholesModelgetCloneWithModifiedData(Map<String,Object> dataModified)Returns a clone of this model where the specified properties have been modified.double[][]getCorrelationMatrix()Returns the volatility parameters of this model.RandomVariable[]getDrift(MonteCarloProcess process, int timeIndex, RandomVariable[] realizationAtTimeIndex, RandomVariable[] realizationPredictor)This method has to be implemented to return the drift, i.e.RandomVariable[]getFactorLoading(MonteCarloProcess process, int timeIndex, int component, RandomVariable[] realizationAtTimeIndex)This method has to be implemented to return the factor loadings, i.e.double[][]getFactorLoadingMatrix()Returns the factorLoadings parameters of this model.RandomVariable[]getInitialState(MonteCarloProcess process)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 componentsintgetNumberOfFactors()Returns the number of factors m, i.e., the number of independent Brownian drivers.RandomVariablegetNumeraire(MonteCarloProcess process, 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.doublegetRiskFreeRate()Returns the risk free rate parameter of this model.double[]getVolatilityVector()Returns the volatility parameters of this model.StringtoString()-
Methods inherited from class net.finmath.montecarlo.model.AbstractProcessModel
getInitialValue, getReferenceDate
-
-
-
-
Constructor Detail
-
MultiAssetBlackScholesModel
public MultiAssetBlackScholesModel(RandomVariableFactory randomVariableFactory, double[] initialValues, double riskFreeRate, double[][] factorLoadings)
Create a multi-asset Black-Scholes model.- Parameters:
randomVariableFactory- The RandomVariableFactory used to construct model parameters as random variables.initialValues- Spot values.riskFreeRate- The risk free rate.factorLoadings- The matrix of factor loadings, where factorLoadings[underlyingIndex][factorIndex] is the coefficient of the Brownian driver factorIndex used for the underlying underlyingIndex.
-
MultiAssetBlackScholesModel
public MultiAssetBlackScholesModel(RandomVariableFactory randomVariableFactory, double[] initialValues, double riskFreeRate, double[] volatilities, double[][] correlations)
Create a multi-asset Black-Scholes model.- Parameters:
randomVariableFactory- The RandomVariableFactory used to construct model parameters as random variables.initialValues- Spot values.riskFreeRate- The risk free rate.volatilities- The log volatilities.correlations- A correlation matrix.
-
MultiAssetBlackScholesModel
public MultiAssetBlackScholesModel(double[] initialValues, double riskFreeRate, double[][] factorLoadings)Create a multi-asset Black-Scholes model.- Parameters:
initialValues- Spot values.riskFreeRate- The risk free rate.factorLoadings- The matrix of factor loadings, where factorLoadings[underlyingIndex][factorIndex] is the coefficient of the Brownian driver factorIndex used for the underlying underlyingIndex.
-
MultiAssetBlackScholesModel
public MultiAssetBlackScholesModel(double[] initialValues, double riskFreeRate, double[] volatilities, double[][] correlations)Create a multi-asset Black-Scholes model.- Parameters:
initialValues- Spot values.riskFreeRate- The risk free rate.volatilities- The log volatilities.correlations- A correlation matrix.
-
-
Method Detail
-
getInitialState
public RandomVariable[] getInitialState(MonteCarloProcess process)
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.- Parameters:
process- The discretization process generating this model. The process provides call backs for TimeDiscretization and allows calls to getProcessValue for timeIndices less or equal the given one.- Returns:
- The initial value of the state variable of the process Y(t=0).
-
getDrift
public RandomVariable[] getDrift(MonteCarloProcess process, 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:
process- The discretization process generating this model. The process provides call backs for TimeDiscretization and allows calls to getProcessValue for timeIndices less or equal the given one.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(MonteCarloProcess process, 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:
process- The discretization process generating this model. The process provides call backs for TimeDiscretization and allows calls to getProcessValue for timeIndices less or equal the given one.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(MonteCarloProcess process, int timeIndex, 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:
process- The discretization process generating this model. The process provides call backs for TimeDiscretization and allows calls to getProcessValue for timeIndices less or equal the given one.timeIndex- The time index (related to the model times discretization).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(MonteCarloProcess process, int timeIndex, int componentIndex, RandomVariable randomVariable)
Description copied from interface:ProcessModelApplies the inverse state space transform f-1i to the given random variable such that Xi → f-1i(Xi) =: Yi.- Parameters:
process- The discretization process generating this model. The process provides call backs for TimeDiscretization and allows calls to getProcessValue for timeIndices less or equal the given one.timeIndex- The time index (related to the model times discretization).componentIndex- The component index i.randomVariable- The state random variable Xi.- Returns:
- New random variable holding the result of the state space transformation.
-
getNumeraire
public RandomVariable getNumeraire(MonteCarloProcess process, 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:
process- The discretization process generating this model. The process provides call backs for TimeDiscretization and allows calls to getProcessValue for timeIndices less or equal the given one.time- The time t for which the numeraire N(t) should be returned.- Returns:
- The numeraire at the specified time as
RandomVariable
-
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.
-
getNumberOfComponents
public int getNumberOfComponents()
Description copied from interface:ProcessModelReturns the number of components- Returns:
- The number of components
-
getNumberOfFactors
public int getNumberOfFactors()
Description copied from interface:ProcessModelReturns the number of factors m, i.e., the number of independent Brownian drivers.- Returns:
- The number of factors.
-
getCloneWithModifiedData
public MultiAssetBlackScholesModel 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 double getRiskFreeRate()
Returns the risk free rate parameter of this model.- Returns:
- Returns the riskFreeRate.
-
getFactorLoadingMatrix
public double[][] getFactorLoadingMatrix()
Returns the factorLoadings parameters of this model.- Returns:
- Returns the factorLoadings.
-
getVolatilityVector
public double[] getVolatilityVector()
Returns the volatility parameters of this model.- Returns:
- Returns the volatilities.
-
getCorrelationMatrix
public double[][] getCorrelationMatrix()
Returns the volatility parameters of this model.- Returns:
- Returns the volatilities.
-
-