MBAWAmericanApprox





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

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

Key TAGs | Excel Index | API Index



Quadratic approximation method of Barone-Adesi and Whaley to price American options on an underlying asset with cost of carry rate b. 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.MBAWAmericanApprox




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

    Underlying price, curve
  8. Strike parameter

    Strike price of the option
  9. Time parameter

    Length of the option contract
  10. 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.
  11. 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.
  12. Vol parameter

    Volatility of the underlying.
  13. Greek parameter

    For the option premium specify 'PREMIUM'. For all first derivatives, you can specify one of the following : 'dUnderlying' (for the 'Underlying' parameter), 'dStrike' (for the 'Strike' parameter), 'dTime' (for the 'Time' parameter), 'dRate' (for the 'Rate' parameter), 'dB' (for the 'B' parameter), 'dVol' (for the 'Vol' parameter), For second order derivatives, you can specify combinations of the first order derivatives (i.e. - 'dUnderlyingdUnderlying', 'dVoldVol', 'dUnderlyingdVol'. )


Extended information

Function Syntax

VB Syntax


Variant CTExoticAnalysis.MBAWAmericanApprox( _
Long ValueDate, _
DayCountEnum dayCounter, _
Variant Units, _
Variant Position, _
String Level, _
Variant CallPut, _
Variant Underlying, _
Variant Strike, _
Variant Time, _
Variant Rate, _
Variant B, _
Variant Vol, _
String Greek)


Excel Spreadsheet Syntax


=CT.MBAWAmericanApprox(
Excel Numeric Cell ValueDate,
Excel String Cell dayCounter,
XLRange Units,
XLRange Position,
Excel String Cell Level,
XLRange CallPut,
XLRange Underlying,
XLRange Strike,
XLRange Time,
XLRange Rate,
XLRange B,
XLRange Vol,
Excel String Cell Greek)


C++ Syntax


static CTRangeDataCPP MBAWAmericanApprox(
long ValueDate,
DayCountEnum dayCounter,
CTRangeDataCPP Units,
CTRangeDataCPP Position,
std::string Level,
CTRangeDataCPP CallPut,
CTRangeDataCPP Underlying,
CTRangeDataCPP Strike,
CTRangeDataCPP Time,
CTRangeDataCPP Rate,
CTRangeDataCPP B,
CTRangeDataCPP Vol,
std::string Greek);


DotNET Syntax


CTRangeData CTExoticAnalysisSA.MBAWAmericanApprox(
System.Int32 ValueDate,
CTIEnums.DayCountEnum dayCounter,
CTRangeData Units,
CTRangeData Position,
System.String Level,
CTRangeData CallPut,
CTRangeData Underlying,
CTRangeData Strike,
CTRangeData Time,
CTRangeData Rate,
CTRangeData B,
CTRangeData Vol,
System.String Greek);

Parameter data types

ArgNameArgTypeIsKey
ValueDateLongFALSE
dayCounterDayCountEnumFALSE
UnitsRangeFALSE
PositionRangeFALSE
LevelStringFALSE
CallPutRangeFALSE
UnderlyingRangeFALSE
StrikeRangeFALSE
TimeRangeFALSE
RateRangeFALSE
BRangeFALSE
VolRangeFALSE
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
UnitsFALSEMBAWAmericanApprox_Units_Range (creates a range object)
PositionFALSEMBAWAmericanApprox_Position_Range (creates a range object)
LevelFALSEALL
CallPutFALSEMBAWAmericanApprox_CallPut_Range (creates a range object)
UnderlyingFALSEMBAWAmericanApprox_Underlying_Range (creates a range object)
StrikeFALSEMBAWAmericanApprox_Strike_Range (creates a range object)
TimeFALSEMBAWAmericanApprox_Time_Range (creates a range object)
RateFALSEMBAWAmericanApprox_Rate_Range (creates a range object)
BFALSEMBAWAmericanApprox_B_Range (creates a range object)
VolFALSEMBAWAmericanApprox_Vol_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 MBAWAmericanApprox_Units;


