WebCab Options and Futures Demo
v2.5
(J2SE Edition)

webcab.lib.finance.options.exotic
Class MonteCarlo

java.lang.Object
  |
  +--webcab.lib.finance.options.exotic.MonteCarlo
All Implemented Interfaces:
Serializable

public class MonteCarlo
extends Object
implements Serializable

This class evaluates the price and Greeks of Asian and Lookback of Exotic Options in accordance with the Black-Scholes model using Monte Carlo tecnhiques.

Overview

The Monti-Carlo approach can be applied to any options contract for which the payoff function can be specified. With the classical Black-Scholes model the payoff function is the only ingredient required in specifying an options contract. There are other contract parameters that are not included in the payoff, such as updating formulae used in the definition strongly path dependent options such as Asian options. But these parameters will be supplied directly to the method as parameters. The payoff function, on the other hand, must be set prior to calling any of the class's methods.

Remarks:

Note: The Programmer's Guide chapter within the accompanying PDF documentation offers details and examples concerning the passing of functions, in particular the payoff function to the class methods.

See Also:
Serialized Form

Constructor Summary
MonteCarlo()
          Creates a new MonteCarlo instance without registering the payoff function.
MonteCarlo(PayoffFunction instanceOfPayoffFunction)
          Creates a new MonteCarlo instance and submits the payoff function.
 
Method Summary
 double multiMonteCarlo(int random_walks, int exotic_type, Date evaluationDate, Date maturityDate, double[] asset_prices, int number_assets, double[] dividends, double interest, double[] volatility, double[][] correlation, int time_steps, BusinessCalendar businessCalendar)
          Calcualtes the present value of a multi-asset European Asian or Lookback Exotic options of Asian or Lookbackup type in accordance with the Black-Scholes model via Monte Carlo simulation.
 double multiMonteCarlo(int random_walks, int exotic_type, double time2Maturity, double[] asset_prices, int number_assets, double[] dividends, double interest, double[] volatility, double[][] correlation, int time_steps)
          Calcualtes the present value of a multi-asset European Asian or Lookback Exotic options of Asian or Lookbackup type in accordance with the Black-Scholes model via Monte Carlo simulation.
 double multiMonteCarloWithErrorControl(int random_walks, int exotic_type, Date evaluationDate, Date maturityDate, double[] asset_prices, int number_assets, double[] dividends, double interest, double[] volatility, double[][] correlation, int time_steps, double confidenceLevel, double maxRelativeError, BusinessCalendar businessCalendar)
          Calculates the present value of a multi-asset European Asian or Lookback Exotic options in accordance with the Black-Scholes model via Monte Carlo simulation, keeping the error within specified bounds.
 double multiMonteCarloWithErrorControl(int random_walks, int exotic_type, double time2Maturity, double[] asset_prices, int number_assets, double[] dividends, double interest, double[] volatility, double[][] correlation, int time_steps, double confidenceLevel, double maxRelativeError)
          Calculates the present value of a multi-asset European Asian or Lookback Exotic options in accordance with the Black-Scholes model via Monte Carlo simulation, keeping the error within specified bounds.
 void setPayoffFunction(PayoffFunction instanceOfPayoffFunction)
          Submits a new payoff function (i.e.
 double singleMonteCarlo(int random_walks, int exotic_type, Date evaluationDate, Date maturityDate, double asset_price, double dividend, double interest, double volatility, int time_steps, BusinessCalendar businessCalendar)
          Evaluates the present value of a single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation.
 double singleMonteCarlo(int random_walks, int exotic_type, double time2Maturity, double asset_price, double dividend, double interest, double volatility, int time_steps)
          Evaluates the present value of a single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation.
 double singleMonteCarloDelta(int random_walks, int exotic_type, Date evaluationDate, Date maturityDate, double asset_price, double shift_size, double dividend, double interest, double volatility, int time_steps, BusinessCalendar businessCalendar)
          Evaluates the Delta of an single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation.
 double singleMonteCarloDelta(int random_walks, int exotic_type, double time2Maturity, double asset_price, double shift_size, double dividend, double interest, double volatility, int time_steps)
          Evaluates the Delta of an single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation.
 double singleMonteCarloRho(int random_walks, int exotic_type, Date evaluationDate, Date maturityDate, double asset_price, double dividend, double interest, double shift_size, double volatility, int time_steps, BusinessCalendar businessCalendar)
          Evaluates the Rho of an single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation.
 double singleMonteCarloRho(int random_walks, int exotic_type, double time2Maturity, double asset_price, double dividend, double interest, double shift_size, double volatility, int time_steps)
          Evaluates the Rho of an single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation.
 double singleMonteCarloTheta(int random_walks, int exotic_type, Date evaluationDate, Date maturityDate, double shift_size, double asset_price, double dividend, double interest, double volatility, int time_steps, BusinessCalendar businessCalendar)
          Evaluates the Theta of an single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation.
 double singleMonteCarloTheta(int random_walks, int exotic_type, double time2Maturity, double shift_size, double asset_price, double dividend, double interest, double volatility, int time_steps)
          Evaluates the Theta of an single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation.
 double singleMonteCarloVega(int random_walks, int exotic_type, Date evaluationDate, Date maturityDate, double asset_price, double dividend, double interest, double volatility, double shift_size, int time_steps, BusinessCalendar businessCalendar)
          Evaluates the Vega of an single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation.
 double singleMonteCarloVega(int random_walks, int exotic_type, double time2Maturity, double asset_price, double dividend, double interest, double volatility, double shift_size, int time_steps)
          Evaluates the Vega of an single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation.
 double singleMonteCarloWithErrorControl(int random_walks, int exotic_type, Date evaluationDate, Date maturityDate, double asset_price, double dividend, double interest, double volatility, int time_steps, double confidenceLevel, double maxRelativeError, BusinessCalendar businessCalendar)
          Evaluates present value of a single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation and keeps the error within specified bounds.
 double singleMonteCarloWithErrorControl(int random_walks, int exotic_type, double time2Maturity, double asset_price, double dividend, double interest, double volatility, int time_steps, double confidenceLevel, double maxRelativeError)
          Evaluates present value of a single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation and keeps the error within specified bounds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MonteCarlo

public MonteCarlo()
Creates a new MonteCarlo instance without registering the payoff function. Before submitting this function using the corresponding method you will not be able to properly use any other method.


MonteCarlo

public MonteCarlo(PayoffFunction instanceOfPayoffFunction)
Creates a new MonteCarlo instance and submits the payoff function.

Method Detail

setPayoffFunction

public void setPayoffFunction(PayoffFunction instanceOfPayoffFunction)
                       throws MonteCarloDemoException
Submits a new payoff function (i.e. PayoffFunction) to the MonteCarlo instance, by either replacing the previous payoff function specified, or by replacing the payoff function sent at creation time.

MonteCarloDemoException

singleMonteCarlo

public double singleMonteCarlo(int random_walks,
                               int exotic_type,
                               Date evaluationDate,
                               Date maturityDate,
                               double asset_price,
                               double dividend,
                               double interest,
                               double volatility,
                               int time_steps,
                               BusinessCalendar businessCalendar)
                        throws ExoticOptionsException,
                               MonteCarloDemoException
Evaluates the present value of a single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation.

Supported Options

Four types of exotic options of European type are supported:

Parameters:
exotic_type - this parameter specifies the type of exotic (ASIAN_ARITHMETIC, ASIAN_GEOMETRIC, LOOKBACK_MAX or LOOKBACK_MIN). If you want to evaluate an option which is not strongly path dependent then set exotic_type to NON_SPD
asset_price - the current price of the asset
dividend - the continuous dividend yield which the underlying asset pays
interest - the continuously compounded risk-free interest rate in the domestic currency
volatility - the volatility (in years) of the asset price
time_steps - the total number of time intervals which the time from now until the expiry time is divided into
random_walks - the number of Monte-Carlo simulations that is performed before the average of the results is returned
evaluationDate - the date when the zero rate of the bond is being evaluated
maturityDate - the date when the bond matures
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
Returns:
the present value of the option
ExoticOptionsException
MonteCarloDemoException

singleMonteCarlo

public double singleMonteCarlo(int random_walks,
                               int exotic_type,
                               double time2Maturity,
                               double asset_price,
                               double dividend,
                               double interest,
                               double volatility,
                               int time_steps)
                        throws ExoticOptionsException,
                               MonteCarloDemoException
Evaluates the present value of a single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation.

Supported Options

Four types of exotic options of European type are supported:

Parameters:
exotic_type - this parameter specifies the type of exotic (ASIAN_ARITHMETIC, ASIAN_GEOMETRIC, LOOKBACK_MAX or LOOKBACK_MIN). If you want to evaluate an option which is not strongly path dependent then set exotic_type to NON_SPD
time2Maturity - the remaining time (in years) until the contract matures
asset_price - the current price of the asset
dividend - the continuous dividend yield which the underlying asset pays
interest - the continuously compounded risk-free interest rate in the domestic currency
volatility - the volatility (in years) of the asset price
time_steps - the total number of time intervals which the time from now until the expiry time is divided into
random_walks - the number of Monte-Carlo simulations that is performed before the average of the results is returned
Returns:
the present value of the option
ExoticOptionsException
MonteCarloDemoException

singleMonteCarloDelta

public double singleMonteCarloDelta(int random_walks,
                                    int exotic_type,
                                    Date evaluationDate,
                                    Date maturityDate,
                                    double asset_price,
                                    double shift_size,
                                    double dividend,
                                    double interest,
                                    double volatility,
                                    int time_steps,
                                    BusinessCalendar businessCalendar)
                             throws ExoticOptionsException,
                                    MonteCarloDemoException
Evaluates the Delta of an single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation. An Options delta is the rate of change of the options value with respect to changes in the underlying assets price.

Supported Options

We methods allows us to evaluate of the Delta of one of the four types of exotic options of European type:

Remark: The Delta is the derivative of the price function which respect to the underlying asset. We have approximated the derivative at the given point by using the central differencing improvements or equivalently Ridders' algorithm with one iteration.

Parameters:
exotic_type - this parameter specifies the type of exotic (ASIAN_ARITHMETIC, ASIAN_GEOMETRIC, LOOKBACK_MAX or LOOKBACK_MIN). If you want to evaluate an option which is not strongly path dependent then set exotic_type to NON_SPD
asset_price - the current price of the asset
shift_size - the size of the shift of the asset price (up and down) from which the derivative at the present point will be evaluated. A reasonable value for this parameter is 0.01.
dividend - the continuous dividend yield which the underlying asset pays
interest - the risk-free interest rate in the domestic currency
volatility - the volatility (in years) of the asset price
time_steps - the total number of time intervals which the time from now until the expiry time is divided into
random_walks - the number of Monte-Carlo simulations that is performed before the average of the results is returned
evaluationDate - the date when the zero rate of the bond is being evaluated
maturityDate - the date when the bond matures
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
Returns:
the delta of the Exotic option at the present point in time
ExoticOptionsException
MonteCarloDemoException

singleMonteCarloDelta

public double singleMonteCarloDelta(int random_walks,
                                    int exotic_type,
                                    double time2Maturity,
                                    double asset_price,
                                    double shift_size,
                                    double dividend,
                                    double interest,
                                    double volatility,
                                    int time_steps)
                             throws ExoticOptionsException,
                                    MonteCarloDemoException
Evaluates the Delta of an single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation. An Options delta is the rate of change of the options value with respect to changes in the underlying assets price.

Supported Options

We methods allows us to evaluate of the Delta of one of the four types of exotic options of European type:

Remark: The Delta is the derivative of the price function which respect to the underlying asset. We have approximated the derivative at the given point by using the central differencing improvements or equivalently Ridders' algorithm with one iteration.

Parameters:
exotic_type - this parameter specifies the type of exotic (ASIAN_ARITHMETIC, ASIAN_GEOMETRIC, LOOKBACK_MAX or LOOKBACK_MIN). If you want to evaluate an option which is not strongly path dependent then set exotic_type to NON_SPD
time2Maturity - the remaining time (in years) until the contract matures
asset_price - the current price of the asset
shift_size - the size of the shift of the asset price (up and down) from which the derivative at the present point will be evaluated. A reasonable value for this parameter is 0.01.
dividend - the continuous dividend yield which the underlying asset pays
interest - the risk-free interest rate in the domestic currency
volatility - the volatility (in years) of the asset price
time_steps - the total number of time intervals which the time from now until the expiry time is divided into
random_walks - the number of Monte-Carlo simulations that is performed before the average of the results is returned
Returns:
the delta of the Exotic option at the present point in time
ExoticOptionsException
MonteCarloDemoException

singleMonteCarloVega

public double singleMonteCarloVega(int random_walks,
                                   int exotic_type,
                                   Date evaluationDate,
                                   Date maturityDate,
                                   double asset_price,
                                   double dividend,
                                   double interest,
                                   double volatility,
                                   double shift_size,
                                   int time_steps,
                                   BusinessCalendar businessCalendar)
                            throws ExoticOptionsException,
                                   MonteCarloDemoException
Evaluates the Vega of an single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation. Vega is the rate of change of the options value with respect to the underlying assets volatility.

Supported Options

This method allows us to evaluate of the Vega of one of the four types of exotic options of European type:

Remark: The Vega is the derivative of the price function which respect to volatility. We have approximated the derivative at the given point by using the central differencing improvements or equivalently Ridders' algorithm with one iteration.

Parameters:
exotic_type - this parameter specifies the type of exotic (ASIAN_ARITHMETIC, ASIAN_GEOMETRIC, LOOKBACK_MAX or LOOKBACK_MIN). If you want to evaluate an option which is not strongly path dependent then set exotic_type to NON_SPD
asset_price - the current price of the asset
dividend - the continuous dividend yield which the underlying asset pays
interest - the continuously compounded risk-free interest rate in the domestic currency
volatility - the volatility (in years) of the asset price
shift_size - the size of the shift of the volatility (up and down) from which the derivative at the present point will be evaluated. A reasonable value for this parameter is 0.01.
time_steps - the total number of time intervals which the time from now until the expiry time is divided into
random_walks - the number of Monte-Carlo simulations that is performed before the average of the results is returned
evaluationDate - the date when the zero rate of the bond is being evaluated
maturityDate - the date when the bond matures
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
Returns:
the delta of the Exotic option at the present point in time
ExoticOptionsException
MonteCarloDemoException

singleMonteCarloVega

public double singleMonteCarloVega(int random_walks,
                                   int exotic_type,
                                   double time2Maturity,
                                   double asset_price,
                                   double dividend,
                                   double interest,
                                   double volatility,
                                   double shift_size,
                                   int time_steps)
                            throws ExoticOptionsException,
                                   MonteCarloDemoException
Evaluates the Vega of an single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation. Vega is the rate of change of the options value with respect to the underlying assets volatility.

Supported Options

This method allows us to evaluate of the Vega of one of the four types of exotic options of European type:

Remark: The Vega is the derivative of the price function which respect to volatility. We have approximated the derivative at the given point by using the central differencing improvements or equivalently Ridders' algorithm with one iteration.

Parameters:
exotic_type - this parameter specifies the type of exotic (ASIAN_ARITHMETIC, ASIAN_GEOMETRIC, LOOKBACK_MAX or LOOKBACK_MIN). If you want to evaluate an option which is not strongly path dependent then set exotic_type to NON_SPD
time2Maturity - the remaining time (in years) until the contract matures
asset_price - the current price of the asset
dividend - the continuous dividend yield which the underlying asset pays
interest - the continuously compounded risk-free interest rate in the domestic currency
volatility - the volatility (in years) of the asset price
shift_size - the size of the shift of the volatility (up and down) from which the derivative at the present point will be evaluated. A reasonable value for this parameter is 0.01.
time_steps - the total number of time intervals which the time from now until the expiry time is divided into
random_walks - the number of Monte-Carlo simulations that is performed before the average of the results is returned
Returns:
the delta of the Exotic option at the present point in time
ExoticOptionsException
MonteCarloDemoException

singleMonteCarloRho

public double singleMonteCarloRho(int random_walks,
                                  int exotic_type,
                                  Date evaluationDate,
                                  Date maturityDate,
                                  double asset_price,
                                  double dividend,
                                  double interest,
                                  double shift_size,
                                  double volatility,
                                  int time_steps,
                                  BusinessCalendar businessCalendar)
                           throws ExoticOptionsException,
                                  MonteCarloDemoException
Evaluates the Rho of an single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation. The Rho is the rate of change of the options value with respect to interest rates.

Supported Options

This method allows us to evaluate of the Rho of one of the four types of exotic options of European type:

Remark: The Rho is the derivative of the price function which respect to interest rate. We have approximated the derivative at the given point by using the central differencing improvements or equivalently Ridders' algorithm of one iteration.

Parameters:
exotic_type - this parameter specifies the type of exotic (ASIAN_ARITHMETIC, ASIAN_GEOMETRIC, LOOKBACK_MAX or LOOKBACK_MIN). If you want to evaluate an option which is not strongly path dependent then set exotic_type to NON_SPD
asset_price - the current price of the asset
dividend - the continuous dividend yield which the underlying asset pays
interest - the continuously compounded risk-free interest rate in the domestic currency
shift_size - the size of the shift of the interest rate (up and down) from which the derivative at the present point will be evaluated. A reasonable value for this parameter is 0.01.
volatility - the volatility (in years) of the asset price
time_steps - the total number of time intervals which the time from now until the expiry time is divided into
random_walks - the number of Monte-Carlo simulations that is performed before the average of the results is returned
evaluationDate - the date when the zero rate of the bond is being evaluated
maturityDate - the date when the bond matures
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
Returns:
the delta of the Exotic option at the present point in time
ExoticOptionsException
MonteCarloDemoException

singleMonteCarloRho

public double singleMonteCarloRho(int random_walks,
                                  int exotic_type,
                                  double time2Maturity,
                                  double asset_price,
                                  double dividend,
                                  double interest,
                                  double shift_size,
                                  double volatility,
                                  int time_steps)
                           throws ExoticOptionsException,
                                  MonteCarloDemoException
Evaluates the Rho of an single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation. The Rho is the rate of change of the options value with respect to interest rates.

Supported Options

This method allows us to evaluate of the Rho of one of the four types of exotic options of European type:

Remark: The Rho is the derivative of the price function which respect to interest rate. We have approximated the derivative at the given point by using the central differencing improvements or equivalently Ridders' algorithm of one iteration.

Parameters:
exotic_type - this parameter specifies the type of exotic (ASIAN_ARITHMETIC, ASIAN_GEOMETRIC, LOOKBACK_MAX or LOOKBACK_MIN). If you want to evaluate an option which is not strongly path dependent then set exotic_type to NON_SPD
time2Maturity - the remaining time (in years) until the contract matures
asset_price - the current price of the asset
dividend - the continuous dividend yield which the underlying asset pays
interest - the continuously compounded risk-free interest rate in the domestic currency
shift_size - the size of the shift of the interest rate (up and down) from which the derivative at the present point will be evaluated. A reasonable value for this parameter is 0.01.
volatility - the volatility (in years) of the asset price
time_steps - the total number of time intervals which the time from now until the expiry time is divided into
random_walks - the number of Monte-Carlo simulations that is performed before the average of the results is returned
Returns:
the delta of the Exotic option at the present point in time
ExoticOptionsException
MonteCarloDemoException

singleMonteCarloTheta

public double singleMonteCarloTheta(int random_walks,
                                    int exotic_type,
                                    Date evaluationDate,
                                    Date maturityDate,
                                    double shift_size,
                                    double asset_price,
                                    double dividend,
                                    double interest,
                                    double volatility,
                                    int time_steps,
                                    BusinessCalendar businessCalendar)
                             throws ExoticOptionsException,
                                    MonteCarloDemoException
Evaluates the Theta of an single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation. The Theta of an option is the rate of change of the options value with respect to time.

Supported Options

This method allows us to evaluate of the Theta of the four types of exotic options of European type:

Remark: The Theta is the derivative of the price function which respect to interest rate. We have approximated the derivative at the given point by using the central differencing improvements or equivalently Ridders' algorithm of one iteration.

Parameters:
exotic_type - this parameter specifies the type of exotic (ASIAN_ARITHMETIC, ASIAN_GEOMETRIC, LOOKBACK_MAX or LOOKBACK_MIN). If you want to evaluate an option which is not strongly path dependent then set exotic_type to NON_SPD
shift_size - the size of the shift of the interest rate (up and down) from which the derivative at the present point will be evaluated. A reasonable value for this parameter is 0.01.
asset_price - the current price of the asset
dividend - the continuous dividend yield which the underlying asset pays
interest - the continuously compounded risk-free interest rate in the domestic currency
volatility - the volatility (in years) of the asset price
time_steps - the total number of time intervals which the time from now until the expiry time is divided into
random_walks - the number of Monte-Carlo simulations that is performed before the average of the results is returned
evaluationDate - the date when the zero rate of the bond is being evaluated
maturityDate - the date when the bond matures
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
Returns:
the delta of the Exotic option at the present point in time
ExoticOptionsException
MonteCarloDemoException

singleMonteCarloTheta

public double singleMonteCarloTheta(int random_walks,
                                    int exotic_type,
                                    double time2Maturity,
                                    double shift_size,
                                    double asset_price,
                                    double dividend,
                                    double interest,
                                    double volatility,
                                    int time_steps)
                             throws ExoticOptionsException,
                                    MonteCarloDemoException
Evaluates the Theta of an single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation. The Theta of an option is the rate of change of the options value with respect to time.

Supported Options

This method allows us to evaluate of the Theta of the four types of exotic options of European type:

Remark: The Theta is the derivative of the price function which respect to interest rate. We have approximated the derivative at the given point by using the central differencing improvements or equivalently Ridders' algorithm of one iteration.

Parameters:
exotic_type - this parameter specifies the type of exotic (ASIAN_ARITHMETIC, ASIAN_GEOMETRIC, LOOKBACK_MAX or LOOKBACK_MIN). If you want to evaluate an option which is not strongly path dependent then set exotic_type to NON_SPD
time2Maturity - the remaining time (in years) until the contract matures
shift_size - the size of the shift of the interest rate (up and down) from which the derivative at the present point will be evaluated. A reasonable value for this parameter is 0.01.
asset_price - the current price of the asset
dividend - the continuous dividend yield which the underlying asset pays
interest - the continuously compounded risk-free interest rate in the domestic currency
volatility - the volatility (in years) of the asset price
time_steps - the total number of time intervals which the time from now until the expiry time is divided into
random_walks - the number of Monte-Carlo simulations that is performed before the average of the results is returned
Returns:
the delta of the Exotic option at the present point in time
ExoticOptionsException
MonteCarloDemoException

singleMonteCarloWithErrorControl

public double singleMonteCarloWithErrorControl(int random_walks,
                                               int exotic_type,
                                               Date evaluationDate,
                                               Date maturityDate,
                                               double asset_price,
                                               double dividend,
                                               double interest,
                                               double volatility,
                                               int time_steps,
                                               double confidenceLevel,
                                               double maxRelativeError,
                                               BusinessCalendar businessCalendar)
                                        throws ExoticOptionsException,
                                               MonteCarloDemoException
Evaluates present value of a single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation and keeps the error within specified bounds. If the number of simulations required to ensure these bounds is larger than the value given in the randomWalks parameter, an exception is thrown.

Supported Options

Four types of exotic options of European type are supported:

Parameters:
exotic_type - this parameter specifies the type of exotic (ASIAN_ARITHMETIC, ASIAN_GEOMETRIC, LOOKBACK_MAX or LOOKBACK_MIN). If you want to evaluate an option which is not strongly path dependent then set exotic_type to NON_SPD
asset_price - the current price of the asset
dividend - the continuous dividend yield which the underlying asset pays
interest - the continuously compounded risk-free interest rate in the domestic currency
volatility - the volatility (in years) of the asset price
time_steps - the total number of time intervals which the time from now until the expiry time is divided into
confidenceLevel - the probability that the relative error is less than the maximum tolerable error. Should be a value between 0 and 1.
maxRelativeError - the maximum relative error you can tolerate. It is not a percentage (a value of 0.05 signifies an error of 5%, for example).
evaluationDate - the date when the zero rate of the bond is being evaluated
maturityDate - the date when the bond matures
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
Returns:
the present value of the option
ExoticOptionsException
MonteCarloDemoException

singleMonteCarloWithErrorControl

public double singleMonteCarloWithErrorControl(int random_walks,
                                               int exotic_type,
                                               double time2Maturity,
                                               double asset_price,
                                               double dividend,
                                               double interest,
                                               double volatility,
                                               int time_steps,
                                               double confidenceLevel,
                                               double maxRelativeError)
                                        throws ExoticOptionsException,
                                               MonteCarloDemoException
Evaluates present value of a single-asset Asian or Lookback exotic options of European type using Monte Carlo simulation and keeps the error within specified bounds. If the number of simulations required to ensure these bounds is larger than the value given in the randomWalks parameter, an exception is thrown.

Supported Options

Four types of exotic options of European type are supported:

Parameters:
exotic_type - this parameter specifies the type of exotic (ASIAN_ARITHMETIC, ASIAN_GEOMETRIC, LOOKBACK_MAX or LOOKBACK_MIN). If you want to evaluate an option which is not strongly path dependent then set exotic_type to NON_SPD
time2Maturity - the remaining time (in years) until the contract matures
asset_price - the current price of the asset
dividend - the continuous dividend yield which the underlying asset pays
interest - the continuously compounded risk-free interest rate in the domestic currency
volatility - the volatility (in years) of the asset price
time_steps - the total number of time intervals which the time from now until the expiry time is divided into
confidenceLevel - the probability that the relative error is less than the maximum tolerable error. Should be a value between 0 and 1.
maxRelativeError - the maximum relative error you can tolerate. It is not a percentage (a value of 0.05 signifies an error of 5%, for example).
Returns:
the present value of the option
ExoticOptionsException
MonteCarloDemoException

multiMonteCarlo

public double multiMonteCarlo(int random_walks,
                              int exotic_type,
                              Date evaluationDate,
                              Date maturityDate,
                              double[] asset_prices,
                              int number_assets,
                              double[] dividends,
                              double interest,
                              double[] volatility,
                              double[][] correlation,
                              int time_steps,
                              BusinessCalendar businessCalendar)
                       throws ExoticOptionsException,
                              MonteCarloDemoException
Calcualtes the present value of a multi-asset European Asian or Lookback Exotic options of Asian or Lookbackup type in accordance with the Black-Scholes model via Monte Carlo simulation.

Supported Options

Four kinds of exotic options are supported:

Parameters:
random_walks - the number of Monte-Carlo simulations that the class will perform before the result is returned
exotic_type - this parameter specifies the type of exotic (ASIAN_ARITHMETIC, ASIAN_GEOMETRIC, LOOKBACK_MAX or LOOKBACK_MIN). If you want to evaluate an option which is not strongly path dependent then set exotic_type to NON_SPD
asset_prices - a vector containing the current prices of all the assets
number_assets - the number of assets involved in the contract
dividends - a vector containing the continuous dividend yield each asset pays
interest - the continuously compounded risk-free interest rate in the domestic currency
volatility - a vector containing the volatilities (per year) of each of the asset prices
correlation - an N x N matrix of doubles where each element (i,j) represents the correlation coefficient of the ith asset vs the jth asset. The elements on the first diagonal (i.e. when i=j) are all equal to 1, that is an asset is fully correlated with itself. Moreover the correlation matrix is symmetrical since the correlation relation in symmetric.
time_steps - the total number of time intervals which the time from now until the expiry time is divided into
evaluationDate - the date when the zero rate of the bond is being evaluated
maturityDate - the date when the bond matures
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
Returns:
the present value of the option
ExoticOptionsException
MonteCarloDemoException

multiMonteCarlo

public double multiMonteCarlo(int random_walks,
                              int exotic_type,
                              double time2Maturity,
                              double[] asset_prices,
                              int number_assets,
                              double[] dividends,
                              double interest,
                              double[] volatility,
                              double[][] correlation,
                              int time_steps)
                       throws ExoticOptionsException,
                              MonteCarloDemoException
Calcualtes the present value of a multi-asset European Asian or Lookback Exotic options of Asian or Lookbackup type in accordance with the Black-Scholes model via Monte Carlo simulation.

Supported Options

Four kinds of exotic options are supported:

Parameters:
random_walks - the number of Monte-Carlo simulations that the class will perform before the result is returned
exotic_type - this parameter specifies the type of exotic (ASIAN_ARITHMETIC, ASIAN_GEOMETRIC, LOOKBACK_MAX or LOOKBACK_MIN). If you want to evaluate an option which is not strongly path dependent then set exotic_type to NON_SPD
time2Maturity - the remaining time (in years) until the contract matures
asset_prices - a vector containing the current prices of all the assets
number_assets - the number of assets involved in the contract
dividends - a vector containing the continuous dividend yield each asset pays
interest - the continuously compounded risk-free interest rate in the domestic currency
volatility - a vector containing the volatilities (per year) of each of the asset prices
correlation - an N x N matrix of doubles where each element (i,j) represents the correlation coefficient of the ith asset vs the jth asset. The elements on the first diagonal (i.e. when i=j) are all equal to 1, that is an asset is fully correlated with itself. Moreover the correlation matrix is symmetrical since the correlation relation in symmetric.
time_steps - the total number of time intervals which the time from now until the expiry time is divided into
Returns:
the present value of the option
ExoticOptionsException
MonteCarloDemoException

multiMonteCarloWithErrorControl

public double multiMonteCarloWithErrorControl(int random_walks,
                                              int exotic_type,
                                              Date evaluationDate,
                                              Date maturityDate,
                                              double[] asset_prices,
                                              int number_assets,
                                              double[] dividends,
                                              double interest,
                                              double[] volatility,
                                              double[][] correlation,
                                              int time_steps,
                                              double confidenceLevel,
                                              double maxRelativeError,
                                              BusinessCalendar businessCalendar)
                                       throws ExoticOptionsException,
                                              MonteCarloDemoException

Calculates the present value of a multi-asset European Asian or Lookback Exotic options in accordance with the Black-Scholes model via Monte Carlo simulation, keeping the error within specified bounds. If the number of simulations required to ensure these bounds is larger than the value given in the randomWalks parameter, an exception is thrown.

Supported Options

Four kinds of exotic options are supported:

Remarks:

Parameters:
exotic_type - this parameter specifies the type of exotic (ASIAN_ARITHMETIC, ASIAN_GEOMETRIC, LOOKBACK_MAX or LOOKBACK_MIN). If you want to evaluate an option which is not strongly path dependent then set exotic_type to NON_SPD
asset_prices - a vector containing the current prices of all the assets
number_assets - the number of assets involved in the contract
dividends - a vector containing the continuous dividend yield each asset pays
interest - the continuously compounded risk-free interest rate in the domestic currency
volatility - a vector containing the volatilities (per year) of each of the asset prices
correlation - an N x N matrix of doubles where each element (i,j) represents the correlation coefficient of the ith asset vs the jth asset. The elements on the first diagonal (i.e. when i=j) are all equal to 1, that is an asset is fully correlated with itself. Moreover the correlation matrix is symmetrical since the correlation relation in symmetric.
time_steps - the total number of time intervals which the time from now until the expiry time is divided into
confidenceLevel - the probability that the relative error is less than maximum tolerable error. Should be a value between 0 and 1.
maxRelativeError - the maximum relative error you can tolerate. It is not a percentage (a value of 0.05 signifies an error of 5%, for example).
evaluationDate - the date when the zero rate of the bond is being evaluated
maturityDate - the date when the bond matures
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
Returns:
the present value of the option.
ExoticOptionsException
MonteCarloDemoException

multiMonteCarloWithErrorControl

public double multiMonteCarloWithErrorControl(int random_walks,
                                              int exotic_type,
                                              double time2Maturity,
                                              double[] asset_prices,
                                              int number_assets,
                                              double[] dividends,
                                              double interest,
                                              double[] volatility,
                                              double[][] correlation,
                                              int time_steps,
                                              double confidenceLevel,
                                              double maxRelativeError)
                                       throws ExoticOptionsException,
                                              MonteCarloDemoException

Calculates the present value of a multi-asset European Asian or Lookback Exotic options in accordance with the Black-Scholes model via Monte Carlo simulation, keeping the error within specified bounds. If the number of simulations required to ensure these bounds is larger than the value given in the randomWalks parameter, an exception is thrown.

Supported Options

Four kinds of exotic options are supported:

Remarks:

Parameters:
exotic_type - this parameter specifies the type of exotic (ASIAN_ARITHMETIC, ASIAN_GEOMETRIC, LOOKBACK_MAX or LOOKBACK_MIN). If you want to evaluate an option which is not strongly path dependent then set exotic_type to NON_SPD
time2Maturity - the remaining time (in years) until the contract matures
asset_prices - a vector containing the current prices of all the assets
number_assets - the number of assets involved in the contract
dividends - a vector containing the continuous dividend yield each asset pays
interest - the continuously compounded risk-free interest rate in the domestic currency
volatility - a vector containing the volatilities (per year) of each of the asset prices
correlation - an N x N matrix of doubles where each element (i,j) represents the correlation coefficient of the ith asset vs the jth asset. The elements on the first diagonal (i.e. when i=j) are all equal to 1, that is an asset is fully correlated with itself. Moreover the correlation matrix is symmetrical since the correlation relation in symmetric.
time_steps - the total number of time intervals which the time from now until the expiry time is divided into
confidenceLevel - the probability that the relative error is less than maximum tolerable error. Should be a value between 0 and 1.
maxRelativeError - the maximum relative error you can tolerate. It is not a percentage (a value of 0.05 signifies an error of 5%, for example).
Returns:
the present value of the option.
ExoticOptionsException
MonteCarloDemoException

WebCab Options and Futures Demo
v2.5
(J2SE Edition)