MCashOrNothingOption





http://www.QuantTools.com
CapeTools Exotic Analysis function list

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

Key TAGs | Excel Index | API Index



The cash-or-nothing option pays out a cash amount K at expiry if the option is in-the-money. The payoff from a call is 0 if S is less than or equal to X and K if S is greater than X. The payoff from a put option is 0 if S is greater than or equal to X and K if S is less than X. 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.



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




High level graphic of MCashOrNothingOption() 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. Units parameter

    Number of option contracts you wish to trade in (positive value).
  4. Position parameter

    Whether you are long or short the option.
  5. 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'.
  6. CallPut parameter

    Option Types (C)all or (P)ut
  7. S parameter

    Underlying price
  8. X parameter

    Strike price of the option
  9. K parameter

    Cash amount to be paid out.
  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.
  14. Greek parameter

    For the option premium specify 'PREMIUM'. For all first derivatives, you can specify one of the following : 'dS' (for the 'S' parameter), 'dX' (for the 'X' parameter), 'dK' (for the 'K' parameter), 'dT' (for the 'T' parameter), 'dr' (for the 'r' parameter), 'db' (for the 'b' parameter), 'dv' (for the 'v' parameter), For second order derivatives, you can specify combinations of the first order derivatives (i.e. - 'dSdS', 'dvdv', 'dSdv'. )


Extended information

Function Syntax

VB Syntax


Variant CTExoticAnalysis.MCashOrNothingOption( _
Long ValueDate, _
DayCountEnum dayCounter, _
Variant Units, _
Variant Position, _
String Level, _
Variant CallPut, _
Variant S, _
Variant X, _
Variant K, _
Variant T, _
Variant r, _
Variant b, _
Variant v, _
String Greek)


Excel Spreadsheet Syntax


=CT.MCashOrNothingOption(
Excel Numeric Cell ValueDate,
Excel String Cell dayCounter,
XLRange Units,
XLRange Position,
Excel String Cell Level,
XLRange CallPut,
XLRange S,
XLRange X,
XLRange K,
XLRange T,
XLRange r,
XLRange b,
XLRange v,
Excel String Cell Greek)


C++ Syntax


static CTRangeDataCPP MCashOrNothingOption(
long ValueDate,
DayCountEnum dayCounter,
CTRangeDataCPP Units,
CTRangeDataCPP Position,
std::string Level,
CTRangeDataCPP CallPut,
CTRangeDataCPP S,
CTRangeDataCPP X,
CTRangeDataCPP K,
CTRangeDataCPP T,
CTRangeDataCPP r,
CTRangeDataCPP b,
CTRangeDataCPP v,
std::string Greek);


DotNET Syntax


CTRangeData CTExoticAnalysisSA.MCashOrNothingOption(
System.Int32 ValueDate,
CTIEnums.DayCountEnum dayCounter,
CTRangeData Units,
CTRangeData Position,
System.String Level,
CTRangeData CallPut,
CTRangeData S,
CTRangeData X,
CTRangeData K,
CTRangeData T,
CTRangeData r,
CTRangeData b,
CTRangeData v,
System.String Greek);

Parameter data types

ArgNameArgTypeIsKey
ValueDateLongFALSE
dayCounterDayCountEnumFALSE
UnitsRangeFALSE
PositionRangeFALSE
LevelStringFALSE
CallPutRangeFALSE
SRangeFALSE
XRangeFALSE
KRangeFALSE
TRangeFALSE
rRangeFALSE
bRangeFALSE
vRangeFALSE
GreekStringFALSE


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
UnitsFALSEMCashOrNothingOption_Units_Range (creates a range object)
PositionFALSEMCashOrNothingOption_Position_Range (creates a range object)
LevelFALSEALL
CallPutFALSEMCashOrNothingOption_CallPut_Range (creates a range object)
SFALSEMCashOrNothingOption_S_Range (creates a range object)
XFALSEMCashOrNothingOption_X_Range (creates a range object)
KFALSEMCashOrNothingOption_K_Range (creates a range object)
TFALSEMCashOrNothingOption_T_Range (creates a range object)
rFALSEMCashOrNothingOption_r_Range (creates a range object)
bFALSEMCashOrNothingOption_b_Range (creates a range object)
vFALSEMCashOrNothingOption_v_Range (creates a range object)
GreekFALSEPREMIUM


Example range for parameter : Units

Within Excel, a range such as this can be passed directly into the Units parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : Units



CTQL.CTRangeData MCashOrNothingOption_Units;


int[] arrBMCashOrNothingOption_Units = {
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1  //  Array Data

};

CTQL.IntVector arrMCashOrNothingOption_Units =
new  CTQL.IntVector(arrBMCashOrNothingOption_Units);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MCashOrNothingOption_Units = new  CTQL.CTRangeData(arrMCashOrNothingOption_Units, false);


Example range for parameter : Position

Within Excel, a range such as this can be passed directly into the Position parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : Position



CTQL.CTRangeData MCashOrNothingOption_Position;


string[] arrBMCashOrNothingOption_Position = {
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG"  //  Array Data

};

CTQL.StringVector arrMCashOrNothingOption_Position =
new  CTQL.StringVector(arrBMCashOrNothingOption_Position);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MCashOrNothingOption_Position = new  CTQL.CTRangeData(arrMCashOrNothingOption_Position, false);


Example range for parameter : CallPut

Within Excel, a range such as this can be passed directly into the CallPut parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : CallPut



CTQL.CTRangeData MCashOrNothingOption_CallPut;


string[] arrBMCashOrNothingOption_CallPut = {
"Call",
"Call",
"Call",
"Call",
"Call",
"Call",
"Call",
"Call",
"Call",
"Call",
"Call",
"Call",
"Call",
"Call",
"Call",
"Call",
"Call",
"Call",
"Call",
"Call"  //  Array Data

};

CTQL.StringVector arrMCashOrNothingOption_CallPut =
new  CTQL.StringVector(arrBMCashOrNothingOption_CallPut);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MCashOrNothingOption_CallPut = new  CTQL.CTRangeData(arrMCashOrNothingOption_CallPut, false);


Example range for parameter : S

Within Excel, a range such as this can be passed directly into the S parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : S



CTQL.CTRangeData MCashOrNothingOption_S;


double[] arrBMCashOrNothingOption_S = {
97.7716,
95.22,
97.5853,
90.1074,
102.4375,
109.5084,
94.8618,
102.8533,
95.4742,
101.5752,
90.1311,
107.636,
94.3535,
90.2546,
93.1407,
96.4636,
99.3013,
106.1192,
98.4231,
100.0  //  Array Data

};

CTQL.DoubleVector arrMCashOrNothingOption_S =
new  CTQL.DoubleVector(arrBMCashOrNothingOption_S);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MCashOrNothingOption_S = new  CTQL.CTRangeData(arrMCashOrNothingOption_S, false);


Example range for parameter : X

Within Excel, a range such as this can be passed directly into the X parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : X



CTQL.CTRangeData MCashOrNothingOption_X;


double[] arrBMCashOrNothingOption_X = {
78.9871,
87.0081,
87.1472,
77.1235,
75.0138,
72.8849,
83.6458,
85.2411,
77.8214,
82.9817,
81.7968,
73.4639,
73.1256,
77.1511,
83.0426,
74.4648,
75.908,
87.4487,
80.2161,
80.0  //  Array Data

};

CTQL.DoubleVector arrMCashOrNothingOption_X =
new  CTQL.DoubleVector(arrBMCashOrNothingOption_X);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MCashOrNothingOption_X = new  CTQL.CTRangeData(arrMCashOrNothingOption_X, false);


Example range for parameter : K

Within Excel, a range such as this can be passed directly into the K parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : K



CTQL.CTRangeData MCashOrNothingOption_K;


int[] arrBMCashOrNothingOption_K = {
11,
9,
11,
10,
10,
10,
10,
10,
10,
9,
9,
11,
10,
11,
10,
11,
11,
11,
10,
10  //  Array Data

};

CTQL.IntVector arrMCashOrNothingOption_K =
new  CTQL.IntVector(arrBMCashOrNothingOption_K);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MCashOrNothingOption_K = new  CTQL.CTRangeData(arrMCashOrNothingOption_K, false);


Example range for parameter : T

Within Excel, a range such as this can be passed directly into the T parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : T



CTQL.CTRangeData MCashOrNothingOption_T;


