net.finmath.montecarlo.assetderivativevaluation
Class MonteCarloMultiAssetBlackScholesModel
- java.lang.Object
-
- net.finmath.montecarlo.model.AbstractModel
-
- net.finmath.montecarlo.assetderivativevaluation.MonteCarloMultiAssetBlackScholesModel
-
- All Implemented Interfaces:
- AssetModelMonteCarloSimulationInterface, AbstractModelInterface, MonteCarloSimulationInterface
public class MonteCarloMultiAssetBlackScholesModel extends AbstractModel implements AssetModelMonteCarloSimulationInterface
This class glues together aBlackScholeModeland a Monte-Carlo implementation of aAbstractProcessand forms a Monte-Carlo implementation of the Black-Scholes Model by implementingAssetModelMonteCarloSimulationInterface. The 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, \] 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 + \lambda_{i,j} dW, \quad X_{i}(0) = \log(S_{i,0}), \] with \( S = f(X) \). SeeAbstractProcessInterfaceAbstractProcessInterfacefor the notation.
-
-
Constructor Summary
Constructors Constructor and Description MonteCarloMultiAssetBlackScholesModel(BrownianMotionInterface brownianMotion, double[] initialValues, double riskFreeRate, double[] volatilities, double[][] correlations)Create a Monte-Carlo simulation using given time discretization.MonteCarloMultiAssetBlackScholesModel(TimeDiscretizationInterface timeDiscretization, int numberOfPaths, double[] initialValues, double riskFreeRate, double[] volatilities, double[][] correlations)Create a Monte-Carlo simulation using given time discretization.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description RandomVariableInterfaceapplyStateSpaceTransform(int componentIndex, RandomVariableInterface randomVariable)Applied the state space transform fi to the given state random variable such that Yi → fi(Yi) =: Xi.RandomVariableInterfacegetAssetValue(double time, int assetIndex)Returns the random variable representing the asset's value at a given time for a given asset.RandomVariableInterfacegetAssetValue(int timeIndex, int assetIndex)Returns the random variable representing the asset's value at a given time for a given asset.AssetModelMonteCarloSimulationInterfacegetCloneWithModifiedData(java.util.Map<java.lang.String,java.lang.Object> dataModified)Create a clone of this simulation modifying some of its properties (if any).AssetModelMonteCarloSimulationInterfacegetCloneWithModifiedSeed(int seed)Create a clone of the object implementingAssetModelMonteCarloSimulationInterfaceusing a different Monte-Carlo seed.RandomVariableInterface[]getDrift(int timeIndex, RandomVariableInterface[] realizationAtTimeIndex, RandomVariableInterface[] realizationPredictor)This method has to be implemented to return the drift, i.e.RandomVariableInterface[]getFactorLoading(int timeIndex, int component, RandomVariableInterface[] realizationAtTimeIndex)This method has to be implemented to return the factor loadings, i.e.RandomVariableInterface[]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.RandomVariableInterfacegetMonteCarloWeights(double time)This method returns the weights of a weighted Monte Carlo method (the probability density).intgetNumberOfAssets()Returns the number of asset price processes.intgetNumberOfComponents()Returns the number of componentsintgetNumberOfPaths()Returns the numberOfPaths.RandomVariableInterfacegetNumeraire(double time)Returns the numeraire associated with the valuation measure used by this model.RandomVariableInterfacegetNumeraire(int timeIndex)Returns the numeraire associated with the valuation measure used by this model.RandomVariableInterfacegetRandomVariableForConstant(double value)Returns a random variable which is initialized to a constant, but has exactly the same number of paths or discretization points as the ones used by thisMonteCarloSimulationInterface.doublegetRiskFreeRate()Returns the risk free rate parameter of this model.double[]getVolatilities()Returns the volatility parameters of this model.java.lang.StringtoString()-
Methods inherited from class net.finmath.montecarlo.model.AbstractModel
getInitialValue, getMonteCarloWeights, getNumberOfFactors, getProcess, getProcessValue, getTime, getTimeDiscretization, getTimeIndex, setProcess
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.finmath.montecarlo.MonteCarloSimulationInterface
getMonteCarloWeights, getTime, getTimeDiscretization, getTimeIndex
-
-
-
-
Constructor Detail
-
MonteCarloMultiAssetBlackScholesModel
public MonteCarloMultiAssetBlackScholesModel(BrownianMotionInterface brownianMotion, double[] initialValues, double riskFreeRate, double[] volatilities, double[][] correlations)
Create a Monte-Carlo simulation using given time discretization.- Parameters:
brownianMotion- The Brownian motion to be used for the numerical scheme.initialValues- Spot values.riskFreeRate- The risk free rate.volatilities- The log volatilities.correlations- A correlation matrix.
-
MonteCarloMultiAssetBlackScholesModel
public MonteCarloMultiAssetBlackScholesModel(TimeDiscretizationInterface timeDiscretization, int numberOfPaths, double[] initialValues, double riskFreeRate, double[] volatilities, double[][] correlations)
Create a Monte-Carlo simulation using given time discretization.- Parameters:
timeDiscretization- The time discretization.numberOfPaths- The number of Monte-Carlo path to be used.initialValues- Spot values.riskFreeRate- The risk free rate.volatilities- The log volatilities.correlations- A correlation matrix.
-
-
Method Detail
-
getInitialState
public RandomVariableInterface[] getInitialState()
Description copied from interface:AbstractModelInterfaceReturns 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.- Specified by:
getInitialStatein interfaceAbstractModelInterface- Returns:
- The initial value of the state variable of the process Y(t=0).
-
getDrift
public RandomVariableInterface[] getDrift(int timeIndex, RandomVariableInterface[] realizationAtTimeIndex, RandomVariableInterface[] realizationPredictor)
Description copied from interface:AbstractModelInterfaceThis 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.- Specified by:
getDriftin interfaceAbstractModelInterface- Parameters:
timeIndex- The time index (related to the model times discretization).realizationAtTimeIndex- The given realization at timeIndexrealizationPredictor- The given realization attimeIndex+1or null of no predictor is available.- Returns:
- The (average) drift from timeIndex to timeIndex+1
-
getFactorLoading
public RandomVariableInterface[] getFactorLoading(int timeIndex, int component, RandomVariableInterface[] realizationAtTimeIndex)
Description copied from interface:AbstractModelInterfaceThis 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.- Specified by:
getFactorLoadingin interfaceAbstractModelInterface- 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 RandomVariableInterface applyStateSpaceTransform(int componentIndex, RandomVariableInterface randomVariable)
Description copied from interface:AbstractModelInterfaceApplied the state space transform fi to the given state random variable such that Yi → fi(Yi) =: Xi.- Specified by:
applyStateSpaceTransformin interfaceAbstractModelInterface- Parameters:
componentIndex- The component index i.randomVariable- The state random variable Yi.- Returns:
- New random variable holding the result of the state space transformation.
-
getAssetValue
public RandomVariableInterface getAssetValue(double time, int assetIndex) throws CalculationException
Description copied from interface:AssetModelMonteCarloSimulationInterfaceReturns the random variable representing the asset's value at a given time for a given asset.- Specified by:
getAssetValuein interfaceAssetModelMonteCarloSimulationInterface- Parameters:
time- Simulation timeassetIndex- Index of the asset (0 for a single asset model)- Returns:
- The asset process as seen on simulation time
- Throws:
CalculationException- Thrown if the valuation fails, specific cause may be available via thecause()method.
-
getAssetValue
public RandomVariableInterface getAssetValue(int timeIndex, int assetIndex) throws CalculationException
Description copied from interface:AssetModelMonteCarloSimulationInterfaceReturns the random variable representing the asset's value at a given time for a given asset.- Specified by:
getAssetValuein interfaceAssetModelMonteCarloSimulationInterface- Parameters:
timeIndex- Index of simulation timeassetIndex- Index of the asset (0 for a single asset model)- Returns:
- The asset process as seen on simulation time
- Throws:
CalculationException- Thrown if the valuation fails, specific cause may be available via thecause()method.
-
getMonteCarloWeights
public RandomVariableInterface getMonteCarloWeights(double time) throws CalculationException
Description copied from interface:MonteCarloSimulationInterfaceThis method returns the weights of a weighted Monte Carlo method (the probability density).- Specified by:
getMonteCarloWeightsin interfaceMonteCarloSimulationInterface- Parameters:
time- Time at which the process should be observed- Returns:
- A vector of positive weights which sums up to one
- Throws:
CalculationException- Thrown if the valuation fails, specific cause may be available via thecause()method.
-
getNumeraire
public RandomVariableInterface getNumeraire(int timeIndex)
Description copied from interface:AssetModelMonteCarloSimulationInterfaceReturns the numeraire associated with the valuation measure used by this model.- Specified by:
getNumerairein interfaceAssetModelMonteCarloSimulationInterface- Parameters:
timeIndex- The time index (associated with this models time discretization).- Returns:
- The numeraire associated with the valuation measure used by this model.
-
getNumeraire
public RandomVariableInterface getNumeraire(double time)
Description copied from interface:AssetModelMonteCarloSimulationInterfaceReturns the numeraire associated with the valuation measure used by this model.- Specified by:
getNumerairein interfaceAssetModelMonteCarloSimulationInterface- Specified by:
getNumerairein interfaceAbstractModelInterface- Parameters:
time- The time for which the numeraire is requested.- Returns:
- The numeraire associated with the valuation measure used by this model.
-
getRandomVariableForConstant
public RandomVariableInterface getRandomVariableForConstant(double value)
Description copied from interface:MonteCarloSimulationInterfaceReturns a random variable which is initialized to a constant, but has exactly the same number of paths or discretization points as the ones used by thisMonteCarloSimulationInterface.- Specified by:
getRandomVariableForConstantin interfaceMonteCarloSimulationInterface- Parameters:
value- The constant value to be used for initialized the random variable.- Returns:
- A new random variable.
-
getNumberOfComponents
public int getNumberOfComponents()
Description copied from interface:AbstractModelInterfaceReturns the number of components- Specified by:
getNumberOfComponentsin interfaceAbstractModelInterface- Returns:
- The number of components
-
getNumberOfAssets
public int getNumberOfAssets()
Description copied from interface:AssetModelMonteCarloSimulationInterfaceReturns the number of asset price processes.- Specified by:
getNumberOfAssetsin interfaceAssetModelMonteCarloSimulationInterface- Returns:
- The number of asset price processes
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getRiskFreeRate
public double getRiskFreeRate()
Returns the risk free rate parameter of this model.- Returns:
- Returns the riskFreeRate.
-
getVolatilities
public double[] getVolatilities()
Returns the volatility parameters of this model.- Returns:
- Returns the volatilities.
-
getNumberOfPaths
public int getNumberOfPaths()
Description copied from interface:MonteCarloSimulationInterfaceReturns the numberOfPaths.- Specified by:
getNumberOfPathsin interfaceMonteCarloSimulationInterface- Returns:
- The number of paths.
- See Also:
AbstractProcessInterface.getNumberOfPaths()
-
getCloneWithModifiedData
public AssetModelMonteCarloSimulationInterface getCloneWithModifiedData(java.util.Map<java.lang.String,java.lang.Object> dataModified) throws CalculationException
Description copied from interface:AssetModelMonteCarloSimulationInterfaceCreate a clone of this simulation modifying some of its properties (if any).- Specified by:
getCloneWithModifiedDatain interfaceAssetModelMonteCarloSimulationInterface- Specified by:
getCloneWithModifiedDatain interfaceMonteCarloSimulationInterface- Parameters:
dataModified- The data which should be changed in the new model- Returns:
- Returns a clone of this model, with some data modified (then it is no longer a clone :-)
- Throws:
CalculationException- Thrown if the valuation fails, specific cause may be available via thecause()method.
-
getCloneWithModifiedSeed
public AssetModelMonteCarloSimulationInterface getCloneWithModifiedSeed(int seed)
Description copied from interface:AssetModelMonteCarloSimulationInterfaceCreate a clone of the object implementingAssetModelMonteCarloSimulationInterfaceusing a different Monte-Carlo seed.- Specified by:
getCloneWithModifiedSeedin interfaceAssetModelMonteCarloSimulationInterface- Parameters:
seed- The seed of the underlying random number generator.- Returns:
- Returns a clone of this model except for a modified Monte-Carlo seed.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG