net.finmath.montecarlo.templatemethoddesign.assetderivativevaluation
Class MonteCarloBlackScholesModel2
- java.lang.Object
-
- net.finmath.montecarlo.templatemethoddesign.LogNormalProcess
-
- net.finmath.montecarlo.templatemethoddesign.assetderivativevaluation.MonteCarloBlackScholesModel2
-
- All Implemented Interfaces:
- AssetModelMonteCarloSimulationInterface, MonteCarloSimulationInterface
public class MonteCarloBlackScholesModel2 extends LogNormalProcess implements AssetModelMonteCarloSimulationInterface
Monte Carlo simulation of a simple Black-Scholes model for a stock generated discrete process
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.finmath.montecarlo.templatemethoddesign.LogNormalProcess
LogNormalProcess.Scheme
-
-
Constructor Summary
Constructors Constructor and Description MonteCarloBlackScholesModel2(TimeDiscretizationInterface timeDiscretization, int numberOfPaths, double initialValue, double riskFreeRate, double volatility)Create a Monte-Carlo simulation using given time discretization.MonteCarloBlackScholesModel2(TimeDiscretizationInterface timeDiscretization, int numberOfPaths, double initialValue, double riskFreeRate, double volatility, int seed)Create a Monte-Carlo simulation using given time discretization.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description 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.RandomVariableInterfacegetDrift(int timeIndex, int componentIndex, RandomVariableInterface[] realizationAtTimeIndex, RandomVariableInterface[] realizationPredictor)RandomVariableInterfacegetFactorLoading(int timeIndex, int factor, int component, RandomVariableInterface[] realizationAtTimeIndex)This method should be overwritten and return the factor loading, i.e.RandomVariableInterface[]getInitialValue()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.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 riskFreeRate.doublegetVolatility()Returns the volatility.java.lang.StringtoString()-
Methods inherited from class net.finmath.montecarlo.templatemethoddesign.LogNormalProcess
getBrownianMotion, getDrift, getMonteCarloWeights, getNumberOfComponents, getNumberOfFactors, getNumberOfPaths, getProcessValue, getProcessValue, getScheme, getTime, getTimeDiscretization, getTimeIndex, setScheme
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.finmath.montecarlo.MonteCarloSimulationInterface
getMonteCarloWeights, getNumberOfPaths, getTime, getTimeDiscretization, getTimeIndex
-
-
-
-
Constructor Detail
-
MonteCarloBlackScholesModel2
public MonteCarloBlackScholesModel2(TimeDiscretizationInterface timeDiscretization, int numberOfPaths, double initialValue, double riskFreeRate, double volatility)
Create a Monte-Carlo simulation using given time discretization.- Parameters:
timeDiscretization- The time discretizationnumberOfPaths- The number of Monte-Carlo path to be usedinitialValue- Spot valueriskFreeRate- The risk free ratevolatility- The log volatility
-
MonteCarloBlackScholesModel2
public MonteCarloBlackScholesModel2(TimeDiscretizationInterface timeDiscretization, int numberOfPaths, double initialValue, double riskFreeRate, double volatility, int seed)
Create a Monte-Carlo simulation using given time discretization.- Parameters:
timeDiscretization- The time discretization.numberOfPaths- The number of Monte-Carlo path to be used.initialValue- Spot value.riskFreeRate- The risk free rate.volatility- The log volatility.seed- The seed for the random number generator.
-
-
Method Detail
-
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
-
getInitialValue
public RandomVariableInterface[] getInitialValue()
- Specified by:
getInitialValuein classLogNormalProcess- Returns:
- Returns the initialValue.
-
getDrift
public RandomVariableInterface getDrift(int timeIndex, int componentIndex, RandomVariableInterface[] realizationAtTimeIndex, RandomVariableInterface[] realizationPredictor)
- Specified by:
getDriftin classLogNormalProcess
-
getFactorLoading
public RandomVariableInterface getFactorLoading(int timeIndex, int factor, int component, RandomVariableInterface[] realizationAtTimeIndex)
Description copied from class:LogNormalProcessThis method should be overwritten and return the factor loading, i.e. the coeffient λ(i,j) such that
dS(j) = (...) dt + S(j) * (λ(1,j) dW(1) + ... + λ(m,j) dW(m))
in an m-factor model. Here j denotes index of the component of the resulting log-normal process and i denotes the index of the factor.Overwrite this method if you would like to implement a multi factor model.
- Specified by:
getFactorLoadingin classLogNormalProcess- Parameters:
timeIndex- The time index of the simulation time discretization.factor- The factor index.component- The component index.realizationAtTimeIndex- The realization at the current time index.- Returns:
- factor loading for given factor and component
-
getAssetValue
public RandomVariableInterface getAssetValue(int timeIndex, int assetIndex)
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
-
getAssetValue
public RandomVariableInterface getAssetValue(double time, int assetIndex)
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
-
getMonteCarloWeights
public RandomVariableInterface getMonteCarloWeights(double time)
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
-
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- 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.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getRiskFreeRate
public double getRiskFreeRate()
Returns the riskFreeRate.- Returns:
- The riskFreeRate.
-
getVolatility
public double getVolatility()
Returns the volatility.- Returns:
- The volatility.
-
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.
-
getCloneWithModifiedData
public AssetModelMonteCarloSimulationInterface getCloneWithModifiedData(java.util.Map<java.lang.String,java.lang.Object> dataModified)
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 :-)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG