WebCab Bonds
v2.01
(J2SE Edition)

webcab.lib.finance.pricing.contracts.standard
Class AsianOption

java.lang.Object
  |
  +--webcab.lib.finance.pricing.contracts.GeneralContractCommon
        |
        +--webcab.lib.finance.pricing.contracts.FixedExchangeMomentsContractCommon
              |
              +--webcab.lib.finance.pricing.contracts.FixedExchangeMarkovContractCommon
                    |
                    +--webcab.lib.finance.pricing.core.contracts.RegularPayoffContractCommon
                          |
                          +--webcab.lib.finance.pricing.contracts.standard.AsianOption
All Implemented Interfaces:
FixedExchangeMarkovContract, FixedExchangeMomentsContract, GeneralContract, RegularPayoffContract, Serializable

public class AsianOption
extends RegularPayoffContractCommon
implements RegularPayoffContract

Implements an asian option. This is the Markovian version of the contract so it requires the arithmetic or geometric average to be a model variable. Therefore, when constructing the compound model you must include as a submodel an instance of AverageModel. If you prefer a simpler way of pricing an asian option you can use the path dependent version (AsianOptionPathDependent) which does not need a model for the average.

There are four types of asian options:

The average can be arithmetic or geometric.

Implicitly the average of the first price found in the global context graph is used. You can also specify the exact name for an average context to be used. This must be the one you gave as the first parameter in AverageModel constructor.

See Also:
Serialized Form

Field Summary
static int ARITHMETIC
           
static int CALL
           
static int GEOMETRIC
           
static int PUT
           
static int RATE
           
static int STRIKE
           
 
Fields inherited from class webcab.lib.finance.pricing.contracts.GeneralContractCommon
BUYER_INITIATED, NO_EARLY_EXERCISE, SELLER_INITIATED
 
Constructor Summary
AsianOption(int callPut, int strikeRate, int arithmGeom, double maturity, double strike, boolean isAmerican)
          Creates a new asian option.
AsianOption(String underlyingContextName, int callPut, int strikeRate, int arithmGeom, double maturity, double strike, boolean isAmerican)
          Creates a new asian option using a specified average context.
 
Method Summary
 int getEarlyExercise()
           
 double getExpiry()
          Returns the maturity time for this contract.
 double[] getMoments()
          Returns an array containing the moments of all cash exchanges (payoffs).
 int getNMoments()
          Returns the total number of payoffs for the contract.
 double getPayoff(int moment, ContextGraph contextGraph, StochasticDifferentialModel updatedModel)
          Returns the amount exchanged at a moment specified by its index in the payoff moments vector (the vector returned by method getMoments()).
 boolean needsUpdatedModel()
          Returns whether this contract is a multi-order contract.
 
Methods inherited from class webcab.lib.finance.pricing.core.contracts.RegularPayoffContractCommon
getMaxDependencyOrder
 
Methods inherited from class webcab.lib.finance.pricing.contracts.FixedExchangeMarkovContractCommon
getPayoff
 
Methods inherited from class webcab.lib.finance.pricing.contracts.FixedExchangeMomentsContractCommon
getAccumulatedCashflow, getFirstMoment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface webcab.lib.finance.pricing.core.contracts.RegularPayoffContract
getMaxDependencyOrder
 
Methods inherited from interface webcab.lib.finance.pricing.contracts.FixedExchangeMomentsContract
getFirstMoment, getPayoff
 
Methods inherited from interface webcab.lib.finance.pricing.contracts.GeneralContract
getAccumulatedCashflow
 

Field Detail

CALL

public static final int CALL
See Also:
Constant Field Values

PUT

public static final int PUT
See Also:
Constant Field Values

STRIKE

public static final int STRIKE
See Also:
Constant Field Values

RATE

public static final int RATE
See Also:
Constant Field Values

ARITHMETIC

public static final int ARITHMETIC
See Also:
Constant Field Values

GEOMETRIC

public static final int GEOMETRIC
See Also:
Constant Field Values
Constructor Detail

AsianOption

public AsianOption(int callPut,
                   int strikeRate,
                   int arithmGeom,
                   double maturity,
                   double strike,
                   boolean isAmerican)
            throws InvalidParametersException
Creates a new asian option.

