WebCab Bonds
v2.01
(J2SE Edition)

webcab.lib.finance.pricing.contracts
Interface FixedExchangeMomentsContract

All Superinterfaces:
GeneralContract, Serializable
All Known Subinterfaces:
DeterministContract, ExplicitBoundariesContract, FixedExchangeMarkovContract, RegularPayoffContract
All Known Implementing Classes:
AsianOption, AsianOptionPathDependent, BarrierContractPathDependent, BinaryOption, CapForward, CapSpot, CouponBond, CouponBondOption, DeterministContractCommon, ExplicitBoundariesContractCommon, FixedExchangeMarkovContractCommon, FixedExchangeMomentsContractCommon, FixedForFixedSwap, FloorForward, FloorSpot, Forward, ForwardStartAtTheMoneyOption, Future, InterestRateSwapForward, InterestRateSwapSpot, LookbackOption, LookbackOptionPathDependent, RegularPayoffContractCommon, SecondOrderCallOptionExample, SwapForward, SwapSpot, TriggeredContract, VanillaInterestRateSwapForward, VanillaInterestRateSwapSpot, VanillaOption, ZeroCouponBond, ZeroCouponBondOption, ZeroCouponBondOptionExample

public interface FixedExchangeMomentsContract
extends GeneralContract

This interface defines a contract for which the moments of all cash exchanges (payoffs) are known at settlement. You should never implement this interface directly. The correct way of defining a FixedExchangeMomentsContract is by extending the abstract class FixedExchangeMomentsContractCommon.

You should implement the contract at this level of generality only if your contract is path dependent (that is you use the paths parameter in the getPayoff() method). Examples of such contracts are asian options and barrier options. Pricing a path dependent contract can be rather time consuming. In practice the following trick is generally used in order to get rid of path-dependency at contract level.

A path dependent contract can almost always be transformed into a non-path dependent (Markovian) contract if a new variable containing the needed path-dependent information is added to the model. For example, the Markov version of an Asian option does not use the history of the variables when it computes the payoffs but requires that the average of the price is present in the context graph. In order to do this a model for the average is needed.

If the contract is Markovian or can be transformed into a Markovian one by using the trick mentioned above you should extend a more specialized abstract class like: FixedExchangeMarkovContract or DeterministContract.


Method Summary
 int getFirstMoment(double t)
          Returns the index of the first exchange moment greater than time t.
 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, Path paths, StochasticDifferentialModel updatedModel)
          Returns the amount exchanged at a moment specified by its index in the payoff moments vector (the vector returned by method getMoments()).
 
Methods inherited from interface webcab.lib.finance.pricing.contracts.GeneralContract
getAccumulatedCashflow, getExpiry, needsUpdatedModel
 

Method Detail

getMoments

public double[] getMoments()
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.

Returns:
double[]

getNMoments

public int getNMoments()
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.

Returns:
int

getPayoff

public double getPayoff(int moment,
                        ContextGraph contextGraph,
                        Path paths,
                        StochasticDifferentialModel updatedModel)
                 throws BondsException
Returns the amount exchanged at a moment specified by its index in the payoff moments vector (the vector returned by method getMoments()).

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.
paths - provides access to previous values of all the models' variables. The full history of the simulation between settlement and the current moment is accessible.
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 for 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
Throws:
BondsException

getFirstMoment

public int getFirstMoment(double t)
Returns the index of the first exchange moment greater than time t.

Parameters:
t - a point in time given as an absolute value
Returns:
int

WebCab Bonds
v2.01
(J2SE Edition)