Class MonteCarloMultiAssetBlackScholesModel

    • Constructor Detail

      • MonteCarloMultiAssetBlackScholesModel

        public MonteCarloMultiAssetBlackScholesModel​(RandomVariableFactory randomVariableFactory,
                                                     BrownianMotion brownianMotion,
                                                     double[] initialValues,
                                                     double riskFreeRate,
                                                     double[][] factorLoadings)
        Create a Monte-Carlo simulation using given time discretization.
        Parameters:
        randomVariableFactory - The RandomVariableFactory used to construct model parameters as random variables.
        brownianMotion - The Brownian motion to be used for the numerical scheme.
        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.
      • MonteCarloMultiAssetBlackScholesModel

        public MonteCarloMultiAssetBlackScholesModel​(BrownianMotion 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​(TimeDiscretization 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.
      • MonteCarloMultiAssetBlackScholesModel

        public MonteCarloMultiAssetBlackScholesModel​(TimeDiscretization timeDiscretization,
                                                     int numberOfPaths,
                                                     int seed,
                                                     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.
        seed - The seed to be used.
        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: ProcessModel
        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.
        Specified by:
        getInitialState in interface ProcessModel
        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: ProcessModel
        This 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 \).
        Specified by:
        getDrift in interface ProcessModel
        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 timeIndex
        realizationPredictor - The given realization at timeIndex+1 or 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: ProcessModel
        This 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:
        getFactorLoading in interface ProcessModel
        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: ProcessModel
        Applies the state space transform fi to the given state random variable such that Yi → fi(Yi) =: Xi.
        Specified by:
        applyStateSpaceTransform in interface ProcessModel
        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: ProcessModel
        Applies the inverse state space transform f-1i to the given random variable such that Xi → f-1i(Xi) =: Yi.
        Specified by:
        applyStateSpaceTransformInverse in interface ProcessModel
        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: ProcessModel
        Return the numeraire at a given time index. Note: The random variable returned is a defensive copy and may be modified.
        Specified by:
        getNumeraire in interface ProcessModel
        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
      • getNumberOfComponents

        public int getNumberOfComponents()
        Description copied from interface: ProcessModel
        Returns the number of components
        Specified by:
        getNumberOfComponents in interface ProcessModel
        Returns:
        The number of components
      • getRiskFreeRate

        public double getRiskFreeRate()
        Returns the risk free rate parameter of this model.
        Returns:
        Returns the riskFreeRate.
      • getFactorLoadings

        public double[][] getFactorLoadings()
        Returns the factorLoadings parameters of this model.
        Returns:
        Returns the factorLoadings.
      • getVolatilities

        public double[] getVolatilities()
        Returns the volatility parameters of this model.
        Returns:
        Returns the volatilities.
      • getCorrelations

        public double[][] getCorrelations()
        Returns the volatility parameters of this model.
        Returns:
        Returns the volatilities.
      • getTime

        public double getTime​(int timeIndex)
        Description copied from interface: MonteCarloSimulationModel
        Returns the time for a given time index.
        Specified by:
        getTime in interface MonteCarloSimulationModel
        Parameters:
        timeIndex - Time index
        Returns:
        Returns the time for a given time index.
      • getNumberOfFactors

        public int getNumberOfFactors()
        Description copied from interface: ProcessModel
        Returns the number of factors m, i.e., the number of independent Brownian drivers.
        Specified by:
        getNumberOfFactors in interface ProcessModel
        Returns:
        The number of factors.