|
WebCab Bonds v2.01 (J2SE Edition) |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
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.BinaryOption
Implements a binary option contract. Implicitly it is considered to be a
stock option, so a PriceContext} is required to be provided by the model.
If you want to evaluate an option on some other variable of the model (like a volatility or
an interest rate) you can do it by specifying the name of the context identifying
the variable. Usually you construct a compound model, each submodel providing one of
the model's variables (a submodel for the price, another for the volatility etc.).
The first parameter given to the submodel constructor is always a String
which identifies the variable provided by that submodel (to be more precise it
is the name of the context produced by the submodel - which will be a node in
the context graph produced by the compound model - see Context and
ContextGraph classes for details). If you give this name as a parameter in
BinaryOption constructor the underlying will be the scalar value
contained in context with that name. If the context does not contain a scalar value
an exception will be thrown.
If you want to price an option on another contract, for which you do not have a model, you can give the contract as a parameter to the constructor. You should be aware of the fact that in this case you have a second order option which makes the pricing algorithm hundreds of times slower than normal.
| Field Summary | |
static int |
CALL
|
static int |
PUT
|
| Fields inherited from class webcab.lib.finance.pricing.contracts.GeneralContractCommon |
BUYER_INITIATED, NO_EARLY_EXERCISE, SELLER_INITIATED |
| Constructor Summary | |
BinaryOption(GeneralContract underlyingContract,
Pricer underlyingPricer,
int type,
double maturity,
double strike,
double amount,
boolean isAmerican)
Creates a binary option on another contract. |
|
BinaryOption(int type,
double maturity,
double strike,
double amount,
boolean isAmerican)
Creates a stock binary option contract. |
|
BinaryOption(String underlyingContextName,
int type,
double maturity,
double strike,
double amount,
boolean isAmerican)
Creates a binary option on a generic asset for which a model is provided. |
|
| 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 |
public static final int CALL
public static final int PUT
| Constructor Detail |
public BinaryOption(int type,
double maturity,
double strike,
double amount,
boolean isAmerican)
throws InvalidParametersException
type - either BinaryOption.CALL (for call options) or BinaryOption.PUT (for put options)maturity - the expiry time (in years, absolute time)strike - the strike priceamount - the sum which will be payed if the option is exercisedisAmerican - specifies if the buyer can exercise the option earlier (American style option).
InvalidParametersException
public BinaryOption(String underlyingContextName,
int type,
double maturity,
double strike,
double amount,
boolean isAmerican)
throws InvalidParametersException
underlyingContextName - the name of the context produced by the underlying variable (asset)
model. This should be a submodel of the compound model used for pricing. This name is usually
the first parameter in a model constructor.type - either BinaryOption.CALL (for call options) or BinaryOption.PUT (for put options)maturity - the expiry time (in years, absolute time)strike - the strike priceamount - the sum which will be payed if the option is exercisedisAmerican - specifies if the buyer can exercise the option earlier (American style option).
InvalidParametersException
public BinaryOption(GeneralContract underlyingContract,
Pricer underlyingPricer,
int type,
double maturity,
double strike,
double amount,
boolean isAmerican)
throws InvalidParametersException
underlyingContract - an instance of the underlying contractunderlyingPricer - an instance of the pricer that will be used to
evaluate the underlying contract.type - either BinaryOption.CALL (for call options) or BinaryOption.PUT (for put options)maturity - the expiry time (in years, absolute time)strike - the strike priceamount - the sum which will be payed if the option is exercisedisAmerican - specifies if the buyer can exercise the option earlier (American style option).
InvalidParametersException| Method Detail |
public double getExpiry()
GeneralContract
getExpiry in interface GeneralContractgetExpiry in class GeneralContractCommonpublic double[] getMoments()
FixedExchangeMomentsContract
getMoments in interface FixedExchangeMomentsContractgetMoments in class FixedExchangeMomentsContractCommonpublic int getNMoments()
FixedExchangeMomentsContractgetMoments()
method.
getNMoments in interface FixedExchangeMomentsContractgetNMoments in class FixedExchangeMomentsContractCommon
public double getPayoff(int moment,
ContextGraph contextGraph,
StochasticDifferentialModel updatedModel)
throws BondsException
FixedExchangeMarkovContractgetMoments()).
Only the current values of the variables are available (the current context graph).
getPayoff in interface FixedExchangeMarkovContractgetPayoff in class FixedExchangeMarkovContractCommonmoment - 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.
BondsExceptionpublic int getEarlyExercise()
getEarlyExercise in class GeneralContractCommonpublic boolean needsUpdatedModel()
GeneralContractupdatedModel 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.
needsUpdatedModel in interface GeneralContractneedsUpdatedModel in class GeneralContractCommonfalse the updatedModel parameter
is not correctly initialized and must not be used.
|
WebCab Bonds v2.01 (J2SE Edition) |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||