DM_SoftBarrier





http://www.QuantTools.com
CapeTools Derivative Matrix function list

Welcome | Documentation format | QuantTools Groups | QuantTools Categories | Licence

Key TAGs | Excel Index | API Index



A soft-barrier option is similar to a standard barrier option, except that the barrier is no longer a single level.

Rather, it's a soft range between an upper level U and a lower level L. Soft-barrier options are knocked in or out proportionally.

The value of a soft-down-and-out call is equal to the value of a standard call minus the value of a soft-down-and-in call.

Similarly, the value of a soft-up-and-out put is equal to the value of a standard put minus a soft-up-and-in put.

Values for the TypeFlag parameter are - cdi (Down-and-in call), cdo (Down-and-out call), pui (Up-and-in put) and puo (Up-and-out put).

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 returns a partial derivative matrix of all second order derivatives (Hessian matrix).

Each individual second order derivative as well as the first order derivatives can be obtained, individually, via the pricing functions present within the CapeTools Exotic Options category of functions.

However this function computes all the second order risk numbers in a single function call.



Note: Within Excel, the function is named - CT.DM_SoftBarrier




High level graphic of DM_SoftBarrier() function with parameters. Blue square node is the actual function with the parameters ordered.



Parameter Description


  1. ValueDate parameter

    Valuation Date (typically equal to Today's date)
  2. 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.
  3. TypeFlag parameter

    Option Types cdo, cdi, puo, pui
  4. S parameter

    Underlying price
  5. X parameter

    Strike price of the option
  6. L parameter

    Continuous Lower Barrier level
  7. U parameter

    Continuous Upper Barrier level
  8. 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.
  9. 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.
  10. T parameter

    Time to option maturity.
  11. r 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.
  12. 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.
  13. v parameter

    Volatility of the underlying.


Extended information

Function Syntax

VB Syntax


Variant CTDerivativeMatrix.DM_SoftBarrier( _
Long ValueDate, _
DayCountEnum dayCounter, _
String TypeFlag, _
Double S, _
Double X, _
Double L, _
Double U, _
String AdjBarrFreqL, _
String AdjBarrFreqU, _
Long T, _
Double r, _
Double b, _
Double v)


Excel Spreadsheet Syntax


=CT.DM_SoftBarrier(
Excel Numeric Cell ValueDate,
Excel String Cell dayCounter,
Excel String Cell TypeFlag,
Excel Numeric Cell S,
Excel Numeric Cell X,
Excel Numeric Cell L,
Excel Numeric Cell U,
Excel String Cell AdjBarrFreqL,
Excel String Cell AdjBarrFreqU,
Excel Numeric Cell T,
Excel Numeric Cell r,
Excel Numeric Cell b,
Excel Numeric Cell v)


C++ Syntax


static CTRangeDataCPP DM_SoftBarrier(
long ValueDate,
DayCountEnum dayCounter,
std::string TypeFlag,
double S,
double X,
double L,
double U,
std::string AdjBarrFreqL,
std::string AdjBarrFreqU,
long T,
double r,
double b,
double v);


DotNET Syntax


CTRangeData CTDerivativeMatrixSA.DM_SoftBarrier(
System.Int32 ValueDate,
CTIEnums.DayCountEnum dayCounter,
System.String TypeFlag,
System.Double S,
System.Double X,
System.Double L,
System.Double U,
System.String AdjBarrFreqL,
System.String AdjBarrFreqU,
System.Int32 T,
System.Double r,
System.Double b,
System.Double v);

Parameter data types

ArgNameArgTypeIsKey
ValueDateLongFALSE
dayCounterDayCountEnumFALSE
TypeFlagStringFALSE
SDoubleFALSE
XDoubleFALSE
LDoubleFALSE
UDoubleFALSE
AdjBarrFreqLStringFALSE
AdjBarrFreqUStringFALSE
TLongFALSE
rDoubleFALSE
bDoubleFALSE
vDoubleFALSE


Example Inputs

The first column represents the name of the parameters. The second column specifies whether the parameters are optional or not. Finally the last column provides some sample input data.
Function call input string-keys are always in the format : "NAME.EXTTAG.TICKER" The "EXTTAG.TICKER" part is determined from the output of other, capetools, object creation functions.


ArgNameIsOptional (Excel only)Example
ValueDateFALSE19/Jul/2005 (serial date type)
dayCounterFALSEACT365
TypeFlagFALSEcdo
SFALSE100.0
XFALSE100.0
LFALSE95
UFALSE85
AdjBarrFreqLFALSEDaily
AdjBarrFreqUFALSEDaily
TFALSE17/Jan/2006 (serial date type)
rFALSE0.10
bFALSE0.05
vFALSE0.3


Example function usage


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.


If you are accessing this functrion via the MiniXL libraries, this function is present within the CT.QL.Pricing20 MiniXL Excel Addin.

Within our Excel Example Addin Generator, we have used the following QuantTools sub-functions in order to prepare the arguments needed to call the DM_SoftBarrier() function. If you are executing this function via the MiniXL libraries, the module addin name, (in brackets, to the right of the sub-functions listed below), indicates the MiniXL library in which the sub-function is held. You will need to load this library into your Excel session (along with any other libraries that the sub-function call within the addin requires (ie - CT.QT.Utils20 addin in almost all cases) in order for the example to compute successfully.


The following four examples demostrate calling this function within a Microsoft .NET environment

The following four examples demostrate calling this function within a non .NET environment

The following is a sample output from executing the DM_SoftBarrier() function call


Example
DSDXDLDUDTDRDBDV
DS0.00431877-0.02808660.01538180.01077080.3122661.44158-1.809240.607581
DX-0.02808660.007926720.01290970.009289020.242407-0.547240.7152850.870731
DL0.01538180.0129097-0.0218056-0.00891319-0.288252-0.4946580.605597-0.737244
DU0.01077080.00928902-0.00891319-0.0136379-0.27313-0.2552110.321706-0.779795
DT0.3122660.242407-0.288252-0.27313-10.193433.5252-43.5131-7.7391
DR1.44158-0.54724-0.494658-0.25521133.525233.9833-44.3292-32.6655
DB-1.809240.7152850.6055970.321706-43.5131-44.329256.555126.9261
DV0.6075810.870731-0.737244-0.779795-7.7391-32.665526.9261-43.8352



Copyright (c) 2003-2007 CapeTools - All Rights Reserved.