int[] arrBMBAWAmericanApprox_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 arrMBAWAmericanApprox_Units =
new  CTQL.IntVector(arrBMBAWAmericanApprox_Units);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MBAWAmericanApprox_Units = new  CTQL.CTRangeData(arrMBAWAmericanApprox_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 MBAWAmericanApprox_Position;


string[] arrBMBAWAmericanApprox_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 arrMBAWAmericanApprox_Position =
new  CTQL.StringVector(arrBMBAWAmericanApprox_Position);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MBAWAmericanApprox_Position = new  CTQL.CTRangeData(arrMBAWAmericanApprox_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 MBAWAmericanApprox_CallPut;


string[] arrBMBAWAmericanApprox_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 arrMBAWAmericanApprox_CallPut =
new  CTQL.StringVector(arrBMBAWAmericanApprox_CallPut);

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


Example range for parameter : Underlying

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


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

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



CTQL.CTRangeData MBAWAmericanApprox_Underlying;


int[] arrBMBAWAmericanApprox_Underlying = {
38,
43,
41,
45,
42,
40,
45,
43,
40,
45,
44,
45,
44,
40,
45,
43,
43,
45,
46,
42  //  Array Data

};

CTQL.IntVector arrMBAWAmericanApprox_Underlying =
new  CTQL.IntVector(arrBMBAWAmericanApprox_Underlying);

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


Example range for parameter : Strike

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


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

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



CTQL.CTRangeData MBAWAmericanApprox_Strike;


int[] arrBMBAWAmericanApprox_Strike = {
41,
43,
38,
42,
41,
39,
40,
42,
43,
41,
37,
43,
42,
43,
37,
42,
44,
41,
41,
40  //  Array Data

};

CTQL.IntVector arrMBAWAmericanApprox_Strike =
new  CTQL.IntVector(arrBMBAWAmericanApprox_Strike);

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


Example range for parameter : Time

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


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

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



CTQL.CTRangeData MBAWAmericanApprox_Time;


int[] arrBMBAWAmericanApprox_Time = {
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 arrMBAWAmericanApprox_Time =
new  CTQL.IntVector(arrBMBAWAmericanApprox_Time);

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


Example range for parameter : Rate

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


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

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



CTQL.CTRangeData MBAWAmericanApprox_Rate;


double[] arrBMBAWAmericanApprox_Rate = {
0.0422,
0.0435,
0.0393,
0.0364,
0.0375,
0.0365,
0.038,
0.0374,
0.0369,
0.0402,
0.0385,
0.0424,
0.044,
0.0429,
0.0408,
0.0381,
0.0429,
0.0421,
0.0408,
0.04  //  Array Data

};

CTQL.DoubleVector arrMBAWAmericanApprox_Rate =
new  CTQL.DoubleVector(arrBMBAWAmericanApprox_Rate);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MBAWAmericanApprox_Rate = new  CTQL.CTRangeData(arrMBAWAmericanApprox_Rate, 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 MBAWAmericanApprox_B;


double[] arrBMBAWAmericanApprox_B = {
0.0098,
0.0092,
0.0092,
0.0104,
0.0108,
0.0101,
0.0092,
0.0102,
0.0104,
0.0109,
0.0106,
0.0094,
0.0109,
0.0108,
0.0091,
0.01,
0.0097,
0.01,
0.0096,
0.01  //  Array Data

};

CTQL.DoubleVector arrMBAWAmericanApprox_B =
new  CTQL.DoubleVector(arrBMBAWAmericanApprox_B);

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


Example range for parameter : Vol

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


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

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



CTQL.CTRangeData MBAWAmericanApprox_Vol;


double[] arrBMBAWAmericanApprox_Vol = {
0.2712,
0.293,
0.2941,
0.2976,
0.3083,
0.3285,
0.3018,
0.3066,
0.3197,
0.314,
0.3014,
0.2746,
0.2902,
0.3137,
0.2839,
0.2772,
0.327,
0.3246,
0.3221,
0.3  //  Array Data

};

CTQL.DoubleVector arrMBAWAmericanApprox_Vol =
new  CTQL.DoubleVector(arrBMBAWAmericanApprox_Vol);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MBAWAmericanApprox_Vol = new  CTQL.CTRangeData(arrMBAWAmericanApprox_Vol, 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 MBAWAmericanApprox() 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 MBAWAmericanApprox() function call


Example
NoOfUnitsPositionCallPutUnderlyingStrikeTimeRateBVolPREMIUM
1LONGCall4240388260.03650.01020.29285.59476
1LONGCall3940388260.04230.00960.30944.11524
1LONGCall4043388260.04250.00930.27492.96854
1LONGCall4137388260.04220.00970.28376.65798
1LONGCall4243388260.04170.00960.32754.71505
1LONGCall4039388260.04080.01020.32685.3622
1LONGCall4040388260.03840.01010.29344.40398
1LONGCall4243388260.04240.01030.27093.90426
1LONGCall4241388260.03980.00940.31255.40924
1LONGCall4344388260.03720.00920.30674.47633
1LONGCall3844388260.03920.01060.32352.40491
1LONGCall3936388260.03930.01060.28675.80678
1LONGCall4441388260.03640.00990.32276.77494
1LONGCall4142388260.03890.01030.29884.14244
1LONGCall3937388260.03770.01020.29465.31333
1LONGCall4541388260.04360.00970.3067.37901
1LONGCall4337388260.04270.01080.30218.36175
1LONGCall4638388260.03680.0090.324310.2208
1LONGCall4141388260.04320.01020.28214.42683
1LONGCall4240388260.040.010.35.75148



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