DM_TwoAssetCashOrNothing





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

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

Key TAGs | Excel Index | API Index



Four types of two-asset cash-or-nothing options exist : A two-asset cash-or-nothing call pays out a fixed cash amount K if asset one, S1 is above the strike X1 and asset two, S2, is above strike X2 at expiration (TypeFlag=1).

A two-asset cash-or-nothing put pays out a fixed cash amount if asset one, S1, is below the strike X1 and asset two, S2 is below strike X2 at expiration (TypeFlag=2).

A two-asset cash-or-nothing up-down pays out a fixed cash amount if asset one S1, is above the strike X1 and asset two, S2, is below the strike X2 at expiration (TypeFlag=3).

Finally a two-asset cash-or-nothing down-up pays out a fixed cash amount if asset one, s1, is below the strike x1 and asset two, s2, is above strike X2 at expiration (TypeFlag=4).

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_TwoAssetCashOrNothing




High level graphic of DM_TwoAssetCashOrNothing() 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

    Integer value (1 - 4) indicating option type.
  4. S1 parameter

    Price of the first underlying
  5. S2 parameter

    Price of the second underlying
  6. X1 parameter

    Strike price of the first underlying.
  7. X2 parameter

    Strike price of the second underlying.
  8. K parameter

    Cash amount to be paid out.
  9. T parameter

    Time to option maturity.
  10. 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.
  11. b1 parameter

    For the first 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.
  12. b2 parameter

    For the second 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. Vol1 parameter

    Volatility of the first underlying.
  14. Vol2 parameter

    Volatility of the second underlying.
  15. Rho parameter

    Correlation between the two assets.


Extended information

Function Syntax

VB Syntax


Variant CTDerivativeMatrix.DM_TwoAssetCashOrNothing( _
Long ValueDate, _
DayCountEnum dayCounter, _
Long TypeFlag, _
Double S1, _
Double S2, _
Double X1, _
Double X2, _
Double K, _
Long T, _
Double r, _
Double b1, _
Double b2, _
Double Vol1, _
Double Vol2, _
Double Rho)


Excel Spreadsheet Syntax


=CT.DM_TwoAssetCashOrNothing(
Excel Numeric Cell ValueDate,
Excel String Cell dayCounter,
Excel Numeric Cell TypeFlag,
Excel Numeric Cell S1,
Excel Numeric Cell S2,
Excel Numeric Cell X1,
Excel Numeric Cell X2,
Excel Numeric Cell K,
Excel Numeric Cell T,
Excel Numeric Cell r,
Excel Numeric Cell b1,
Excel Numeric Cell b2,
Excel Numeric Cell Vol1,
Excel Numeric Cell Vol2,
Excel Numeric Cell Rho)


C++ Syntax


static CTRangeDataCPP DM_TwoAssetCashOrNothing(
long ValueDate,
DayCountEnum dayCounter,
long TypeFlag,
double S1,
double S2,
double X1,
double X2,
double K,
long T,
double r,
double b1,
double b2,
double Vol1,
double Vol2,
double Rho);


DotNET Syntax


CTRangeData CTDerivativeMatrixSA.DM_TwoAssetCashOrNothing(
System.Int32 ValueDate,
CTIEnums.DayCountEnum dayCounter,
System.Int32 TypeFlag,
System.Double S1,
System.Double S2,
System.Double X1,
System.Double X2,
System.Double K,
System.Int32 T,
System.Double r,
System.Double b1,
System.Double b2,
System.Double Vol1,
System.Double Vol2,
System.Double Rho);

Parameter data types

ArgNameArgTypeIsKey
ValueDateLongFALSE
dayCounterDayCountEnumFALSE
TypeFlagLongFALSE
S1DoubleFALSE
S2DoubleFALSE
X1DoubleFALSE
X2DoubleFALSE
KDoubleFALSE
TLongFALSE
rDoubleFALSE
b1DoubleFALSE
b2DoubleFALSE
Vol1DoubleFALSE
Vol2DoubleFALSE
RhoDoubleFALSE


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
TypeFlagFALSE1
S1FALSE100
S2FALSE100
X1FALSE110
X2FALSE90
KFALSE10
TFALSE17/Jan/2006 (serial date type)
rFALSE0.10
b1FALSE0.05
b2FALSE0.06
Vol1FALSE0.20
Vol2FALSE0.25
RhoFALSE0.5


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_TwoAssetCashOrNothing() 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_TwoAssetCashOrNothing() function call


Example
DS1DS2DX1DX2DKDTDRDB1DB2DVOL1DVOL2DRHO
DS10.003743410.00345088-0.00517412-0.003834310.0194813-0.1868450.358729-0.283797-0.172071-0.802162-0.1944750.0714563
DS20.00345088-0.00262111-0.003137160.002607390.002744580.0316570.0413747-0.1720710.1170110.1042270.0224628-0.0588738
DX1-0.00517412-0.003137160.006313770.00348574-0.01771020.169859-0.3261170.2579970.1564280.7292380.176795-0.0649602
DX2-0.003834310.002607390.00348574-0.00255827-0.00304953-0.0351744-0.04597180.19119-0.130012-0.115808-0.02495870.0654153
DK0.01948130.00274458-0.0177102-0.0030495300.1629110.985077-0.971395-0.1368530.588393-0.1546710.086036
DT-0.1868450.0316570.169859-0.03517440.162911-5.7019411.2052-10.1646-4.32309-12.4617-2.566241.30031
DR0.3587290.0413747-0.326117-0.04597180.98507711.205215.0385-17.8873-2.06307-37.735-7.80580.1984
DB1-0.283797-0.1720710.2579970.19119-0.971395-10.1646-17.887314.1518.5799939.99829.6971-3.56302
DB2-0.1720710.1170110.156428-0.130012-0.136853-4.32309-2.063078.57999-5.83453-5.19707-1.120062.93562
DVOL1-0.8021620.1042270.729238-0.1158080.588393-12.4617-37.73539.9982-5.19707-63.3613-5.873732.1582
DVOL2-0.1944750.02246280.176795-0.0249587-0.154671-2.56624-7.80589.6971-1.12006-5.873733.552433.31784
DRHO0.0714563-0.0588738-0.06496020.06541530.0860361.300310.1984-3.563022.935622.15823.31784-0.645498



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