|
WebCab Options and Futures Demo v2.5 (J2SE Edition) |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--webcab.lib.finance.options.exotic.FiniteDifference
Within this class we offer methods by which any option contract
can be priced in accordance with the Black-Scholes-Merton model when the
contract payoff function and boundary conditions of the resulting price
function are given using setPayoffFunction
and setBoundaries. For convenience we also provide
particular cases for Asian and Lookback Extoic options which already have
the relevant payoff function and boundaries internally set.
General and Specific instances of Pricing
setPayoffFunction
and setBoundaries.
finiteDifferencing - Evaluates the present
value of an American or European option contract with a payoff function
provided by setPayoffFunction, in accdorance with the
Black-Scholes-Merton model
finiteDifferencingVector - Evaluates a vector of
asset_price_steps options values corresponding to a range of present underlying
asset prices between 0 and max_asset_price, for any any
American or European (single asset) option contract with a payoff function provided by
multiFiniteDifferencing - Evaluates
the present value of any American or European multi-asset option contract
with a payoff function provided by setPayoffFunction, in
accordance with the Black-Scholes-Merton model using finite differencing techniques.
finiteDifferencingStronglyPathDependent
- Evaluates the present value of a strongly path dependent Asian or Loopback exotic option
according to the Black-Scholes-Merton model using finite difference PDE pricing
techniques.
finiteDifferencingVectorStronglyPathDependent
- Evaluates a strongly path dependent Asian or Lookback exotic option for a range of
possible strikes in accordance with the Black-Scholes model using finite diifferencing
PDE techniques.
Providing the Payoff Function adn Boundaries
When using these methods within clients the main issues which you will need to be careful with is to provide the correct payoff function and appropriate boundary conditions. The payoff function is the primary way of specifying an option contract. There are other contract parameters that are not included within the payoff, such as whether early exercise is possible. That is, whether is the option is European or American, and for strongly path dependent options any updating formulae requires which are both required in order to define an options contract explicitly. We allow you to provide this information to the method directly.
The payoff function and the boundary conditions on the other hand must be set prior to calling any of the options evaluation methods. In order to set the payoff function and boundaries you will have to instantiate some classes (either the standard classes included, or your own, custom designed classes).
Details of the Finite Differencing Approach
We apply the finite differencing approach to evaluate option prices, by solving partial differential equations (PDEs) which result from the Black-Scholes-Merton model. Please read the Mathematical documentation provided in the accompanying PDF documentation for further explanation of the implemented finite differencing techniques used.
Remark: The Programmer's Guide chapter within the accompanying PDF documentation offers further details and examples regarding the construction of the payoff function and boundary conditions and how these classes are sent to the evaluation method.
| Constructor Summary | |
FiniteDifference()
Creates a new FiniteDifference instance without registering the payoff function and the boundaries function. |
|
FiniteDifference(PayoffFunction instanceOfPayoffFunction,
Boundaries instanceOfBoundaries)
Creates a new FiniteDifference instance and submits the payoff function and the boundaries function. |
|
| Method Summary | |
double |
finiteDifferencing(int algorithm_type,
int type,
Date evaluationDate,
Date maturityDate,
double asset_price,
double dividend,
double interest,
double volatility,
double max_asset_price,
int time_steps,
int asset_price_steps,
double tolerance,
BusinessCalendar businessCalendar)
Evaluates the present value of an American or European option contract with a payoff function provided by setPayoffFunction, in accdorance with the
Black-Scholes-Merton model using finite differencing techniques. |
double |
finiteDifferencing(int algorithm_type,
int type,
double time2Maturity,
double asset_price,
double dividend,
double interest,
double volatility,
double max_asset_price,
int time_steps,
int asset_price_steps,
double tolerance)
Evaluates the present value of an American or European option contract with a payoff function provided by setPayoffFunction, in accdorance with the
Black-Scholes-Merton model using finite differencing techniques. |
double |
finiteDifferencingStronglyPathDependent(int algorithm_type,
int type,
int exotic_type,
Date evaluationDate,
Date maturityDate,
double asset_price,
double dividend,
double interest,
double volatility,
double max_asset_price,
double max_spd,
int time_steps,
int asset_price_steps,
int spd_steps,
double tolerance,
int sampling_period,
BusinessCalendar businessCalendar)
Evaluates the present value of a strongly path dependent Asian or Loopback exotic option according to the Black-Scholes-Merton model using finite difference PDE pricing techniques. |
double |
finiteDifferencingStronglyPathDependent(int algorithm_type,
int type,
int exotic_type,
double time2Maturity,
double asset_price,
double dividend,
double interest,
double volatility,
double max_asset_price,
double max_spd,
int time_steps,
int asset_price_steps,
int spd_steps,
double tolerance,
int sampling_period)
Evaluates the present value of a strongly path dependent Asian or Loopback exotic option according to the Black-Scholes-Merton model using finite difference PDE pricing techniques. |
double[] |
finiteDifferencingVector(int algorithm_type,
int type,
Date evaluationDate,
Date maturityDate,
double dividend,
double interest,
double volatility,
double max_asset_price,
int time_steps,
int asset_price_steps,
double tolerance,
BusinessCalendar businessCalendar)
Evaluates a vector of asset_price_steps options values corresponding to a
range of present underlying asset prices between 0 and max_asset_price,
for any any American or European (single asset) option contract with a
payoff function provided by setPayoffFunction, in accordance
with the Black-Scholes-Merton model using finite differencing PDE techniques. |
double[] |
finiteDifferencingVector(int algorithm_type,
int type,
double time2Maturity,
double dividend,
double interest,
double volatility,
double max_asset_price,
int time_steps,
int asset_price_steps,
double tolerance)
Evaluates a vector of asset_price_steps options values corresponding to a
range of present underlying asset prices between 0 and max_asset_price,
for any any American or European (single asset) option contract with a
payoff function provided by setPayoffFunction, in accordance
with the Black-Scholes-Merton model using finite differencing PDE techniques. |
double[] |
finiteDifferencingVectorStronglyPathDependent(int algorithm_type,
int type,
int exotic_type,
Date evaluationDate,
Date maturityDate,
double dividend,
double interest,
double volatility,
double max_asset_price,
double max_spd,
int time_steps,
int asset_price_steps,
int spd_steps,
double tolerance,
int sampling_period,
BusinessCalendar businessCalendar)
Evaluates a strongly path dependent Asian or Lookback exotic options for a range of possible strikes in accordance with the Black-Scholes model using finite diifferencing PDE techniques. |
double[] |
finiteDifferencingVectorStronglyPathDependent(int algorithm_type,
int type,
int exotic_type,
double time2Maturity,
double dividend,
double interest,
double volatility,
double max_asset_price,
double max_spd,
int time_steps,
int asset_price_steps,
int spd_steps,
double tolerance,
int sampling_period)
Evaluates a strongly path dependent Asian or Lookback exotic options for a range of possible strikes in accordance with the Black-Scholes model using finite diifferencing PDE techniques. |
double |
multiFiniteDifferencing(int type,
Date evaluationDate,
Date maturityDate,
double[] asset_prices,
int n_assets,
double[] dividends,
double interest,
double[] volatility,
double[][] correlation,
double max_asset_price,
int time_steps,
int asset_price_steps,
BusinessCalendar businessCalendar)
Evaluates the present value of any American or European multi-asset option contract with a payoff function provided by setPayoffFunction, in
accordance with the Black-Scholes-Merton model using finite differencing techniques.
|
double |
multiFiniteDifferencing(int type,
double time2Maturity,
double[] asset_prices,
int n_assets,
double[] dividends,
double interest,
double[] volatility,
double[][] correlation,
double max_asset_price,
int time_steps,
int asset_price_steps)
Evaluates the present value of any American or European multi-asset option contract with a payoff function provided by setPayoffFunction, in
accordance with the Black-Scholes-Merton model using finite differencing techniques.
|
void |
setBoundaries(Boundaries instanceOfBoundaries)
Submits a new Boundary function to the FiniteDifference instance, by replacing the previous one, as sent at creation time or with a previous call to this method. |
void |
setPayoffFunction(PayoffFunction instanceOfPayoffFunction)
Submits a new Payoff Function to the FiniteDifference instance, by replacing the previous one, as sent at creation time or with a previous call to this method. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public FiniteDifference()
public FiniteDifference(PayoffFunction instanceOfPayoffFunction,
Boundaries instanceOfBoundaries)
| Method Detail |
public void setPayoffFunction(PayoffFunction instanceOfPayoffFunction)
throws FiniteDifferenceDemoException
FiniteDifferenceDemoException
public void setBoundaries(Boundaries instanceOfBoundaries)
throws FiniteDifferenceDemoException
FiniteDifferenceDemoException
public double finiteDifferencing(int algorithm_type,
int type,
Date evaluationDate,
Date maturityDate,
double asset_price,
double dividend,
double interest,
double volatility,
double max_asset_price,
int time_steps,
int asset_price_steps,
double tolerance,
BusinessCalendar businessCalendar)
throws ExoticOptionsException,
FiniteDifferenceDemoException
setPayoffFunction, in accdorance with the
Black-Scholes-Merton model using finite differencing techniques. Note, that in
order to apply these finite differencing PDE techniques some boundaries conditions
of the pricing function on the finite differencing grid chosen much have been set using
setBoundaries.
Setting the boundaries
In order to price the (European or American) option contract we are required to solve the PDE resulting from Black-Scholes-Merton model for the given payoff function (i.e. contract) under consideration. This is handled internally by the method but the whether the option being considered is American or European the values of the pricing function is going to depend on the following two variables:
Time = maturity, on this boundary the pricing function is just the payoff
function.
Supports all Options
This method allows (in principle) any option to be priced is accordance with the
Black-Scholes model via finite differencing methods for which the user can provide
the contracts payoff function using setPayoffFunction(webcab.lib.finance.options.exotic.PayoffFunction) and the boundary
conditions of the price function on the finite differencing grid boundaries at set
using setBoundaries(webcab.lib.finance.options.exotic.Boundaries).
Overview of the Algorithm
The algorithm constructs a grid consisting of a total
of time_steps x asset_price_steps points. At each iteration a new
line from this grid is calculated. The last line of the grid corresponds to the option values
at the current moment of time, for a range of prices varying between 0 and max_asset_price.
From this vector the element corresponding to the current asset price is returned.
finiteDifferencingVector
to avoid a huge amount of order to guarantee redundant computation.
type - this parameter specifies whether the option is European or American. That is, whether the option can exercise prior to the maturity (i.e. American) or can only be exercised at the maturity (i.e. European).asset_price - the current price of the assetdividend - the continuous dividend yield the underlying asset paysinterest - the continuously compounded risk-free interest ratevolatility - the volatility (in years) of the asset pricemax_asset_price - the asset price corresponding to the last item of the finite differencing gridtime_steps - the total number of iterations (the dimension of the grid on the time axis)asset_price_steps - the dimension of the grid on the price axisalgorithm_type - the type of finite differencing algorithm to be used; possible values are EXPLICIT, FULLY_IMPLICIT and CRANCK_NICHOLSON.tolerance - the tolerance for the SOR iterative algorithm. This parameter is used only when American options are priced using an implicit algorithm (i.e. FULLY_IMPLICIT or CRANCK_NICHOLSON). A reasonable value for this parameter is 1E-7.evaluationDate - the date when the value of the option is evaluatedmaturityDate - the date when the contract maturesbusinessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
ExoticOptionsException
FiniteDifferenceDemoException
public double finiteDifferencing(int algorithm_type,
int type,
double time2Maturity,
double asset_price,
double dividend,
double interest,
double volatility,
double max_asset_price,
int time_steps,
int asset_price_steps,
double tolerance)
throws ExoticOptionsException,
FiniteDifferenceDemoException
setPayoffFunction, in accdorance with the
Black-Scholes-Merton model using finite differencing techniques. Note, that in
order to apply these finite differencing PDE techniques some boundaries conditions
of the pricing function on the finite differencing grid chosen much have been set using
setBoundaries.
Setting the boundaries
In order to price the (European or American) option contract we are required to solve the PDE resulting from Black-Scholes-Merton model for the given payoff function (i.e. contract) under consideration. This is handled internally by the method but the whether the option being considered is American or European the values of the pricing function is going to depend on the following two variables:
Time = maturity, on this boundary the pricing function is just the payoff
function.
Supports all Options
This method allows (in principle) any option to be priced is accordance with the
Black-Scholes model via finite differencing methods for which the user can provide
the contracts payoff function using setPayoffFunction(webcab.lib.finance.options.exotic.PayoffFunction) and the boundary
conditions of the price function on the finite differencing grid boundaries at set
using setBoundaries(webcab.lib.finance.options.exotic.Boundaries).
Overview of the Algorithm
The algorithm constructs a grid consisting of a total
of time_steps x asset_price_steps points. At each iteration a new
line from this grid is calculated. The last line of the grid corresponds to the option values
at the current moment of time, for a range of prices varying between 0 and max_asset_price.
From this vector the element corresponding to the current asset price is returned.
finiteDifferencingVector
to avoid a huge amount of order to guarantee redundant computation.
type - this parameter specifies whether the option is European or American. That is, whether the option can exercise prior to the maturity (i.e. American) or can only be exercised at the maturity (i.e. European).time2Maturity - the remaining time (in years) until the contract maturesasset_price - the current price of the assetdividend - the continuous dividend yield the underlying asset paysinterest - the continuously compounded risk-free interest ratevolatility - the volatility (in years) of the asset pricemax_asset_price - the asset price corresponding to the last item of the finite differencing gridtime_steps - the total number of iterations (the dimension of the grid on the time axis)asset_price_steps - the dimension of the grid on the price axisalgorithm_type - the type of finite differencing algorithm to be used; possible values are EXPLICIT, FULLY_IMPLICIT and CRANCK_NICHOLSON.tolerance - the tolerance for the SOR iterative algorithm. This parameter is used only when American options are priced using an implicit algorithm (i.e. FULLY_IMPLICIT or CRANCK_NICHOLSON). A reasonable value for this parameter is 1E-7.
ExoticOptionsException
FiniteDifferenceDemoException
public double finiteDifferencingStronglyPathDependent(int algorithm_type,
int type,
int exotic_type,
Date evaluationDate,
Date maturityDate,
double asset_price,
double dividend,
double interest,
double volatility,
double max_asset_price,
double max_spd,
int time_steps,
int asset_price_steps,
int spd_steps,
double tolerance,
int sampling_period,
BusinessCalendar businessCalendar)
throws ExoticOptionsException,
FiniteDifferenceDemoException
Supported Options
This method allows the following four types of exotic options to be evaluated:
exotic_type
parameter. You should also specify whether the exotic option is of European or American
type by using the parameter type.
Once the option contract has been specified the options value is a function of three variables:
Overview of the Algorithm
The algorithm constructs a grid consisting of a total of time_steps x
asset_price_steps x spd_steps points. At each iteration
a new plane from this grid is calculated. The path dependent value is considered to be
updated on every sampling_period time steps. This update process corresponds
to a jump condition at the differential equation level. The last plane of the grid corresponds
to the option values at the current moment of time, for a range of prices varying between
0 and max_asset_price and a range of path dependent values between
0 and spd_max. From this vector the element corresponding to the
current asset price is returned.
Remarks:
finiteDifferencingVectorStronglyPathDependent, which renders a large amount of
the computations redundant.
type - this parameter specifies whether the option is European or American. That is, whether the option can exercise prior to the maturity (i.e. American) or can only be exercised at the maturity (i.e. European).asset_price - the current price of the assetdividend - the continuous dividend yield the underlying asset paysinterest - the continuously compounded risk-free interest rate in the domestic currencyvolatility - the volatility (in years) of the asset pricemax_asset_price - the asset price corresponding to the last item of the finite differencing grid on the price axistime_steps - the total number of iterations (the dimension of the grid on the time axis)asset_price_steps - the dimension of the grid on the price axisexotic_type - this parameter specifies the type of exotic (ASIAN_ARITHMETIC, ASIAN_GEOMETRIC, LOOKBACK_MAX or LOOKBACK_MIN)max_spd - the path dependent value corresponding to the last item of the finite differencing grid on the path dependent value axisspd_steps - the dimension of the grid on the path dependent value axissampling_period - the number of time steps before the path dependent value is updatedalgorithm_type - the type of finite differencing algorithm to be used; can be EXPLICIT, FULLY_IMPLICIT or CRANCK_NICHOLSON.tolerance - the tolerance for the SOR algorithm of solving systems of linear equations.evaluationDate - the date when the value of the option is evaluatedmaturityDate - the date when the contract maturesbusinessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
ExoticOptionsException
FiniteDifferenceDemoException
public double finiteDifferencingStronglyPathDependent(int algorithm_type,
int type,
int exotic_type,
double time2Maturity,
double asset_price,
double dividend,
double interest,
double volatility,
double max_asset_price,
double max_spd,
int time_steps,
int asset_price_steps,
int spd_steps,
double tolerance,
int sampling_period)
throws ExoticOptionsException,
FiniteDifferenceDemoException
Supported Options
This method allows the following four types of exotic options to be evaluated:
exotic_type
parameter. You should also specify whether the exotic option is of European or American
type by using the parameter type.
Once the option contract has been specified the options value is a function of three variables:
Overview of the Algorithm
The algorithm constructs a grid consisting of a total of time_steps x
asset_price_steps x spd_steps points. At each iteration
a new plane from this grid is calculated. The path dependent value is considered to be
updated on every sampling_period time steps. This update process corresponds
to a jump condition at the differential equation level. The last plane of the grid corresponds
to the option values at the current moment of time, for a range of prices varying between
0 and max_asset_price and a range of path dependent values between
0 and spd_max. From this vector the element corresponding to the
current asset price is returned.
Remarks:
finiteDifferencingVectorStronglyPathDependent, which renders a large amount of
the computations redundant.
type - this parameter specifies whether the option is European or American. That is, whether the option can exercise prior to the maturity (i.e. American) or can only be exercised at the maturity (i.e. European).time2Maturity - the remaining time (in years) until the contract maturesasset_price - the current price of the assetdividend - the continuous dividend yield the underlying asset paysinterest - the continuously compounded risk-free interest rate in the domestic currencyvolatility - the volatility (in years) of the asset pricemax_asset_price - the asset price corresponding to the last item of the finite differencing grid on the price axistime_steps - the total number of iterations (the dimension of the grid on the time axis)asset_price_steps - the dimension of the grid on the price axisexotic_type - this parameter specifies the type of exotic (ASIAN_ARITHMETIC, ASIAN_GEOMETRIC, LOOKBACK_MAX or LOOKBACK_MIN)max_spd - the path dependent value corresponding to the last item of the finite differencing grid on the path dependent value axisspd_steps - the dimension of the grid on the path dependent value axissampling_period - the number of time steps before the path dependent value is updatedalgorithm_type - the type of finite differencing algorithm to be used; can be EXPLICIT, FULLY_IMPLICIT or CRANCK_NICHOLSON.tolerance - the tolerance for the SOR algorithm of solving systems of linear equations.
ExoticOptionsException
FiniteDifferenceDemoException
public double[] finiteDifferencingVector(int algorithm_type,
int type,
Date evaluationDate,
Date maturityDate,
double dividend,
double interest,
double volatility,
double max_asset_price,
int time_steps,
int asset_price_steps,
double tolerance,
BusinessCalendar businessCalendar)
throws ExoticOptionsException,
FiniteDifferenceDemoException
asset_price_steps options values corresponding to a
range of present underlying asset prices between 0 and max_asset_price,
for any any American or European (single asset) option contract with a
payoff function provided by setPayoffFunction, in accordance
with the Black-Scholes-Merton model using finite differencing PDE techniques. Note, that in
order to apply these finite differencing PDE techniques some boundaries conditions
of the pricing function on the finite differencing grid chosen much have been set using
setBoundaries.
Supports all Options
This method allows (in principle) any option to be priced is accordance with the
Black-Scholes model via finite differencing methods for which the user can provide
the contracts payoff function using setPayoffFunction(webcab.lib.finance.options.exotic.PayoffFunction) and the boundary
conditions of the price function on the finite differencing grid boundaries at set
using setBoundaries(webcab.lib.finance.options.exotic.Boundaries).
Overview of Algorithm
The algorithm constructs a grid consisting of a total of time_steps x
asset_price_steps points. At each iteration a new line from this grid
is calculated. The last line of the grid corresponds to the option values at the current
moment of time, for a range of prices varying between 0 and
max_asset_price. The method returns this last line of the grid, and not a
single value like the method finiteDifferencing does.
Remark: This full finite differencing algorithm is used only when evaluating American options with implicit or Cranck-Nicholson algorithms. For options of European type since the SOR algorithm in not used the tolerance parameter will have no effect on either the result or computation time.
Setting the boundaries
In order to price the (European or American) option contract we are required to solve the PDE resulting from Black-Scholes-Merton model for the given payoff function (i.e. contract) under consideration. This is handled internally by the method but the whether the option being considered is American or European the values of the pricing function is going to depend on the following two variables:
Time = maturity, on this boundary the pricing function is just the payoff
function.
type - this parameter specifies whether the option is European or American. That is, whether the option can exercise prior to the maturity (i.e. American) or can only be exercised at the maturity (i.e. European).dividend - the continuous dividend yield the underlying asset paysinterest - the continuously compounded risk-free interest rate in the domestic currencyvolatility - the volatility (in years) of the asset pricemax_asset_price - the asset price corresponding to the last item of the finite differencing gridtime_steps - the total number of iterations (the dimension of the grid on the time axis)asset_price_steps - the dimension of the grid on the price axisalgorithm_type - the type of finite differencing algorithm to be used; can be EXPLICIT, FULLY_IMPLICIT or CRANCK_NICHOLSON.tolerance - the tolerance for the SOR algorithm of solving systems of linear equations.evaluationDate - the date when the value of the option is evaluatedmaturityDate - the date when the contract maturesbusinessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
asset_price_steps option values corresponding to a
range of asset prices between 0 and max_asset_price
ExoticOptionsException
FiniteDifferenceDemoException
public double[] finiteDifferencingVector(int algorithm_type,
int type,
double time2Maturity,
double dividend,
double interest,
double volatility,
double max_asset_price,
int time_steps,
int asset_price_steps,
double tolerance)
throws ExoticOptionsException,
FiniteDifferenceDemoException
asset_price_steps options values corresponding to a
range of present underlying asset prices between 0 and max_asset_price,
for any any American or European (single asset) option contract with a
payoff function provided by setPayoffFunction, in accordance
with the Black-Scholes-Merton model using finite differencing PDE techniques. Note, that in
order to apply these finite differencing PDE techniques some boundaries conditions
of the pricing function on the finite differencing grid chosen much have been set using
setBoundaries.
Supports all Options
This method allows (in principle) any option to be priced is accordance with the
Black-Scholes model via finite differencing methods for which the user can provide
the contracts payoff function using setPayoffFunction(webcab.lib.finance.options.exotic.PayoffFunction) and the boundary
conditions of the price function on the finite differencing grid boundaries at set
using setBoundaries(webcab.lib.finance.options.exotic.Boundaries).
Overview of Algorithm
The algorithm constructs a grid consisting of a total of time_steps x
asset_price_steps points. At each iteration a new line from this grid
is calculated. The last line of the grid corresponds to the option values at the current
moment of time, for a range of prices varying between 0 and
max_asset_price. The method returns this last line of the grid, and not a
single value like the method finiteDifferencing does.
Remark: This full finite differencing algorithm is used only when evaluating American options with implicit or Cranck-Nicholson algorithms. For options of European type since the SOR algorithm in not used the tolerance parameter will have no effect on either the result or computation time.
Setting the boundaries
In order to price the (European or American) option contract we are required to solve the PDE resulting from Black-Scholes-Merton model for the given payoff function (i.e. contract) under consideration. This is handled internally by the method but the whether the option being considered is American or European the values of the pricing function is going to depend on the following two variables:
Time = maturity, on this boundary the pricing function is just the payoff
function.
type - this parameter specifies whether the option is European or American. That is, whether the option can exercise prior to the maturity (i.e. American) or can only be exercised at the maturity (i.e. European).time2Maturity - the remaining time (in years) until the contract maturesdividend - the continuous dividend yield the underlying asset paysinterest - the continuously compounded risk-free interest rate in the domestic currencyvolatility - the volatility (in years) of the asset pricemax_asset_price - the asset price corresponding to the last item of the finite differencing gridtime_steps - the total number of iterations (the dimension of the grid on the time axis)asset_price_steps - the dimension of the grid on the price axisalgorithm_type - the type of finite differencing algorithm to be used; can be EXPLICIT, FULLY_IMPLICIT or CRANCK_NICHOLSON.tolerance - the tolerance for the SOR algorithm of solving systems of linear equations.
asset_price_steps option values corresponding to a
range of asset prices between 0 and max_asset_price
ExoticOptionsException
FiniteDifferenceDemoException
public double[] finiteDifferencingVectorStronglyPathDependent(int algorithm_type,
int type,
int exotic_type,
Date evaluationDate,
Date maturityDate,
double dividend,
double interest,
double volatility,
double max_asset_price,
double max_spd,
int time_steps,
int asset_price_steps,
int spd_steps,
double tolerance,
int sampling_period,
BusinessCalendar businessCalendar)
throws ExoticOptionsException,
FiniteDifferenceDemoException
Overview
We use a finite differencing algorithm in order to solve the resulting Black-Scholes PDE which will return the present values of the strongly path dependent exotic option as a vector. The vector which is returned represents the value of the option contract at the range of possible strikes which where considered.
Options Supported
This method covers four types of exotic options:
The type of option is selected by using the exotic_type parameter.
Since these options are strongly path dependent there present value is a function
which will depend on three variables:
Overview of Algorithm
The algorithm constructs a grid consisting of a total
of time_steps x asset_price_steps x spd_steps points. At each iteration a new
plane from this grid is calculated. The path dependent value is considered to be updated on
every sampling_period time steps. This update process corresponds to a jump condition
at the differential equation level. The last plane of the grid corresponds to the option values
at the current moment of time, for a range of prices varying between 0 and max_asset_price and a
range of path dependent values between 0 and spd_max.
The method returns this last line of the grid, and not a single value which is the case for the method
finiteDifferencingStronglyPathDependent.
Remark: Full finite differencing algorithms are used only when evaluating
American options in which case implicit or Cranck-Nicholson algorithms are used.
In the case of European options since the full SOR algorithm is not used the value
given for the tolerance will not effect the results or the computational
time required.
algorithm_type - the type of finite differencing algorithm to be used; can be EXPLICIT, FULLY_IMPLICIT or CRANCK_NICHOLSON.type - this parameter specifies whether the option is European or American. That is, whether the option can exercise prior to the maturity (i.e. American) or can only be exercised at the maturity (i.e. European).dividend - the continuous dividend yield the asset underlying asset paysinterest - the continuously compounded risk-free interest rate in the domestic currencyvolatility - the volatility (in years) of the asset pricemax_asset_price - the asset price corresponding to the last item of the finite differencing gridtime_steps - the total number of iterations (the dimension of the grid on the time axis)asset_price_steps - the dimension of the grid on the price axisexotic_type - this parameter specifies the type of exotic (ASIAN_ARITHMETIC, ASIAN_GEOMETRIC, LOOKBACK_MAX or LOOKBACK_MIN)max_spd - the path dependent value corresponding to the last item of the finite differencing grid on the path dependent value axis.spd_steps - the dimension of the grid on the path dependent value axis.tolerance - the tolerance for the SOR algorithm of solving systems of linear equations.sampling_period - the number of time steps before the path dependent value is updated.evaluationDate - the date when the value of the option is evaluatedmaturityDate - the date when the contract maturesbusinessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
asset_price_steps option values corresponding to a range of
asset prices between 0 and max_asset_price
ExoticOptionsException
FiniteDifferenceDemoException
public double[] finiteDifferencingVectorStronglyPathDependent(int algorithm_type,
int type,
int exotic_type,
double time2Maturity,
double dividend,
double interest,
double volatility,
double max_asset_price,
double max_spd,
int time_steps,
int asset_price_steps,
int spd_steps,
double tolerance,
int sampling_period)
throws ExoticOptionsException,
FiniteDifferenceDemoException
Overview
We use a finite differencing algorithm in order to solve the resulting Black-Scholes PDE which will return the present values of the strongly path dependent exotic option as a vector. The vector which is returned represents the value of the option contract at the range of possible strikes which where considered.
Options Supported
This method covers four types of exotic options:
The type of option is selected by using the exotic_type parameter.
Since these options are strongly path dependent there present value is a function
which will depend on three variables:
Overview of Algorithm
The algorithm constructs a grid consisting of a total
of time_steps x asset_price_steps x spd_steps points. At each iteration a new
plane from this grid is calculated. The path dependent value is considered to be updated on
every sampling_period time steps. This update process corresponds to a jump condition
at the differential equation level. The last plane of the grid corresponds to the option values
at the current moment of time, for a range of prices varying between 0 and max_asset_price and a
range of path dependent values between 0 and spd_max.
The method returns this last line of the grid, and not a single value which is the case for the method
finiteDifferencingStronglyPathDependent.
Remark: Full finite differencing algorithms are used only when evaluating
American options in which case implicit or Cranck-Nicholson algorithms are used.
In the case of European options since the full SOR algorithm is not used the value
given for the tolerance will not effect the results or the computational
time required.
algorithm_type - the type of finite differencing algorithm to be used; can be EXPLICIT, FULLY_IMPLICIT or CRANCK_NICHOLSON.type - this parameter specifies whether the option is European or American. That is, whether the option can exercise prior to the maturity (i.e. American) or can only be exercised at the maturity (i.e. European).time2Maturity - the remaining time (in years) until the contract maturesdividend - the continuous dividend yield the asset underlying asset paysinterest - the continuously compounded risk-free interest rate in the domestic currencyvolatility - the volatility (in years) of the asset pricemax_asset_price - the asset price corresponding to the last item of the finite differencing gridtime_steps - the total number of iterations (the dimension of the grid on the time axis)asset_price_steps - the dimension of the grid on the price axisexotic_type - this parameter specifies the type of exotic (ASIAN_ARITHMETIC, ASIAN_GEOMETRIC, LOOKBACK_MAX or LOOKBACK_MIN)max_spd - the path dependent value corresponding to the last item of the finite differencing grid on the path dependent value axis.spd_steps - the dimension of the grid on the path dependent value axis.tolerance - the tolerance for the SOR algorithm of solving systems of linear equations.sampling_period - the number of time steps before the path dependent value is updated.
asset_price_steps option values corresponding to a range of
asset prices between 0 and max_asset_price
ExoticOptionsException
FiniteDifferenceDemoException
public double multiFiniteDifferencing(int type,
Date evaluationDate,
Date maturityDate,
double[] asset_prices,
int n_assets,
double[] dividends,
double interest,
double[] volatility,
double[][] correlation,
double max_asset_price,
int time_steps,
int asset_price_steps,
BusinessCalendar businessCalendar)
throws ExoticOptionsException,
FiniteDifferenceDemoException
setPayoffFunction, in
accordance with the Black-Scholes-Merton model using finite differencing techniques.
Note, that in order to apply these finite differencing PDE techniques some boundaries
conditions of the pricing function on the finite differencing grid chosen much have
been set using setBoundaries.
Remark: This method can be very slow and susceptible of instability if the number of assets which the option depends on is larger than three.
Supports all Options
This method allows (in principle) any multi-asset option to be priced is
accordance with the Black-Scholes model via finite differencing methods for which
the user can provide the contracts payoff function using setPayoffFunction(webcab.lib.finance.options.exotic.PayoffFunction)
and the boundary conditions of the price function on the finite differencing grid
boundaries at set using setBoundaries(webcab.lib.finance.options.exotic.Boundaries).
Setting the boundaries
In order to price the (European or American) option contract we are required to solve the PDE resulting from Black-Scholes-Merton model for the given payoff function (i.e. contract) under consideration. This is handled internally by the method but the whether the option being considered is American or European the values of the pricing function is going to depend on the following two variables:
Time = maturity, on this boundary the pricing function is just the payoff
function.
type - this parameter specifies whether the option is European or American. That is, whether the option can exercise prior to the maturity (i.e. American) or can only be exercised at the maturity (i.e. European).asset_prices - a vector containing the current prices of all the assetsn_assets - the number of assets involved in the definition of the options contractdividends - a vector containing the continuous dividend yield which each of the underlying assets paysinterest - the continuously compounded risk-free interest rate in the domestic currencyvolatility - a vector containing the volatilities (in years) of the asset pricescorrelation - N x N matrix. Each element (i,j) represents the correlation coefficient of asset i vs asset j. If i=j (i.e. elements from the first diagonal) then the value should be equal to 1 (an asset is fully correlated with itself).max_asset_price - the asset price corresponding to the last item of the finite differencing gridtime_steps - the total number of iterations (the dimension of the grid on the time axis)asset_price_steps - the dimension of the grid on the price axisevaluationDate - the date when the value of the option is evaluatedmaturityDate - the date when the contract maturesbusinessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
setPayoffFunction
ExoticOptionsException
FiniteDifferenceDemoException
public double multiFiniteDifferencing(int type,
double time2Maturity,
double[] asset_prices,
int n_assets,
double[] dividends,
double interest,
double[] volatility,
double[][] correlation,
double max_asset_price,
int time_steps,
int asset_price_steps)
throws ExoticOptionsException,
FiniteDifferenceDemoException
setPayoffFunction, in
accordance with the Black-Scholes-Merton model using finite differencing techniques.
Note, that in order to apply these finite differencing PDE techniques some boundaries
conditions of the pricing function on the finite differencing grid chosen much have
been set using setBoundaries.
Remark: This method can be very slow and susceptible of instability if the number of assets which the option depends on is larger than three.
Supports all Options
This method allows (in principle) any multi-asset option to be priced is
accordance with the Black-Scholes model via finite differencing methods for which
the user can provide the contracts payoff function using setPayoffFunction(webcab.lib.finance.options.exotic.PayoffFunction)
and the boundary conditions of the price function on the finite differencing grid
boundaries at set using setBoundaries(webcab.lib.finance.options.exotic.Boundaries).
Setting the boundaries
In order to price the (European or American) option contract we are required to solve the PDE resulting from Black-Scholes-Merton model for the given payoff function (i.e. contract) under consideration. This is handled internally by the method but the whether the option being considered is American or European the values of the pricing function is going to depend on the following two variables:
Time = maturity, on this boundary the pricing function is just the payoff
function.
type - this parameter specifies whether the option is European or American. That is, whether the option can exercise prior to the maturity (i.e. American) or can only be exercised at the maturity (i.e. European).time2Maturity - the remaining time (in years) until the contract maturesasset_prices - a vector containing the current prices of all the assetsn_assets - the number of assets involved in the definition of the options contractdividends - a vector containing the continuous dividend yield which each of the underlying assets paysinterest - the continuously compounded risk-free interest rate in the domestic currencyvolatility - a vector containing the volatilities (in years) of the asset pricescorrelation - N x N matrix. Each element (i,j) represents the correlation coefficient of asset i vs asset j. If i=j (i.e. elements from the first diagonal) then the value should be equal to 1 (an asset is fully correlated with itself).max_asset_price - the asset price corresponding to the last item of the finite differencing gridtime_steps - the total number of iterations (the dimension of the grid on the time axis)asset_price_steps - the dimension of the grid on the price axis
setPayoffFunction
ExoticOptionsException
FiniteDifferenceDemoException
|
WebCab Options and Futures Demo v2.5 (J2SE Edition) |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||