WebCab Bonds
v2.01
(J2SE Edition)

webcab.lib.finance.pricing.contracts
Interface GeneralContract

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

public interface GeneralContract
extends Serializable

This interface defines the most general form of a contract. You should never implement this interface directly. The correct way of defining a GeneralContract is by extending the abstract class GeneralContractCommon.

A financial contract is an agreement between two parties to exchange assets in the future. You know the value of the assets today, but not in the future. Therefore you have to consider a model for the dynamics of the asset values in order to evaluate such a contract today. The model supplies the values of the variables at future moments so the payoffs can be computed. To define such a contract you must specify all the payoffs that take place between any two moments of time t1 and t2, knowing the models' variables now and in the past. We will refer to payoffs with the more generic term of cash exchange. You will return the amounts that are exchanged (received by one party and paid by the other) together with the moments when these exchanges take place. To compute the payoffs (i.e. cash exchanges) you are given access to the context graph produced by the model. You can search in this context by name or by type and dependencies. You also have access to the full history of the evolution of models' variables through the paths parameter. In addition to the cash excahnge you have to specify also the maturity time of the contract ( by implementing the getExpiry() method). The current version does not allow you the possibility of pricing contracts with early exercise features (e.g. American options, callable bonds, convertible bonds).

You should implement the contract at this level of generality only if you don't know at settlement date the exact moments when the payoffs take place. One example is a barrier contract with immediate rebate. In this case the moment itself is dependent upon models' variables, so it can be stochastic. If this is not the case and moments are known in advance you should implement a more specialized version of the contract to take advantage of more efficient pricing algorithms. That is you should extend one of the abstract classes: FixedExchangeMomentsContractCommon, FixedExchangeMarkovContractCommon or DeterministContractCommon.


Method Summary
 CashExchange[] getAccumulatedCashflow(double t1, double t2, ContextGraph contextGraph, Path paths, StochasticDifferentialModel updatedModel)
          Returns an array of cash exchanges occuring in a given interval.
 double getExpiry()
          Returns the maturity time for this contract.
 boolean needsUpdatedModel()
          Returns whether this contract is a multi-order contract.
 

Method Detail

getAccumulatedCashflow

public CashExchange[] getAccumulatedCashflow(double t1,
                                             double t2,
                                             ContextGraph contextGraph,
                                             Path paths,
                                             StochasticDifferentialModel updatedModel)
                                      throws BondsException
Returns an array of cash exchanges occuring in a given interval. A cash exchange is a pair (moment, amount). The times are absolute (e.g. February 1-st 2004 will be represented as 2004 + 1./12 and not as time since settlement). It is garanteed that t1 is less then or equal with t2. If t1 = t2 you must check if there is a payoff occuring at that exact moment. If t1 < t2 you must check if there is a payoff occuring anywhere in the interval t1 < t <= t2.

Parameters:
t1 - the left margin of the time interval (excluded in the evaluation)
t2 - the right margin of the time interval (included in the evaluation)
contextGraph - the context graph produced by the model. The context graph contains a snapshot of the models' variables. The variables are considered to be constant over the whole t1 < t <= t2 interval. 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 t1 (inclusive) 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 you use the updatedModel.setInitialContext() method to set the initial values.
Returns:
CashExchange[]
Throws:
BondsException

getExpiry

public double getExpiry()
Returns the maturity time for this contract.

Returns:
double

needsUpdatedModel

public boolean needsUpdatedModel()
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.

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)