int[] arrBMCashOrNothingOption_T = {
CTQL.Date.serialNumber("19/4/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("19/4/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("19/4/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("19/4/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("19/4/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("19/4/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("19/4/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("19/4/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("19/4/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("19/4/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("19/4/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("19/4/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("19/4/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("19/4/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("19/4/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("19/4/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("19/4/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("19/4/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("19/4/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("19/4/2006", "dd/mm/yyyy")  //  Array Data

};

CTQL.IntVector arrMCashOrNothingOption_T =
new  CTQL.IntVector(arrBMCashOrNothingOption_T);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MCashOrNothingOption_T = new  CTQL.CTRangeData(arrMCashOrNothingOption_T, false);


Example range for parameter : r

Within Excel, a range such as this can be passed directly into the r parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : r



CTQL.CTRangeData MCashOrNothingOption_r;


double[] arrBMCashOrNothingOption_r = {
0.0567,
0.0593,
0.0624,
0.0622,
0.0557,
0.0598,
0.0595,
0.0654,
0.0648,
0.0631,
0.0573,
0.0644,
0.0584,
0.0653,
0.0559,
0.0557,
0.0654,
0.0562,
0.0628,
0.06  //  Array Data

};

CTQL.DoubleVector arrMCashOrNothingOption_r =
new  CTQL.DoubleVector(arrBMCashOrNothingOption_r);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MCashOrNothingOption_r = new  CTQL.CTRangeData(arrMCashOrNothingOption_r, false);


Example range for parameter : b

Within Excel, a range such as this can be passed directly into the b parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : b



CTQL.CTRangeData MCashOrNothingOption_b = new CTQL.CTRangeData();

System.Text.StringBuilder MCashOrNothingOption_b_builder =
new System.Text.StringBuilder(100);

MCashOrNothingOption_b_builder.Append("{");
MCashOrNothingOption_b_builder.Append("0 ;");
MCashOrNothingOption_b_builder.Append("0 ;");
MCashOrNothingOption_b_builder.Append("0 ;");
MCashOrNothingOption_b_builder.Append("0 ;");
MCashOrNothingOption_b_builder.Append("0 ;");
MCashOrNothingOption_b_builder.Append("0 ;");
MCashOrNothingOption_b_builder.Append("0 ;");
MCashOrNothingOption_b_builder.Append("0 ;");
MCashOrNothingOption_b_builder.Append("0 ;");
MCashOrNothingOption_b_builder.Append("0 ;");
MCashOrNothingOption_b_builder.Append("0 ;");
MCashOrNothingOption_b_builder.Append("0 ;");
MCashOrNothingOption_b_builder.Append("0 ;");
MCashOrNothingOption_b_builder.Append("0 ;");
MCashOrNothingOption_b_builder.Append("0 ;");
MCashOrNothingOption_b_builder.Append("0 ;");
MCashOrNothingOption_b_builder.Append("0 ;");
MCashOrNothingOption_b_builder.Append("0 ;");
MCashOrNothingOption_b_builder.Append("0 ;");
MCashOrNothingOption_b_builder.Append("0.00");
MCashOrNothingOption_b_builder.Append("}");

// Parse the string into the Range object.
MCashOrNothingOption_b.RangeFromStr( MCashOrNothingOption_b_builder.ToString() );


Example range for parameter : v

Within Excel, a range such as this can be passed directly into the v parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : v



CTQL.CTRangeData MCashOrNothingOption_v;


double[] arrBMCashOrNothingOption_v = {
0.3678,
0.3337,
0.376,
0.3548,
0.3244,
0.3781,
0.3774,
0.3835,
0.3665,
0.3741,
0.32,
0.3614,
0.3331,
0.3714,
0.3737,
0.3608,
0.3609,
0.3673,
0.3762,
0.35  //  Array Data

};

CTQL.DoubleVector arrMCashOrNothingOption_v =
new  CTQL.DoubleVector(arrBMCashOrNothingOption_v);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MCashOrNothingOption_v = new  CTQL.CTRangeData(arrMCashOrNothingOption_v, false);



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


Example
NoOfUnitsPositionCallPutSXKTrbvPREMIUM
1LONGCall108.7384.23611388260.062200.32048.69937
1LONGCall104.23675.965510388260.061900.387.88246
1LONGCall101.11475.162711388260.06400.31869.08551
1LONGCall99.038185.413910388260.056100.33946.62765
1LONGCall103.34278.13210388260.05400.34257.91231
1LONGCall104.95680.562811388260.061800.35958.40335
1LONGCall90.287674.51559388260.05700.32986.47899
1LONGCall102.51983.92210388260.054100.3337.24939
1LONGCall104.89580.908610388260.060100.36727.53054
1LONGCall109.30481.330510388260.058300.35677.91887
1LONGCall95.216680.919410388260.062600.35216.71318
1LONGCall98.811674.589210388260.055400.38247.58435
1LONGCall107.78183.2711388260.064900.37768.17757
1LONGCall90.358275.156410388260.056400.35676.88756
1LONGCall107.91984.711310388260.057100.34657.54853
1LONGCall98.111479.40510388260.059800.36367.11571
1LONGCall102.6672.248511388260.055100.34829.23587
1LONGCall92.386785.943810388260.055400.36995.53817
1LONGCall106.83975.181210388260.059200.33878.46877
1LONGCall1008010388260.0600.357.34315



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