RSKLevyAsian





http://www.QuantTools.com
CapeTools Bump Risk function list

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

Key TAGs | Excel Index | API Index



It is not possible to find a closed form solution for the valuation of options on an arithmetic average.

The main reason for this is that when the asset is assumed to be lognormally distributed, the arithmetic average will not itself have a lognormal distribution.

Arithmetic average-rate options can be priced by analytical approximations or by Monte-carlo simulations.

This function uses an analytical approximation devised by Levy.

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 bumps an input parameter given a bump map and displays the difference from the base value.

You can request to see the difference of any of the option greeks.

The name of the parameter that you wish to bump is simply entered into the 'BumpParam' string parameter.

The bump map can be a single value, a vector or a matrix input.



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




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

    A range of bump values, of which the chosen input will be bumped by. For Equity, FX type deals, you can provide a single value, vector or matrix, for interest rate type products, the bump range must be of the same shape as the market curve.
  4. BumpParam parameter

    The parameter in which will be bumped, you can only choose parameters in which the ranges normally take double (decimal) values.
  5. CallPut parameter

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

    Underlying price
  7. SA parameter

    Arithmetic average of the known asset price fixings.
  8. X parameter

    Strike price of the option
  9. T parameter

    Original time to option maturity.
  10. T2 parameter

    Remaining 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. Cannot be equal to zero (0.0)
  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), 'dSA' (for the 'SA' parameter), 'dX' (for the 'X' parameter), 'dT' (for the 'T' parameter), 'dT2' (for the 'T2' 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 CTBumpRisk.RSKLevyAsian( _
Long ValueDate, _
DayCountEnum dayCounter, _
Variant BumpRange, _
String BumpParam, _
Variant CallPut, _
Variant S, _
Variant SA, _
Variant X, _
Variant T, _
Variant T2, _
Variant r, _
Variant b, _
Variant v, _
String Greek)


Excel Spreadsheet Syntax


=CT.RSKLevyAsian(
Excel Numeric Cell ValueDate,
Excel String Cell dayCounter,
XLRange BumpRange,
Excel String Cell BumpParam,
XLRange CallPut,
XLRange S,
XLRange SA,
XLRange X,
XLRange T,
XLRange T2,
XLRange r,
XLRange b,
XLRange v,
Excel String Cell Greek)


C++ Syntax


static CTRangeDataCPP RSKLevyAsian(
long ValueDate,
DayCountEnum dayCounter,
CTRangeDataCPP BumpRange,
std::string BumpParam,
CTRangeDataCPP CallPut,
CTRangeDataCPP S,
CTRangeDataCPP SA,
CTRangeDataCPP X,
CTRangeDataCPP T,
CTRangeDataCPP T2,
CTRangeDataCPP r,
CTRangeDataCPP b,
CTRangeDataCPP v,
std::string Greek);


DotNET Syntax


CTRangeData CTBumpRiskSA.RSKLevyAsian(
System.Int32 ValueDate,
CTIEnums.DayCountEnum dayCounter,
CTRangeData BumpRange,
System.String BumpParam,
CTRangeData CallPut,
CTRangeData S,
CTRangeData SA,
CTRangeData X,
CTRangeData T,
CTRangeData T2,
CTRangeData r,
CTRangeData b,
CTRangeData v,
System.String Greek);

Parameter data types

ArgNameArgTypeIsKey
ValueDateLongFALSE
dayCounterDayCountEnumFALSE
BumpRangeRangeFALSE
BumpParamStringFALSE
CallPutRangeFALSE
SRangeFALSE
SARangeFALSE
XRangeFALSE
TRangeFALSE
T2RangeFALSE
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
BumpRangeFALSERSKLevyAsian_BumpRange_Range (creates a range object)
BumpParamFALSEv
CallPutFALSERSKLevyAsian_CallPut_Range (creates a range object)
SFALSERSKLevyAsian_S_Range (creates a range object)
SAFALSERSKLevyAsian_SA_Range (creates a range object)
XFALSERSKLevyAsian_X_Range (creates a range object)
TFALSERSKLevyAsian_T_Range (creates a range object)
T2FALSERSKLevyAsian_T2_Range (creates a range object)
rFALSERSKLevyAsian_r_Range (creates a range object)
bFALSERSKLevyAsian_b_Range (creates a range object)
vFALSERSKLevyAsian_v_Range (creates a range object)
GreekFALSEPREMIUM


Example range for parameter : BumpRange

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


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

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



CTQL.CTRangeData RSKLevyAsian_BumpRange;


double[] arrBRSKLevyAsian_BumpRange = {
0.0196,
0.0209,
0.0186,
0.0192,
0.0208,
0.0186,
0.0186,
0.0207,
0.0203,
0.0205,
0.0205,
0.0214,
0.02,
0.0214,
0.019,
0.0195,
0.018,
0.0188,
0.0207,
0.02  //  Array Data

};

CTQL.DoubleVector arrRSKLevyAsian_BumpRange =
new  CTQL.DoubleVector(arrBRSKLevyAsian_BumpRange);

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


string[] arrBRSKLevyAsian_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 arrRSKLevyAsian_CallPut =
new  CTQL.StringVector(arrBRSKLevyAsian_CallPut);

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


double[] arrBRSKLevyAsian_S = {
94.9632,
91.5591,
108.5767,
105.8577,
102.7635,
104.5496,
105.4303,
92.8213,
94.2993,
97.662,
107.934,
104.7878,
104.9672,
90.956,
97.1583,
94.7954,
106.9024,
94.2767,
104.8184,
100.0  //  Array Data

};

CTQL.DoubleVector arrRSKLevyAsian_S =
new  CTQL.DoubleVector(arrBRSKLevyAsian_S);

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


Example range for parameter : SA

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


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

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



CTQL.CTRangeData RSKLevyAsian_SA;


int[] arrBRSKLevyAsian_SA = {
117,
121,
107,
111,
109,
102,
111,
106,
112,
112,
120,
103,
101,
104,
102,
110,
111,
114,
111,
110  //  Array Data

};

CTQL.IntVector arrRSKLevyAsian_SA =
new  CTQL.IntVector(arrBRSKLevyAsian_SA);

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


int[] arrBRSKLevyAsian_X = {
89,
93,
90,
93,
90,
86,
91,
99,
104,
102,
100,
92,
89,
95,
100,
92,
96,
94,
102,
95  //  Array Data

};

CTQL.IntVector arrRSKLevyAsian_X =
new  CTQL.IntVector(arrBRSKLevyAsian_X);

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


int[] arrBRSKLevyAsian_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 arrRSKLevyAsian_T =
new  CTQL.IntVector(arrBRSKLevyAsian_T);

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


Example range for parameter : T2

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


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

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



CTQL.CTRangeData RSKLevyAsian_T2;


int[] arrBRSKLevyAsian_T2 = {
CTQL.Date.serialNumber("17/1/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("17/1/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("17/1/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("17/1/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("17/1/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("17/1/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("17/1/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("17/1/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("17/1/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("17/1/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("17/1/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("17/1/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("17/1/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("17/1/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("17/1/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("17/1/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("17/1/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("17/1/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("17/1/2006", "dd/mm/yyyy"),
CTQL.Date.serialNumber("17/1/2006", "dd/mm/yyyy")  //  Array Data

};

CTQL.IntVector arrRSKLevyAsian_T2 =
new  CTQL.IntVector(arrBRSKLevyAsian_T2);

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


double[] arrBRSKLevyAsian_r = {
0.1047,
0.1053,
0.1022,
0.1091,
0.094,
0.1065,
0.096,
0.1004,
0.1073,
0.0907,
0.0965,
0.1045,
0.1033,
0.1026,
0.106,
0.1057,
0.0955,
0.1034,
0.097,
0.10  //  Array Data

};

CTQL.DoubleVector arrRSKLevyAsian_r =
new  CTQL.DoubleVector(arrBRSKLevyAsian_r);

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


double[] arrBRSKLevyAsian_b = {
0.0464,
0.0544,
0.0493,
0.0525,
0.0464,
0.0541,
0.0546,
0.0464,
0.0482,
0.0506,
0.0516,
0.0477,
0.0492,
0.0452,
0.0474,
0.0538,
0.053,
0.0502,
0.046,
0.05  //  Array Data

};

CTQL.DoubleVector arrRSKLevyAsian_b =
new  CTQL.DoubleVector(arrBRSKLevyAsian_b);

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


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 RSKLevyAsian_v;


double[] arrBRSKLevyAsian_v = {
0.3028,
0.3048,
0.3174,
0.2955,
0.2795,
0.3141,
0.3064,
0.2923,
0.2927,
0.2788,
0.2947,
0.2755,
0.2736,
0.319,
0.3004,
0.3145,
0.3032,
0.2854,
0.3102,
0.30  //  Array Data

};

CTQL.DoubleVector arrRSKLevyAsian_v =
new  CTQL.DoubleVector(arrBRSKLevyAsian_v);

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


Example
0.131554
0.0437676
0.15074
0.0978251
0.0841362
0.176304
0.191625
0.0872154
0.142353
0.0626779
0.00713043
0.198272
0.074766
0.0310292
0.0236303
0.0436761
0.0172947
0.183233
0.00814388
0.0997007



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