|
WebCab Bonds v2.01 (J2SE Edition) |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
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 |
public double[] getMoments()
public int getNMoments()
getMoments()
method.
public double getPayoff(int moment,
ContextGraph contextGraph,
Path paths,
StochasticDifferentialModel updatedModel)
throws BondsException
getMoments()).
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.
BondsExceptionpublic int getFirstMoment(double t)
t.
t - a point in time given as an absolute value
|
WebCab Bonds v2.01 (J2SE Edition) |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||