|
WebCab Bonds Demo (J2EE Edition) |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
The Interest Derivatives (BETA) Module is only included here for demonstration purposes. To get the latest version of this module please download the latest version of WebCab Bonds from our Web site.
Using this Enterprise JavaBean you are able to price a wide range of financial contracts on equity and interest instruments using a wide variety of price, interest rate and volatility models.
In order to price a contract in accordance with a given combination of models you will need to:
setPriceBarrier is you want the
option to be triggered by a barrier.
Once you have set the contract and the price, barrier (if applicable), interest
and volatility models you will be able to run the Monte Carlo simulation by calling
runSimulation. Once the simulation is complete you will be able
to read off the price of the given contract in accordance with the models specified by
the above set methods. You will also be able read off the standard deviation of the
price estimate and the minimum and maximum price expected to a given level of
confidence, using:
getPrice() - Reads the price.
getStddev() - Reads the expected deviation of the price estimate.
getMinPrice() - The minimum price to a given level of confidence.
getMaxPrice() - The maximum price to a given level of confidence.
The Set Methods fall into the following categories:
To price a financial contract you will need to call one of the set methods from each of the categories listed above in exactly the same fashion as is demonstrated within the QA Clients and is described above. Once you have called one of the "Simulation Run" methods you will be able to read off the values using the Get Methods.
For your convenience we have listed below these set methods contained within each of these categories with a brief description (or naming) following by a link to the methods documentation.
setAsianOptionContract
setBinaryOptionContract
setCapForwardContract
setCapSpotContract
setCouponBondContract
setFloorForwardContract
setFloorSpotContract
setForwardStartAtTheMoneyOptionContract
setLookbackOption
setLadderOption
setVanillaInterestRateSwapForward
setVanillaInterestRateSwapSpot
setVanillaOptionContract
setZeroCouponBondContract
setPriceBarrier
setPriceBarrier
setPriceBarrier
setForwardContract
setFutureContract
Remark: Within the documentation (given below) of a number of contracts we used the
max operator. The max operator applied to two real numbers, say
A and B, denoted by max(A,B), is equal to the maximum
of A and B.
setConstantRateModel
setConstantYieldCurveModel
setVasicekRateModel
setBlackDermanToyRateModel
setBrennanSchwartzRateModel
setCoxIngersollRossRateModel
setFittedHoLeeRateModel
setFittedHullWhiteRateModel
setFongVasicekRateModel
setHJMRateModel
setHoLeeRateModel
setHoLeeRateModel
setLongstaffSchwartzRateModel
setSimplifiedBGMRateModel
setConstantPriceModel(double price)
setDeterministPriceModel(KOrderDiff priceFunction, double currentTime)
setLognormalPriceModel
setPoissonPriceModel
setConstantVolatilityModel(double)
setDeterministVolatilityModel
setHullWhiteVolatilityModel
setHostonVolatilityModel
runSimulation(int, int, double)
runSimulation(int, double, double, int, double)
getPrice()
getStddev()
getMinPrice(double)
getMaxPrice(double)
Probably the easiest way the see the application of this pricing module and the ease
with which custom pricing models can be formulated for a range of interest rate derivatives
is to view and run the QA Clients provided with this component. These clients can be found
within the Client / QAClients / folder of this installation package.
The logic of the code of each of these client examples take the following form:
| Method Summary | |
double |
getMaxPrice(double confidence)
Returns the maximum value of the estimated price expected for a given confidence level for the last Monte Carlo simulation performed of the set contract (i.e. asset) in accordance with the price, volatility and interest rate models used. |
double |
getMinPrice(double confidence)
Returns the minimum value of the estimated price expected for a given confidence level for the last Monte Carlo simulation performed of the set contract (i.e. asset) in accordance with the price, volatility and interest rate models used. |
double |
getPrice()
Returns the price of the contract set (i.e. asset) priced in accordance with the price, volatility and interest rate models set using the Monte Carlo simulation performed. |
double |
getStddev()
Returns the standard deviation of the price estimate given by the last Monte Carlo simulation performed of the set contract (i.e. asset) in accordance with the price, volatility and interest rate models used. |
void |
runSimulation(int timeSteps,
double confidence,
double maxRelativeError,
int maxRandomWalks,
double timeToEvaluation)
Performs the Monte Carlo simulation for the set (cash or derivative) contract, in accordance to the set price model, interest rate model and volatility model; and returns the result found when it satisfies a given level in confidence and maximum relative error. |
void |
runSimulation(int monteCarloTimesteps,
int monteCarloRandomWalks,
double currentTime)
Performs the Monte Carlo simulation for a fixed number of random walks for the set (cash or derivative) contract, in accordance to the set price model, interest rate model and volatility model. |
void |
setAsianOptionContract(BlackScholesConstants callPut,
BlackScholesConstants strikeRate,
BlackScholesConstants arithmGeom,
double maturity,
double strike,
double updatingInterval)
Implements an Asian option contract. |
void |
setBinaryOptionContract(BlackScholesConstants type,
double maturity,
double strike,
double amount)
Implements a stock Binary option contract. |
void |
setBlackDermanToyRateModel(Function phi,
KOrderDiff sigma,
double initialRate)
Implements the Black, Derman & Toy (BDT) one factor stochastic spot rate model. |
void |
setBlackKarasinskiRateModel(Function phi,
Function modelFunction,
Function sigma,
double initialRate)
Implements the Black & Karasinski is a one factor stochastic spot rate model. |
void |
setBrennanSchwartzRateModel(double a1,
double b1,
double sigma1,
double a2,
double b2,
double c2,
double sigma2,
double initialShortRate,
double initialLongRate)
Implements the Brennan & Schwartz two factor stochastic interest rate model. |
void |
setCapForwardContract(double principal,
double firstResetDate,
double capRate,
double tenor,
double expiry)
Implements a Cap contract which can only be priced in conjunction with a forward rate model. |
void |
setCapSpotContract(double principal,
double firstResetDate,
double capRate,
double tenor,
double expiry)
Implements a Cap contract which can be priced in conjunction with any interest rate model. |
void |
setConstantPriceModel(double price)
Implements the constant price model which assumes that the price is constant. |
void |
setConstantRateModel(double rate)
Implements the Constant Spot Rate model which assumes that the spot rate is a constant. |
void |
setConstantVolatilityModel(double volatility)
Implements the constant volatility model which is deterministic in nature. |
void |
setConstantYieldCurveModel(double[] forwardRates,
double[] maturities,
int numberMaturities,
BlackScholesConstants interpolationType,
double currentTime)
Implements the Constant (in time) yield curve interest rate model. |
void |
setCouponBondContract(double principal,
double firstCouponDate,
double couponInterest,
double couponPeriod,
double expiry)
Implements the fixed income security (i.e. contract) known as a Coupon Bond. |
void |
setCoxIngersollRossRateModel(double equilibriumRate,
double adjustmentSpeed,
double sigma,
double initialRate)
Implements the Cox, Ingersoll and Ross interest rate model. |
void |
setDeterministPriceModel(KOrderDiff priceFunction,
double currentTime)
Implements a General Deterministic Price Model. |
void |
setDeterministVolatilityModel(KOrderDiff volatilityFunction,
double value,
double currentTime)
Implements a General deterministic Volatility model. |
void |
setFittedHoLeeRateModel(double[] forwardRates,
double[] maturities,
int numberMaturities,
BlackScholesConstants interpolationType,
double currentTime,
double sigma)
Implements the Ho & Lee model of the spot rate with automatic yield curve fitting using forward rates. |
void |
setFittedHullWhiteRateModel(double[] forwardRates,
double[] maturities,
int numberMaturities,
BlackScholesConstants interpolationType,
double currentTime,
double adjustmentSpeed,
double sigma)
Implements the Hull & White model of the spot rate with automatic yield curve fitting using forward rates. |
void |
setFloorForwardContract(double principal,
double settlement,
double floorRate,
double tenor,
double expiry)
Implements a Floor contract which can only be priced in conjunction with forward curve models. |
void |
setFloorSpotContract(double principal,
double firstResetDate,
double floorRate,
double tenor,
double expiry)
Implements a Floor contract which can be pricing in conjunction within any interest rate model. |
void |
setFongVasicekRateModel(double spotRateMean,
double sqrVolMean,
double meanReversionRateSpot,
double meanReversionRateVariance,
double volatilityVariance,
double initialSpotRate,
double initialSqrtVolatility)
Implements the Fong & Vasicek model which is a two factor model providing both the spot rate and the volatility of the spot rate. |
void |
setForwardContract(double settledPrice,
double maturity,
double amount)
Implements a forward contract. |
void |
setForwardStartAtTheMoneyOptionContract(BlackScholesConstants type,
double maturity,
double startTime,
double amount)
Implements a Forward Start stock option contract. |
void |
setFutureContract(double settledPrice,
double settlementTime,
double maturity,
double amount,
double marginingPeriod)
Implements a futures contract. |
void |
setHJMRateModel(double[][] historicZcbPrices,
double[] forwardRates,
double[] maturities,
int numberMaturities,
double tolerance,
int numberObservations,
int numberPCAVectors,
double dt,
double currentTime,
int internalMemorySteps)
Implements the Heath, Jarrow and Morton model of the forward rate curve. |
void |
setHoLeeRateModel(Function drift,
double sigma,
double initialRate)
Implements the Ho & Lee one factor stochastic spot rate model which provide a spot rate process which is a semi martingale. |
void |
setHostonVolatilityModel(double gamma,
double delta,
double initialVolatility)
Implements the Hoston Stochastic Volatility model. |
void |
setHullWhiteRateModel(Function averageLongTermRate,
double adjustmentSpeed,
double sigma,
double initialRate)
Implements the Hull & White one factor stochastic spot rate model. |
void |
setHullWhiteVolatilityModel(double adjustmentSpeed,
double averageLongTermVariance,
double varianceVolatility,
double initialVariance)
Implements the Hull & White Stochastic model of the Variance (recall that, volatility = sqrt(variance)).
|
void |
setLadderOption(BlackScholesConstants callPut,
BlackScholesConstants strikeRate,
BlackScholesConstants minMax,
double maturity,
double strike,
double[] ladderPrices,
double updatingInterval)
Implements a Ladder option contract. |
void |
setLognormalPriceModel(double initialPrice)
Implements the Lognormal model of the dynamics of the asset prices. |
void |
setLongstaffSchwartzRateModel(double xMean,
double yMean,
double reversionX,
double reversionY,
double c,
double d,
double initialX,
double initialY)
Implements the Longstaff & Schwartz two factor stochastic interest rate model. |
void |
setLookbackOption(BlackScholesConstants callPut,
BlackScholesConstants strikeRate,
BlackScholesConstants minMax,
double maturity,
double strike,
double updatingInterval)
Implements a Lookback option contract. |
void |
setPoissonPriceModel(double initialPrice,
double intensity,
double jumpStddev)
Implements the jump-diffusion price model for the dynamics of asset prices. |
void |
setPriceBarrier(BlackScholesConstants triggeredBy,
BlackScholesConstants type,
BlackScholesConstants upDown,
BlackScholesConstants inOut,
double barrierLevel,
double rebate,
double monitoringInterval,
double timeToTrigger)
Implements a Barrier, Parisian or Parasian contract triggered by a price with a simple constant barrier. |
void |
setSimplifiedBGMRateModel(double[] discreteCurrentForwardRate,
double[] capletVolatilities,
double[] resetDates,
int forwardCurveSteps,
double currentTime)
Implements the Brace, Gatarek and Musiela (BGM) model (also known as the LIBOR market model) of the forward rate curve. |
void |
setVanillaInterestRateSwapForward(double principal,
double fixedRate,
double firstResetDate,
double tenor,
double expiry)
Implements a standard plain Vanilla Swap contract which must be priced in conjunction with a forward curve rate model. |
void |
setVanillaInterestRateSwapSpot(double principal,
double fixedRate,
double firstResetDate,
double tenor,
double expiry)
Implements an approximation of a plain vanilla swap contract which can be priced in conjunction with any spot rate model. |
void |
setVanillaOptionContract(BlackScholesConstants callPut,
double maturity,
double strike,
double amount)
Implements a Vanilla stock option contract. |
void |
setVanillaSwaptionSpotContract(BlackScholesConstants callPut,
double maturity,
double strike,
double amount,
double principal,
double fixedRate,
int monteCarloTimesteps,
int monteCarloRandomWalks,
double firstResetDate,
double tenor,
double expiry)
Implements an Option on a Vanilla Swap approximation which can be priced in accordance with any rate model. |
void |
setVasicekRateModel(double averageLongTermRate,
double adjustmentSpeed,
double sigma,
double initialRate)
Implements the Vasicek one factor stochastic model of the spot rate. |
void |
setZeroCouponBondContract(double principal,
double maturity)
Implements a fixed income security known as a Zero Coupon bond. |
| Methods inherited from interface javax.ejb.EJBObject |
getEJBHome, getHandle, getPrimaryKey, isIdentical, remove |
| Method Detail |
public void setAsianOptionContract(BlackScholesConstants callPut,
BlackScholesConstants strikeRate,
BlackScholesConstants arithmGeom,
double maturity,
double strike,
double updatingInterval)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
There are four types of Asian option:
Where the average use can be either arithmetic or geometric.
callPut - either BlackScholesConstants.CALL or BlackScholesConstants.PUT, to indicate whether the option is a call option or a put option.strikeRate - either STRIKE or RATEarithmGeom - specifies the type of averaging used. Either ARITHMETIC or GEOMETRICmaturity - the expiry time (in years, absolute time)strike - the strike price - used only for rate (price) Asian optionsupdatingInterval - the interval of updating the value of the average in years (i.e. 0.1 means updating with take place 10 times a year.
EvaluationException
InterestDerivativesDemoException
RemoteException
public void setBinaryOptionContract(BlackScholesConstants type,
double maturity,
double strike,
double amount)
throws InterestDerivativesDemoException,
RemoteException
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 exercised
InterestDerivativesDemoException
RemoteException
public void setCapForwardContract(double principal,
double firstResetDate,
double capRate,
double tenor,
double expiry)
throws InterestDerivativesDemoException,
RemoteException
A cap guarantees to the holder that floating interest rates will not exceed a predefined maximum level. If the rates go beyond this level, the holder will be compensated by receiving the fraction that capped from a fixed premium.
The payoff function for this contract is:
principal * max(floatingRate - capRate, 0).
principle is the sum which is insured against interest rate fluctuations,
floatingRate is the
capRate is the
The Cap contract can only be priced using a forward curve model for the interest rates.
Two such models provide within this pricing framework our: setHJMRateModel(double[][], double[], double[], int, double, int, int, double, double, int) and
setSimplifiedBGMRateModel(double[], double[], double[], int, double).
principal - the sum which is insured against interest rate fluctuationsfirstResetDate - the moment when the first payment takes placecapRate - the maximum admissible interest rate without compensationtenor - the period between two consecutive regular paymentsexpiry - the maturity time of the contract
InterestDerivativesDemoException
RemoteException
public void setCapSpotContract(double principal,
double firstResetDate,
double capRate,
double tenor,
double expiry)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
A cap guarantees to the holder that floating interest rates will not exceed a predefined maximum level. If the rates go beyond this level, the holder will be compensated by receiving the fraction that capped from a fixed premium.
The payoff function for this contract is:
principal * max(floatingRate - capRate, 0).
principle is the sum which is insured against interest rate fluctuations,
floatingRate the present floating rate against which the swap is considered and
capRate is the maximum admissible interest rate before compensation is due.
principal - the sum which is insured against interest rate fluctuationsfirstResetDate - the moment when the first payment takes placecapRate - the maximum admissible interest rate without compensationtenor - the period between two consecutive regular paymentsexpiry - the maturity time of the contract
EvaluationException
InterestDerivativesDemoException
RemoteException
public void setCouponBondContract(double principal,
double firstCouponDate,
double couponInterest,
double couponPeriod,
double expiry)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
A coupon bond pays a principal at expiry (in exactly the same way as
setZeroCouponBondContract(double, double)). Additionally it pays an interest on the
principal at fixed and equal intervals of time (know as the coupon period) beginning
with a specified moment first coupon date until expiry.
principal - the amount paid at expiryfirstCouponDate - the time when the first coupon is paidcouponInterest - the fraction of the principal paid at each coupon datecouponPeriod - the interval between two coupon paymentsexpiry - the moment when the principal is paid
EvaluationException
InterestDerivativesDemoException
RemoteException
public void setFloorForwardContract(double principal,
double settlement,
double floorRate,
double tenor,
double expiry)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
A floor guarantees to the holder that floating interest rates will not exceed a predefined maximum level. If the rates go beyond this level, the holder will be compensated by receiving the fraction that is beneath the minimum from a fixed premium.
The payoff function for this contract is:
principal * max(floorRate - floatingRate, 0).
principle is the sum which is insured against interest rate fluctuations,
floatingRate the present floating rate against which the floor is considered and
floorRate is the minimum admissible interest rate before compensation is due.
The Cap contract can only be priced using a forward curve model for the interest rates.
Two such models are presently provided: setHJMRateModel(double[][], double[], double[], int, double, int, int, double, double, int) and
setSimplifiedBGMRateModel(double[], double[], double[], int, double).
principal - the sum which is insured against interest rate fluctuationssettlement - the settlement date for this contract (first cash flow will be exchanged at moment settlement + tenorfloorRate - the minimum admissible interest rate without compensationtenor - the period between two consecutive regular paymentsexpiry - the maturity time of the contract
EvaluationException
InterestDerivativesDemoException
RemoteException
public void setFloorSpotContract(double principal,
double firstResetDate,
double floorRate,
double tenor,
double expiry)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
A floor guarantees to the holder that floating interest rates will not go beneath a predefined minimum level. If this happens, the holder will be compensated by receiving the fraction beneath the level from a fixed premium.
The payoff function for this contract is:
principal * max(floorRate - floatingRate, 0).
principle is the sum which is insured against interest rate fluctuations,
floatingRate the present floating rate against which the floor is considered and
floorRate is the minimum admissible interest rate before compensation is due.
principal - the sum which is insured against interest rate fluctuationsfirstResetDate - the moment when the first payment takes placefloorRate - the minimum admissible interest rate without compensationtenor - the period between two consecutive regular paymentsexpiry - the maturity time of the contract
EvaluationException
InterestDerivativesDemoException
RemoteException
public void setForwardContract(double settledPrice,
double maturity,
double amount)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
The payoff of a forward contract is:
payoff = (finalPrice - settledPrice) * amount
finalPrice is the market price of the
futures contract at expiry, settledPrice is the
settlement price and amount is the amount
which is paid at settlement.
Though payoff function of the future and forward contract are the same these two contracts do fundamentally differ. The difference lies in the fact that the a future contract has a Mark-To-Market characteristic and hence provides a continuous cash flow, positive or negative, based on the current value of the underlying variable. This process is also often referred to as remargining and has the additional property that it reduces the credit exposure of the contract for both counter parties.
The principle reason for the inclusion of a forward contract with are general framework is to allow the implementation of the pricing of compound (non-linear) contracts involving Forwards. For example, an options contract which has a payoff of a forward contract, i.e. an option on a future contract.
settledPrice - the price fixed at settlement (strike price)maturity - the expiry time (in years, absolute time)amount - the number of shares which will be bought or sold
EvaluationException
InterestDerivativesDemoException
RemoteException
public void setForwardStartAtTheMoneyOptionContract(BlackScholesConstants type,
double maturity,
double startTime,
double amount)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
type - either VanillaOption.CALL (for call options) or VanillaOption.PUT (for put options)maturity - the expiry time (in years, absolute time)startTime - the starting moment. The strike price is considered to be the price recorded at this momentamount - the number of shares which will be bought or sold
EvaluationException
InterestDerivativesDemoException
RemoteException
public void setFutureContract(double settledPrice,
double settlementTime,
double maturity,
double amount,
double marginingPeriod)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
The payoff of the implemented futures contract is:
finalPrice is the market price of the
futures contract at expiry, settledPrice is the
settlement price and amount is the amount
which is paid at settlement.
Though payoff function of the future and forward contract are the same these two contracts do fundamentally differ. The difference lies in the fact that the a future contract has a Mark-To-Market characteristic and hence provides a continuous cash flow, positive or negative, based on the current value of the underlying variable. This process is also often refereed to as remargining and has the additional property that it reduces the credit exposure of the contract for both counter parties.
The principle reason for the inclusion of a future contract with are general framework is to allow the implementation of the pricing of compound (non-linear) contracts involving futures. For example, an options contract which has a payoff of a futures contract, i.e. an option on a future contract.
settledPrice - the price fixed at settlement (strike price)settlementTime - the moment when the futures contract becomes effectivematurity - the expiry time (in years, absolute time)amount - the number of shares which will be bought or soldmarginingPeriod - the time interval between two successive Mark To Market cash exchanges (usually 1 day - it depends on the calendar you use how this translates into years - e.g. 1.0 / 260, where 260 is the number of business days in a year)
EvaluationException
InterestDerivativesDemoException
RemoteException
public void setLookbackOption(BlackScholesConstants callPut,
BlackScholesConstants strikeRate,
BlackScholesConstants minMax,
double maturity,
double strike,
double updatingInterval)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
There are four types of lookback options:
callPut - either CALL or PUTstrikeRate - either STRIKE or RATEminMax - specifies the type of extremum used. Either MIN or MAX.maturity - the expiry time (in years, absolute time)strike - the strike price - used only for rate (price) Asian optionsupdatingInterval - the interval of updating the value of the extremum in years (i.e. 0.1 means updating with take place 10 times a year.
EvaluationException
InterestDerivativesDemoException
RemoteException
public void setLadderOption(BlackScholesConstants callPut,
BlackScholesConstants strikeRate,
BlackScholesConstants minMax,
double maturity,
double strike,
double[] ladderPrices,
double updatingInterval)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
There are four types of ladder options:
callPut - either CALL or PUTstrikeRate - either STRIKE or RATEminMax - specifies the type of extremum used. Either MIN or MAX.maturity - the expiry time (in years, absolute time)strike - the strike price - used only for rate (price) Asian optionsladderPrices - a vector containing the discrete ladder prices.updatingInterval - the interval of updating the value of the average in years (i.e. 0.1 means updating with take place 10 times a year.
EvaluationException
InterestDerivativesDemoException
RemoteException
public void setVanillaInterestRateSwapForward(double principal,
double fixedRate,
double firstResetDate,
double tenor,
double expiry)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
The holder of this contract pays the other party a fixed percentage of the principal
whilst receiving a variable amount. That is the contract exchanges a fixed interest rate
for a floating one. Note that the rate model used will refer to a rate model for the floating
rate must be provided which must in this case be a forward curve model (such as HJM
or BGM).
This Swap contract can only be priced using a forward curve model for the interest rates.
Two such models are presently provided: setHJMRateModel and
setSimplifiedBGMRateModel.
principal - the notional principal. This it's actually not exchanged at maturity, only used to compute the cash flow.fixedRate - the fixed interest rate paidfirstResetDate - the date of the first paymenttenor - the interval between paymentsexpiry - the maturity date
EvaluationException
InterestDerivativesDemoException
RemoteException
public void setVanillaInterestRateSwapSpot(double principal,
double fixedRate,
double firstResetDate,
double tenor,
double expiry)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
The holder of this contract pays the other party a fixed percentage of the principal whilst receiving a variable amount. That's exchanging a fixed interest rate for a floating one. A model for the floating rate must be provided. This can be any interest rate model provided with our product.
principal - the notional principal. This it's actually not exchanged at maturity, only used to compute the cash flow.fixedRate - the fixed interest rate paidfirstResetDate - the date of the first paymenttenor - the interval between paymentsexpiry - the maturity date
EvaluationException
InterestDerivativesDemoException
RemoteException
public void setVanillaOptionContract(BlackScholesConstants callPut,
double maturity,
double strike,
double amount)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
The holder of a vanilla call or put option contact has the right to either buy or sell (respectively) the underlying asset at the strike price at the maturity of the contract.
callPut - either BlackScholesConstants.CALL (for call options) or BlackScholesConstants.PUT (for put options)maturity - the expiry time (in years, absolute time)strike - the strike priceamount - the number of shares which will be bought or sold
EvaluationException
InterestDerivativesDemoException
RemoteException
public void setVanillaSwaptionSpotContract(BlackScholesConstants callPut,
double maturity,
double strike,
double amount,
double principal,
double fixedRate,
int monteCarloTimesteps,
int monteCarloRandomWalks,
double firstResetDate,
double tenor,
double expiry)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
callPut - either BlackScholesConstants.CALL (for call options) or BlackScholesConstants.PUT (for put options)maturity - the expiry time (in years, absolute time)strike - the strike priceamount - the number of shares which will be bought or soldprincipal - the notional principal. This it's actually not exchanged at maturity, only used to compute the cash flow.fixedRate - the fixed interest rate paidmonteCarloTimesteps - the number of time axis divisions for one random walkmonteCarloRandomWalks - the number of random walks executedfirstResetDate - the date of the first paymenttenor - the interval between paymentsexpiry - the maturity date
EvaluationException
InterestDerivativesDemoException
RemoteException
public void setZeroCouponBondContract(double principal,
double maturity)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
The bond pays a specified amount of money known as the principal to the contract holder at the maturity of the bond.
principal - the amount received at maturitymaturity - the maturity date (absolute time - not time relative to start time).
EvaluationException
InterestDerivativesDemoException
RemoteException
public void setPriceBarrier(BlackScholesConstants triggeredBy,
BlackScholesConstants type,
BlackScholesConstants upDown,
BlackScholesConstants inOut,
double barrierLevel,
double rebate,
double monitoringInterval,
double timeToTrigger)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
triggeredBy - can be either PRICE, RISK_FREE_RATE, PRICE_VOLATILITYtype - can be either BARRIER, PARISIAN or PARASIAN.upDown - can be either UP or DOWN.inOut - can be either IN or OUT.barrierLevel - the price level for which the barrier is triggeredrebate - the compensation paid instead of the normal payoffmonitoringInterval - the variable which may trigger the contract is not continuously monitored. Only at this time interval the value is recorded and the trigger state is updated.timeToTrigger - this parameter is used only for Parisian or Parasian contracts. It is the minimum amount of time which must be spent with the barrier condition active, before the contract is triggered. For Parisians this time must be not interrupted. The Parisians use the total time spent (even with interruptions).
EvaluationException
InterestDerivativesDemoException
RemoteException
public void setConstantRateModel(double rate)
throws InterestDerivativesDemoException,
RemoteException
This interest rate model is deterministic in nature and should be very familiar to the reader since it is the interest rate model used within the classical Black-Scholes model.
rate - the constant value of the spot interest rate
InterestDerivativesDemoException
RemoteException
public void setConstantYieldCurveModel(double[] forwardRates,
double[] maturities,
int numberMaturities,
BlackScholesConstants interpolationType,
double currentTime)
throws InterestDerivativesDemoException,
RemoteException
This model assumes that the forward rate, as a function of absolute time, does not change over time. This means that, advancing in time, the spot rate follows a deterministic path, which is given by the forward rate curve set at the initial moment.
A forward rate curve is a function of one real variable namely time, and the shape of the forward curve in accordance with this model does not change with time. Here we apply interpolation and other approximation methods in order to construct the curve from a number of tabulation points. In particular, the forward rate curve is specified at different discrete maturities of the forward rate (e.g. 1 month, 2 months, 3 months, etc.). These values of the forward rate can either be directly read from the market prices of zero coupon bonds or implied from the market prices of other interest rate securities such as swap prices. For further details concerning the evaluating points on the forward curve we refer the reader to the Basic Bonds module of this product and/or the section of the accompanying documentation entitled `Fundamental Theory of Bonds'.
Once the discrete values of the forward curve are known we are able to use an interpolation and other approximation procedure over these discrete tabulation values in order to construct the full forward rate curve between the maximum and minimum maturities which are considered.
The particular procedure of interpolation or other approximation procedure to use will depend on your view of forward rates. In particular, there is no `right way' to interpolate a set of forward rates of differing maturities to construct the forward rate curve and the broader literature takes a number of points of view with regard to this matter. However, within this method we allow you to select from the three most popular approaches of the construction of the forward rate:
A forward rate is specified using pairs of the following type (forwardRate, maturity).
These values are given in two separate vectors: forwardRates and
maturities, where the values contained with these vectors correspond
in the following sense:
forwardRate[0] contains the spot rate - that is the forward rate with
zero time until maturity, that is, here the maturity is zero.
forwardRate[1] contains the rate with maturity = maturities[0]
forwardRate[2] contains the rate with maturity = maturities[1]
forwardRate[nMaturities - 1] contains the rate with maturity = maturities[numberMaturities - 2]
forwardRate and maturities
vectors are equal. The last value maturities[numberMaturities - 1] has no
corresponding forward rate and is used to give a point in time such that the forward
rates beyond this point can be considered unknown - or undefined.
forwardRates - the vector of forward rates as described above.maturities - the vector of maturities given in absolute time. That is, to represent the maturity of say 1st March 2004, we would write 2004 + (2.0/12), and so on.numberMaturities - the number of maturities (or forward rates) giveninterpolationType - can be either CONSTANT, LINEAR or SPLINE, depending on whether the constant interpolation, linear approximation or cubic spline interpolation procedures respectively are used in order to construct the forward curve from the set of discrete known points.currentTime - the current time in absolute terms. That is, if the current date is 1st April 2006 - then in absolute terms we would represent it as 2006.25, since (2006 years + 3 months)/ 12 months = 2006.25.
InterestDerivativesDemoException
RemoteException
public void setVasicekRateModel(double averageLongTermRate,
double adjustmentSpeed,
double sigma,
double initialRate)
throws InterestDerivativesDemoException,
RemoteException
This model of the spot rate process is a semi martingale and is in fact a particular case of the Hull-White model. This model cannot be fitted to a particular yield curve.
The Vasicek model generates an elastic random walk around a trend in the sense that it is mean-reverting. The model also does not guarantee the positivity of the interest rates and assumes that the variance of the process (i.e. spot rate around the average spot rate) is constant.
The stochastic differential equation of the Vasicek model is:
dr = adjustmentSpeed * (averageLongTermRate - r) * dt + sigma * dW
adjustmentSpeed is the reversion speed, averageLongTermRate
the long term average rate of the spot rate, sigma is a measure
of the spot rate volatility, dr roughly speaking is the change
of the spot rate, dt is the corresponding change in time
and dW represents the random variable.
averageLongTermRate - the long term average rate of the spot rateadjustmentSpeed - the reversion speed (towards the long term average value of the spot rate)sigma - a measure of the spot rate volatilityinitialRate - the initial value of the spot rate
InterestDerivativesDemoException
RemoteException
public void setBlackDermanToyRateModel(Function phi,
KOrderDiff sigma,
double initialRate)
throws InterestDerivativesDemoException,
RemoteException
The BDT spot rate process is a semi martingale which generates a model which can be fitted is historical price data.
The corresponding stochastic differential equation for this model is given by:
d(log(r)) = (phi(t) - sigma'(t)/sigma(t) * log(r)) * dt + sigma(t) * dW
sigma'(t) is the first derivative of sigma(t).
phi - a function of one variable (some class implementing the Function interface).sigma - a smooth function of one variable (some class implementing the KOrderDiff interface).initialRate - the initial value of the spot rate
InterestDerivativesDemoException
RemoteException
public void setBlackKarasinskiRateModel(Function phi,
Function modelFunction,
Function sigma,
double initialRate)
throws InterestDerivativesDemoException,
RemoteException
The spot rate process is a semi martingale for which the resulting model can be fitted to market data.
The stochastic differential equation is:
d(log(r)) = (phi(t) - a(t) * log(r)) * dt + sigma(t) * dW
phi - a function of one variable (some class implementing the Function interface).modelFunction - a function of one variable (a class implementing the Function interface).sigma - a function of one variable (a class implementing the Function interface).initialRate - the initial value of the spot rate
InterestDerivativesDemoException
RemoteException
public void setBrennanSchwartzRateModel(double a1,
double b1,
double sigma1,
double a2,
double b2,
double c2,
double sigma2,
double initialShortRate,
double initialLongRate)
throws InterestDerivativesDemoException,
RemoteException
The stochastic differential equations are:
dr = (a1 + b1 * (l - r)) * dt + sigma1 * r * dW1
dl = l * (a2 - b2 * r + c2 * l) * dt + sigma2 * l * dW2
r, is the spot rate,
and the second factor of the model l, is the long rate (or
unspecified maturity).
a1 - real constant influencing the drift of the spot rateb1 - real constant - the reversion of the spot rate to the long ratesigma1 - a measure of the volatility of the spot ratea2 - real constant influencing the drift of the long rateb2 - real constant influencing the drift of the long ratec2 - real constant influencing the drift of the long ratesigma2 - a measure of the volatility of the long rateinitialShortRate - the initial value of the spot rateinitialLongRate - the initial value of the long rate
InterestDerivativesDemoException
RemoteException
public void setCoxIngersollRossRateModel(double equilibriumRate,
double adjustmentSpeed,
double sigma,
double initialRate)
throws InterestDerivativesDemoException,
RemoteException
This model is an equilibrium model derived under the assumption that interest rates are determined by the supply and demand of individuals having a logarithmic utility function.
This model is very similar to Vasicek, with the exception that its
variance is proportional to the short rate, rather than being constant. It is
also the case that this model guarantees the positivity of interest rates if
the following condition is satisfied:
sigma * sigma < 2 * adjustmentSpeed * averageLongTermRate
The spot rate process is a semi martingale and the models stochastic differential equation is:
dr = adjustmentSpeed * (equilibriumRate - r) * dt + sigma * sqrt(r) * dW
adjustmentSpeed represents the reversion speed of the spot rate
towards the long term average value, equilibriumRate the equilibrium
value of the spot rate and sigma is the measure of the spot rate volatility.
equilibriumRate - the equilibrium value of the spot rateadjustmentSpeed - represents the reversion speed of the spot rate towards the equilibrium ratesigma - a measure of the spot rate volatilityinitialRate - the initial value of the spot rate
InterestDerivativesDemoException
RemoteException
public void setFittedHoLeeRateModel(double[] forwardRates,
double[] maturities,
int numberMaturities,
BlackScholesConstants interpolationType,
double currentTime,
double sigma)
throws InterestDerivativesDemoException,
RemoteException
In order for the calibration process to work, the forward rate function must
be differentiable and it should be used with an approximation algorithm consistent
with market prices - so only LINEAR is suitable.
forwardRates - the vector of forward ratesmaturities - the vector of maturities. The maturities are given as absolute times, that is, the date 1st March 2004, would be represented as 2004.25, since currentTime = 2004 + 2. / 12.numberMaturities - the number of rates (and maturities)interpolationType - can be either CONSTANT, LINEAR or SPLINE.currentTime - the current time (absolute time).sigma - a measure of the volatility.
InterestDerivativesDemoException
RemoteException
public void setFittedHullWhiteRateModel(double[] forwardRates,
double[] maturities,
int numberMaturities,
BlackScholesConstants interpolationType,
double currentTime,
double adjustmentSpeed,
double sigma)
throws InterestDerivativesDemoException,
RemoteException
In order for the calibration process to work, the forward rate function must
be differentiable and it should be used with an approximation algorithm consistent
with market prices - so only LINEAR is suitable.
forwardRates - the vector of forward ratesmaturities - the vector of maturities. The maturities are given as absolute times, that is, the date 1st March 2004, would be represented as 2004.25, since currentTime = 2004 + 2. / 12.numberMaturities - the number of maturities (or rates) given.interpolationType - can be either CONSTANT, LINEAR or SPLINE.currentTime - the current time (absolute time).sigma - a measure of the volatility
InterestDerivativesDemoException
RemoteException
public void setFongVasicekRateModel(double spotRateMean,
double sqrVolMean,
double meanReversionRateSpot,
double meanReversionRateVariance,
double volatilityVariance,
double initialSpotRate,
double initialSqrtVolatility)
throws InterestDerivativesDemoException,
RemoteException
The stochastic differential equations are:
dr = meanReversionRateSpot * (spotRateMean - r) * dt + sqrt(e) * dW1
de = meanReversionRateVariance * (varianceRateMean - e) * dt + volatilityVariance * sqrt(e) * dW2
r is the spot rate, e is the variance (i.e.
the volatility squared) of the spot rate, meanReversionRateSpot a
constant indicating the mean-reversion speed of the spot rate to its long term
trend rate, meanReversionRateVariance constant showing the mean-reversion
speed of the variance to its long term trend rate and volatilityVariance
the volatility of the variance.
spotRateMean - the long term trend rate around which the spot rate oscillatesmeanReversionRateSpot - a constant indicating the mean-reversion speed of the spot rate to its long term trend ratemeanReversionRateVariance - constant showing the mean-reversion speed of the variance to its long term trend ratevolatilityVariance - the volatility of the varianceinitialSpotRate - the initial value of the spot rate
InterestDerivativesDemoException
RemoteException
public void setHJMRateModel(double[][] historicZcbPrices,
double[] forwardRates,
double[] maturities,
int numberMaturities,
double tolerance,
int numberObservations,
int numberPCAVectors,
double dt,
double currentTime,
int internalMemorySteps)
throws InterestDerivativesDemoException,
RemoteException
This model uses instantaneous forward rates, rather than discrete ones as used in
the case of SimplifiedBGM. Mathematically speaking, the HJM model
is an infinite-factor model, in that it uses infinite-dimensional Brownian motions. In
order to simulate this infinite dimensional model on a computer the model is discretized
and only a finite number of dimensions or equivalently forward rates are used.
The stochastic differential equation for HJM is:
where F(t, T) is the forward rate with maturity T at
moment t; m(t, T) is the drift of the forward rate with maturity
T and vol(t, T) is the volatility of the above mentioned rate.
It is known that if the drifts of forward rates under the risk-neutral probability are entirely determined by their volatility (according to a certain formula) - the model is risk-neutral. You have thus the freedom to choose any volatility structure you want. The HJM specification is so general that almost all models are in fact particular cases of it.
The volatility of the forward rates is automatically computed to fit the market data:
forwardRates - the vector of forward ratesmaturities - the vector of maturities. The maturities are given as absolute times. Suppose today's date is 1-st of March 2004 => the absolute time is currentTime = 2004 + 2. / 12. Suppose that the rates are given at each month. => maturities[0] = 2004 + 3. / 12 = 2004.25; maturities[1] = 2004 + 4. / 12 = 2004.33; etc.numberMaturities - the number of rates (and maturities)tolerance - a tolerance used as stopping condition in the Power method for finding the eigenvectors of a matrix (needed in the PCA algorithm). A recommended value for this parameter is 1E-12.numberObservations - the number of historic values of zero coupon bond prices recorded for each maturitynumberPCAVectors - the number of forward volatility stochastic factor you want to find using PCAdt - the fixed time interval between two consecutive observations of zero coupon bond pricescurrentTime - the initial momentinternalMemorySteps - this parameter sets the length of an internal cache used to speed up the computations. Generally it is a good idea to set this parameter exactly as the number of timesteps in Monte Carlo.
InterestDerivativesDemoException
RemoteException
public void setHoLeeRateModel(Function drift,
double sigma,
double initialRate)
throws InterestDerivativesDemoException,
RemoteException
The Ho&Lee model does not specify in any way the drift structure of the spot rate process, and thus we are able to apply a fitting technique to fit the model to appropriate market data. In particular, through a careful choice of the drift function the theoretical zero-coupon bonds prices produced by the model, will correspond to the market prices of the corresponding bonds. In this way we are able to calibrate the model using the available market prices of liquid contracts such as zero-coupon bonds, and then use the calibrated model to price contacts which are less liquid and hence for which market prices are generally not available and if available being unreliable.
Remark: This class also allows you to implement your own calibration
algorithm by providing the drift function. We also provide a version of the model
with yield curve fitting for zero coupon bonds included see #setFittedHoLee.
The stochastic differential equation is:
dr = drift(t) * dt + sigma * dW
r is the spot rate, t is time, drift
is the drift function, sigma is the initial value of the spot rate
and W is the random variable.
drift - the drift function which must implement the Function interface.sigma - a measure of volatilityinitialRate - the initial value of the spot rate
InterestDerivativesDemoException
RemoteException
public void setHullWhiteRateModel(Function averageLongTermRate,
double adjustmentSpeed,
double sigma,
double initialRate)
throws InterestDerivativesDemoException,
RemoteException
The Hull & White model does not specify the trend of the spot rate prices, and thus
we are able to apply a fitting technique to fit the model to appropriate market data.
This means that a careful choice of the trend function (i.e. averageLongTermRate(t))
will result in theoretical zero-coupon bonds prices, generated by the model being the same
as the market prices of the same zero-coupon bonds. In this way we are able to
calibrate the model using the available market prices of liquid contracts
such as zero-coupon bonds, and then use the calibrated model to price contacts
which are less liquid and hence for which market prices are generally not available
and if available being unreliable.
Remark: This class allows you to implement your own calibration
algorithm by providing the drift function. If you want a version of the model with
yield curve fitting for zero coupon bonds included see FittedHullWhite.
The spot rate process is a semi martingale and its evolution is modeled using the stochastic differential equation:
dr = adjustmentSpeed * (averageLongTermRate(t) - r) * dt + sigma * dW
You can see that this is a generalization of the Vasicek model. The mean-reverting characteristic is present here, as is the constant variance.
averageLongTermRate - the trend function which is a function of time which returns the average expected long term spot rate at that point in time.adjustmentSpeed - the mean-reversion speedsigma - a measure of volatilityinitialRate - the initial value of the spot rate
InterestDerivativesDemoException
RemoteException
public void setLongstaffSchwartzRateModel(double xMean,
double yMean,
double reversionX,
double reversionY,
double c,
double d,
double initialX,
double initialY)
throws InterestDerivativesDemoException,
RemoteException
Within this model neither of the two model variables are the spot rate. The spot rate is indirectly computed using a linear combination of the two variables. However, the variables themselves are modeled are components of the spot rate where each of these component variables has a mean-reversion characteristic:
dx = reversionX * (xMean - x) * dt + sqrt(x) * dW1
dy = reversionY * (yMean - y) * dt + sqrt(y) * dW1
r = c * x + d * y
x and y are the two component variables,
and the other quantities are named in accordance with the naming of the
parameters.
xMean - the long term trend of the first componentyMean - the long term trend of the second componentreversionX - the mean-reversion speed for the first componentreversionY - the mean-reversion speed for the second componentc - the coefficient corresponding to the first component variable of the third formulae given aboved - the coefficient corresponding to the second component variable of the third formulae given aboveinitialX - the initial value for the first componentinitialY - the initial value for the second component
InterestDerivativesDemoException
RemoteException
public void setSimplifiedBGMRateModel(double[] discreteCurrentForwardRate,
double[] capletVolatilities,
double[] resetDates,
int forwardCurveSteps,
double currentTime)
throws InterestDerivativesDemoException,
RemoteException
This model has three parameters which describe volatility functions that must be calibrated so that the model recovers the volatility structure observed in the market. Within our implementation of this model Cap volatilities will need to used in order to calibrate these functions.
Heath, Jarrow and Morton (HJM) modelThe model specification is natively discrete, so in this respect the model is superior to
the Heath, Jarrow and Morton (HJM) model, which needs to be discretized
in order to be used with numerical pricing algorithms such as Monte Carlo. The fact that the
model is natively discrete also means that it is expressed in terms of the discrete forward
rates (i.e. which is generally taken to be the LIBOR rates). Thus, the model can be classified
as a market model, meaning that it uses trading instruments as state variables.
Another advantage over Heath, Jarrow and Morton (HJM) model is
that it assures positive interest rates while future interest rates never exponentially
increase.
discreteCurrentForwardRate - a vector containing the initial forward (LIBOR) rates for different maturities (resetDates). In general discreteCurrentForwardRate[i] is the forward rate between times resetDates[k] and resetDates[k + 1].capletVolatilities - the Black caplet volatilities used for model calibration. capletVolatilities[k] is the Black volatility for the caplet that corresponds to the period between times resetDates[k] and resetDates[k + 1].resetDates - a vector containing the maturities of the forward (LIBOR) ratesforwardCurveSteps - the number of rates and maturitiescurrentTime - the current time
InterestDerivativesDemoException
RemoteException
public void setConstantPriceModel(double price)
throws InterestDerivativesDemoException,
RemoteException
price - the constant value of the price.
InterestDerivativesDemoException
RemoteException
public void setDeterministPriceModel(KOrderDiff priceFunction,
double currentTime)
throws InterestDerivativesDemoException,
RemoteException
Overview
The asset price dynamics will follow a function given as a parameter. Therefore, this model is deterministic in nature.
priceFunction - a differentiable function of one real variable time which must be at least first order differentiable.currentTime - the current time from which the price model begins.
InterestDerivativesDemoException
RemoteException
public void setLognormalPriceModel(double initialPrice)
throws InterestDerivativesDemoException,
RemoteException
It is a one-factor stochastic model where the process of the price is a semi martingale. This is also the price model which is used within the classical Black-Scholes model.
The stochastic differential equation is:
dS = drift * S * dt + vol * S * dW,
where S represents the asset price, t
is time, the drift is the (long term average) drift (i.e. a constant)
of the asset, vol is the volatility of the assets (i.e. a constant)
and W is the lognormal random variable.
initialPrice - the initial value of the price
InterestDerivativesDemoException
RemoteException
public void setPoissonPriceModel(double initialPrice,
double intensity,
double jumpStddev)
throws InterestDerivativesDemoException,
RemoteException
The stochastic differential equation for this model is:
dS = drift * S * dt + vol * S * dW + (J - 1) * S * dq,
drift and vol are external variables of the model;
J is a measure of the jumps' magnitude and dq is a Poisson
process. In this implementation J is also considered a stochastic
variable, in particular J is given by:J = 1 + jumpStddev * N(0, 1),N(0, 1) is a variable taken from a standard normal distribution.
initialPrice - the initial value of the price of the asset considered.intensity - the intensity of the Poisson processjumpStddev - the standard deviation of the jump magnitude
InterestDerivativesDemoException
RemoteException
public void setConstantVolatilityModel(double volatility)
throws InterestDerivativesDemoException,
RemoteException
volatility - the constant value of the volatility
InterestDerivativesDemoException
RemoteException
public void setDeterministVolatilityModel(KOrderDiff volatilityFunction,
double value,
double currentTime)
throws InterestDerivativesDemoException,
RemoteException
Here the user specifies the dynamics of the volatility by passing a function of
one variable time of the type KOrderDiff as a parameter which take the values
of the volatility with respect to time. The function provided must be a least first
order differentiable. Since the volatility will follow a function (given as a parameter)
the model is deterministic in nature.
volatilityFunction - a differentiable function of one real variable time which specifies the volatility. If this parameter is null, then the volatility will be assumed to be constant equal to the `value' given in the next parametervalue - the value of the constant volatility function in the case when the volatilityFunction parameter is not null. If the volatility function is given then this parameters is ignored.currentTime - the current time from which the volatility model begins.
InterestDerivativesDemoException
RemoteException
public void setHullWhiteVolatilityModel(double adjustmentSpeed,
double averageLongTermVariance,
double varianceVolatility,
double initialVariance)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
volatility = sqrt(variance)).
This model is based on the Hull & White analysis which showed that when the asset price and its volatility are uncorrelated then the fair value of an option on this asset is the average of the Black-Scholes values for the option taken over the distribution of the variance.
The variance process is a semi martingale and the stochastic differential equation of this model is:
d var = adjustmentSpeed * (averageLongTermVariance - var) * dt + varianceVolatility * var * dW
var is the variance, t is time and W is a random
variable. The other three terms correspond to the parameters of the same name.
adjustmentSpeed - the reversion speed towards the equilibrium value of the varianceaverageLongTermVariance - the equilibrium value of the variancevarianceVolatility - a measure of the variance of the volatilityinitialVariance - the initial value of the variance
EvaluationException
InterestDerivativesDemoException
RemoteException
public void setHostonVolatilityModel(double gamma,
double delta,
double initialVolatility)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
The volatility process is a semi martingale with a stochastic differential equation of:
d vol = -gamma * vol * dt + delta * dW
vol is the volatility,
gamma - the drift multiplied by -1delta - a measure of the process' randomnessinitialVolatility - the initial value of the volatility
EvaluationException
InterestDerivativesDemoException
RemoteException
public void runSimulation(int monteCarloTimesteps,
int monteCarloRandomWalks,
double currentTime)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
The Monte Carlo algorithm due to its stochastic nature, will produce differing
results with each time it is run. That is, two sequential runs of the algorithm
using the same model, contract and parameters, will return different prices. However,
as the number of simulation used increases the results of Monte Carlo simulation
converge to a normal distribution where the standard deviation of this distribution
can be evaluated using getStddev. Therefore, for a given interval
of values we are able to evaluate the confidence level that the true theoretical value
lies within the interval considered.
The higher the confidence level, the larger the interval considered will need to be
in order to ensure that the true theoretical price lies within the interval.
However, you can reduce the interval for a fixed confidence level, by increasing the
number of simulations. In particular, by increasing the number of random walks by
100 times, the size of the confidence interval will be decreased by a
factor of 10. More generally, the factor reduction of the confidence
interval is the square root of the multiple factor of the number of simulation
increases.
Monte Carlo pricing procedures offer an estimate of the price of an asset, which in its turn can be affected by other errors (such as size of the time steps, numerical algorithm errors, floating point imprecision, model error and so on). For further details, concerning the types of errors which can occur we refer the reader to the PDF documentation. In most cases however, these other sources of error are small in comparison with the Monte Carlo error. However, these other errors are difficult to control whereas the Monte Carlo error can be controlled and in particular reduced by increasing the number of simulations.
runSimulation(int, int, double) and Within this pricing framework we offer two means by which to run the required Monte Carlo simulation, namely:
runSimulation(int, int, double) (this method) - Runs Monte Carlo using a prescribed number of simulations.
`MC set accuracy' will find
the result to a given required accuracy which it will return.
monteCarloTimesteps - the number of time axis divisions for one random walkmonteCarloRandomWalks - the number of random walks executedcurrentTime - the start moment for the simulation (the value date - contract is evaluated as of this moment)
EvaluationException
InterestDerivativesDemoException
RemoteExceptionrunSimulation(int, double, double, int, double)
public void runSimulation(int timeSteps,
double confidence,
double maxRelativeError,
int maxRandomWalks,
double timeToEvaluation)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
The Monte Carlo algorithm due to its stochastic nature, will produce differing
results with each time it is run. That is, two sequential runs of the algorithm
using the same model, contract and parameters, will return different prices. However,
as the number of simulation used increases the results of Monte Carlo simulation
converge to a normal distribution where the standard deviation of this distribution
can be evaluated using getStddev. Therefore, for a given interval
of values we are able to evaluate the confidence level that the true theoretical value
lies within the interval considered.
The higher the confidence level, the larger the interval considered will need to be
in order to ensure that the true theoretical price lies within the interval.
However, you can reduce the interval for a fixed confidence level, by increasing the
number of simulations. In particular, by increasing the number of random walks by
100 times, the size of the confidence interval will be decreased by a
factor of 10. More generally, the factor reduction of the confidence
interval is the square root of the multiple factor of the number of simulation
increases.
Monte Carlo pricing procedures offer an estimate of the price of an asset, which in its turn can be affected by other errors (such as size of the time steps, numerical algorithm errors, floating point imprecision, model error and so on). For further details, concerning the types of errors which can occur we refer the reader to the PDF documentation. In most cases however, these other sources of error are small in comparison with the Monte Carlo error. However, these other errors are difficult to control whereas the Monte Carlo error explicitly controlled within this methods by increasing the and decreasing the maximum relative values which is allowed. Note that whenever the accuracy required is increased it may be necessary to increase the maximum number of simulations which are allowed.
runSimulation(int, int, double) and Within this pricing framework we offer two means by which to run the required Monte Carlo simulation, namely:
runSimulation(int, int, double) - Runs Monte Carlo using a prescribed number of simulations.
`MC set number Simulations' sets the number of
simulations after which the result is returned.
timeSteps - the number of time axis divisions for one random walkconfidence - the probability used to compute the uncertainty interval (and maximum relative error)maxRelativeError - the maximum acceptable relative error. This is equal with half_uncertainty_interval / (abs(price) * - half_uncertainty_interval) * 100. The error is given as a percentage.maxRandomWalks - the simulation will stop after this number of random walks even if the relative error is larger than maxRelativeError. This is given as a safety measure - to ensure that Monte Carlo will actually finish in a reasonable amount of time.timeToEvaluation - the start moment for the simulation (the value date - contract is evaluated as of this moment)
EvaluationException
InterestDerivativesDemoException
RemoteExceptionrunSimulation(int, int, double)
public double getPrice()
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
Before calling this method the contract considered, and the price, volatility
and interest rate models should have already been set. In addition, you must have
already performed the Monte Carlo simulation using one of the `MC set accuracy'
or `MC set number Simulations'. After
each Monte Carlo Simulation is performed the results are stored within private
field which are then read by this method.
EvaluationException
InterestDerivativesDemoException
RemoteException
public double getStddev()
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
Before calling this method the contract considered, and the price, volatility
and interest rate models should have already been set. In addition, you must have
already performed the Monte Carlo simulation using one of the `MC set accuracy'
or `MC set number Simulations'. After
each Monte Carlo Simulation is performed the results are stored within private
field which are then read by this method.
EvaluationException
InterestDerivativesDemoException
RemoteException
public double getMinPrice(double confidence)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
Before calling this method the contract considered, and the price, volatility
and interest rate models should have already been set. In addition, you must have
already performed the Monte Carlo simulation using one of the `MC set accuracy'
or `MC set number Simulations'. After
each Monte Carlo Simulation is performed the results are stored within private
field which are then read by this method.
confidence - the probability for which the minimal value is calculated
EvaluationException
InterestDerivativesDemoException
RemoteException
public double getMaxPrice(double confidence)
throws EvaluationException,
InterestDerivativesDemoException,
RemoteException
Before calling this method the contract considered, and the price, volatility
and interest rate models should have already been set. In addition, you must have
already performed the Monte Carlo simulation using one of the `MC set accuracy'
or `MC set number Simulations'. After
each Monte Carlo Simulation is performed the results are stored within private
field which are then read by this method.
confidence - the probability for which the maximal value is calculated
EvaluationException
InterestDerivativesDemoException
RemoteException
|
WebCab Bonds Demo (J2EE Edition) |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||