A double barrier option is knocked in or out if the underlying price touches a lower boundary L or upper boundary U prior to expiration.
CO=Call up-and-out-down-and-out, PO=Put up-and-out-down-and-out, CI=Call up-and-in-down-and-in, PI=Put up-and-in-down-and-in. Alpha1 and Alpha2 determine the curvature of the lower L and Upper U absorbing boundaries.
When both are equal to 0, we have two flat boundaries.
Where Alpha1 is less than 0 and Alpha2 is greater than 0 we have a lower boundary exponentially growing as time elapses, while the upper boundary will be exponentially decaying.
An Alpha1 greater than 0 and Alpha2 less than 0 corresponds to a convex downward lower boundary and a convex upward upper boundary.
This function utilizes an analytical (closed-form) algorithm.
Note that the risk (greek) numbers produced are the mathematically defined equivalent of a derivative (instantaneous change).
You can convert the risk number to your own definition of risk by multiplying by the shift you require.
For example, for a typical definition of VANNA, (change in underlying and volatility), where one defines the change in the underlying as a single unit of change (1.0) and the change in volatility as a one percent change (0.01), simply multiply the VANNA result calculated by (1.0*0.01).
For VEGA, change in volatility of one percent (0.01), simply multiply the VEGA result by 0.01. Within option contracts THETA is negative, however the mathematically defined equivalent of THETA (instantaneous FORWARD change in time) is positive.
Internally we have negated this value for you.
To express THETA as THETA per day, simply multiply the THETA result by 1/365 or 1/252 (depending on whether you require calendar days or business days).
This function prices a portfolio of equity, commodities, futures or FX option deals from raw inputs.
All memory is discarded once the computation is finished.
You can request for all first and second order risk statistics simply by filling in the greek field with the name of the parameter.
The name of the parameter must be proceeded with the character 'd'. Thus if 'Stock', 'Time' and 'Vol' are the names of three parameters which represent underlying price, Option Maturity and option volatility respectively, you can request DELTA as 'dStock', GAMMA as 'dStockdStock' (dStock twice), VEGA as 'dVol', THETA as 'dTime', VOLGA as 'dVoldVol' (dVol twice) and VANNA (cross-derivative) as 'dStockdVol' or 'dVoldStock'. You can also, if you wish request 'dTimedVol' (second derivative with respect to Time and Vol).
If you wish to view all the second order derivatives within a matrix, please refer to the
CapeTools Derivative Matrix category of functions.
This logic can be applied to any parameter which is of a double-valued type (decimal value).
The risk statistics are the partial derivatives with respect to the option price, thus you can scale the results by multiplying by a factor.
For example, to compute the VEGA for a one percent change in volatility (0.01), simply multiply the VEGA result by 0.01. To compute THETA for a one day change (1/365), multiply the THETA result by 1/365. To compute the DELTA for a one-unit change (1), multiply the delta by 1 which is, of course the same result as the original delta.
For second order risks, simply multiply by the product of the changes.
- ValueDate parameter
Valuation Date (typically equal to Today's date)
- dayCounter parameter
For any input parameter within this function that represents a dividend rate, risk free rate, foreign rate or holding cost rate, these rates will be defined as annually compounded using the DayCounter defined within this parameter. Thus if 'actual365' is used for this 'dayCounter' parameter, then all input parameters that represent a dividend, risk free, foreign or holding cost rates will be defined as annually compounded Actual365 rates.
- Units parameter
Number of option contracts you wish to trade in (positive value).
- Position parameter
Whether you are long or short the option.
- Level parameter
Whether you would like to view the PV for the entire structure/portfolio 'TOTAL'. Whether you would like to view the PV for each option 'CASHFLOW'. Or whether you would like to view the PV and extended information, 'ALL'. Thus valid values are - 'TOTAL', 'CASHFLOW' or 'ALL'.
- DblBarrier parameter
Option Types CO, PO, CI, PI
- Underlying parameter
Underlying price
- X parameter
Strike price of the option
- L parameter
Continuous Lower barrier level
- U parameter
Continuous Upper barrier level
- AdjBarrFreqL parameter
Monitoring frequency that you wish the continuous lower barrier level value entered to have. (Basically will convert the barrier from continuous to discrete. If you choose 'Continuously', the barrier will still be a Continuous barrier). Valid values are : Continuously, Hourly, Daily, Weekly or Monthly.
- AdjBarrFreqU parameter
Monitoring frequency that you wish the continuous upper barrier level value entered to have. (Basically will convert the barrier from continuous to discrete. If you choose 'Continuously', the barrier will still be a Continuous barrier). Valid values are : Continuously, Hourly, Daily, Weekly or Monthly.
- Time parameter
Time to option maturity.
- Rate parameter
For the underlying (equity, futures, FX or commodity), this should be an annualised rate (risk free rate or foreign rate). If this is an option on a FX underlying, then if the underlying is quoted as domestic/foreign then this rate will be the domestic rate. If, however, the FX underlying is quoted as foreign/domestic then this will be the foreign rate.
- B parameter
For the underlying (equity, futures, FX or commodity), this should be an annualised rate (dividend rate, risk free rate, foreign rate or holding cost rate respectively). If this is an option on a FX underlying, then if the underlying is quoted as domestic/foreign then this rate will be the foreign rate. If, however, the FX underlying is quoted as foreign/domestic then this will be the domestic rate.
- Vol parameter
Volatility of the underlying.
- Delta1 parameter
Controls the curvature of the Lower L and upper U barriers.
- Delta2 parameter
Controls the curvature of the Lower L and upper U barriers.
- Greek parameter
For the option premium specify 'PREMIUM'. For all first derivatives, you can specify one of the following : 'dUnderlying' (for the 'Underlying' parameter), 'dX' (for the 'X' parameter), 'dL' (for the 'L' parameter), 'dU' (for the 'U' parameter), 'dTime' (for the 'Time' parameter), 'dRate' (for the 'Rate' parameter), 'dB' (for the 'B' parameter), 'dVol' (for the 'Vol' parameter), 'dDelta1' (for the 'Delta1' parameter), 'dDelta2' (for the 'Delta2' parameter), For second order derivatives, you can specify combinations of the first order derivatives (i.e. - 'dUnderlyingdUnderlying', 'dVoldVol', 'dUnderlyingdVol'. )
The C# example below contains all the sub-function calls leading up to this function call. As a result, the example can contain a lot of code.
The VB.NET, J#, C++.NET, Java, Excel VBA, Visual Basic 6 (via COM) and C++ examples below contain function code stubs for the calls leading up to this function call. However, the function call for this function is displayed.
You can easily reproduce the stub functions code from the
C# example.
Copyright (c) 2003-2007 CapeTools - All Rights Reserved.