Parameters:
callPut - either CALL or PUT
strikeRate - either STRIKE or RATE
arithmGeom - specifies the type of averaging used. Either ARITHMETIC or GEOMETRIC
maturity - the expiry time (in years, absolute time)
strike - the strike price - used only for rate (price) asian options
isAmerican - specifies if the buyer can exercise the option earlier (American style option).
Throws:
InvalidParametersException

AsianOption

public AsianOption(String underlyingContextName,
                   int callPut,
                   int strikeRate,
                   int arithmGeom,
                   double maturity,
                   double strike,
                   boolean isAmerican)
            throws InvalidParametersException
Creates a new asian option using a specified average context.

Parameters:
underlyingContextName - the name of the average context. This should be the first parameter given to the AverageModel constructor.
callPut - either CALL or PUT
strikeRate - either STRIKE or RATE
arithmGeom - specifies the type of averaging used. Either ARITHMETIC or GEOMETRIC
maturity - The expiry time (in years, absolute time)
strike - the strike price - used only for rate (price) asian options
isAmerican - specifies if the buyer can exercise the option earlier (American style option).
Throws:
InvalidParametersException
Method Detail

getExpiry

public double getExpiry()
Description copied from interface: GeneralContract
Returns the maturity time for this contract.

Specified by:
getExpiry in interface GeneralContract
Specified by:
getExpiry in class GeneralContractCommon
Returns:
double

getMoments

public double[] getMoments()
Description copied from interface: FixedExchangeMomentsContract
Returns an array containing the moments of all cash exchanges (payoffs). It is required that this array is sorted in ascending order. The moments are given as absolute times, not time relative to settlement date.

Specified by:
getMoments in interface FixedExchangeMomentsContract
Specified by:
getMoments in class FixedExchangeMomentsContractCommon
Returns:
double[]

getNMoments

public int getNMoments()
Description copied from interface: FixedExchangeMomentsContract
Returns the total number of payoffs for the contract. This number must be equal with the length of the vector returned by the getMoments() method.

Specified by:
getNMoments in interface FixedExchangeMomentsContract
Specified by:
getNMoments in class FixedExchangeMomentsContractCommon
Returns:
int

getPayoff

public double getPayoff(int moment,
                        ContextGraph contextGraph,
                        StochasticDifferentialModel updatedModel)
                 throws BondsException
Description copied from interface: FixedExchangeMarkovContract
Returns the amount exchanged at a moment specified by its index in the payoff moments vector (the vector returned by method getMoments()). Only the current values of the variables are available (the current context graph).

Specified by:
getPayoff in interface FixedExchangeMarkovContract
Specified by:
getPayoff in class FixedExchangeMarkovContractCommon
Parameters:
moment - the index of the moment for which the payoff is computed (the current moment)
contextGraph - the context graph produced by the model. The context graph contains a snapshot of the models' variables at the current moment. See ContextGraph for information on how to search for a specific variable on which the contract is dependent.
updatedModel - an instance of the model used to price the contract. It can be used with a pricer to evaluate an underlying contract (in case we have a second-order contract like, for example, a bond option). The initial values for this models' variables are implicitly set to the current values. If the higher order contract is path dependent and needs the values from the underlying contract at previous moments of time, you need to set the initial values of the model to the values that existed at that moment of time. You can use the path to find the historic context and then use the updatedModel.setInitialContext() method to set the initial values.
Returns:
double which represents the cash flow resulting from a contract at a given point in time.
Throws:
BondsException

getEarlyExercise

public int getEarlyExercise()
Overrides:
getEarlyExercise in class GeneralContractCommon

needsUpdatedModel

public boolean needsUpdatedModel()
Description copied from interface: GeneralContract
Returns whether this contract is a multi-order contract. That is if it must evaluate another contract in order to compute the payoffs. If this is true, the updatedModel parameter of getAccumulatedCashflow() method is needed. This information is used by the pricing algorithm to decide if it is necessary to initialize the above mentioned parameter. The overall efficiency of the algorithm is improved if the initialization is not performed.

Specified by:
needsUpdatedModel in interface GeneralContract
Overrides:
needsUpdatedModel in class GeneralContractCommon
Returns:
if the return value is false the updatedModel parameter is not correctly initialized and must not be used.

WebCab Bonds
v2.01
(J2SE Edition)