RSKAmericanExchangeOption





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

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

Key TAGs | Excel Index | API Index



Option to exchange one asset for another.

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.RSKAmericanExchangeOption




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

    Price of the first underlying
  6. Underlying2 parameter

    Price of the second underlying
  7. Quantity1 parameter

    Quantity of the first underlying.
  8. Quantity2 parameter

    Quantity of the second underlying.
  9. Time parameter

    Expiration date of the option.
  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. 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 underlying Price1.
  14. Vol2 parameter

    Volatility of the underlying Price2.
  15. Rho parameter

    Correlation between the two assets.
  16. Greek parameter

    For the option premium specify 'PREMIUM'. For all first derivatives, you can specify one of the following : 'dUnderlying1' (for the 'Underlying1' parameter), 'dUnderlying2' (for the 'Underlying2' parameter), 'dQuantity1' (for the 'Quantity1' parameter), 'dQuantity2' (for the 'Quantity2' parameter), 'dTime' (for the 'Time' parameter), 'dRate' (for the 'Rate' parameter), 'db1' (for the 'b1' parameter), 'db2' (for the 'b2' parameter), 'dVol1' (for the 'Vol1' parameter), 'dVol2' (for the 'Vol2' parameter), 'dRho' (for the 'Rho' parameter), For second order derivatives, you can specify combinations of the first order derivatives (i.e. - 'dUnderlying1dUnderlying1', 'dVol1dVol1', 'dUnderlying1dVol1'. )


Extended information

Function Syntax

VB Syntax


Variant CTBumpRisk.RSKAmericanExchangeOption( _
Long ValueDate, _
DayCountEnum dayCounter, _
Variant BumpRange, _
String BumpParam, _
Variant Underlying1, _
Variant Underlying2, _
Variant Quantity1, _
Variant Quantity2, _
Variant Time, _
Variant Rate, _
Variant b1, _
Variant b2, _
Variant Vol1, _
Variant Vol2, _
Variant Rho, _
String Greek)


Excel Spreadsheet Syntax


=CT.RSKAmericanExchangeOption(
Excel Numeric Cell ValueDate,
Excel String Cell dayCounter,
XLRange BumpRange,
Excel String Cell BumpParam,
XLRange Underlying1,
XLRange Underlying2,
XLRange Quantity1,
XLRange Quantity2,
XLRange Time,
XLRange Rate,
XLRange b1,
XLRange b2,
XLRange Vol1,
XLRange Vol2,
XLRange Rho,
Excel String Cell Greek)


C++ Syntax


static CTRangeDataCPP RSKAmericanExchangeOption(
long ValueDate,
DayCountEnum dayCounter,
CTRangeDataCPP BumpRange,
std::string BumpParam,
CTRangeDataCPP Underlying1,
CTRangeDataCPP Underlying2,
CTRangeDataCPP Quantity1,
CTRangeDataCPP Quantity2,
CTRangeDataCPP Time,
CTRangeDataCPP Rate,
CTRangeDataCPP b1,
CTRangeDataCPP b2,
CTRangeDataCPP Vol1,
CTRangeDataCPP Vol2,
CTRangeDataCPP Rho,
std::string Greek);


DotNET Syntax


CTRangeData CTBumpRiskSA.RSKAmericanExchangeOption(
System.Int32 ValueDate,
CTIEnums.DayCountEnum dayCounter,
CTRangeData BumpRange,
System.String BumpParam,
CTRangeData Underlying1,
CTRangeData Underlying2,
CTRangeData Quantity1,
CTRangeData Quantity2,
CTRangeData Time,
CTRangeData Rate,
CTRangeData b1,
CTRangeData b2,
CTRangeData Vol1,
CTRangeData Vol2,
CTRangeData Rho,
System.String Greek);

Parameter data types

ArgNameArgTypeIsKey
ValueDateLongFALSE
dayCounterDayCountEnumFALSE
BumpRangeRangeFALSE
BumpParamStringFALSE
Underlying1RangeFALSE
Underlying2RangeFALSE
Quantity1RangeFALSE
Quantity2RangeFALSE
TimeRangeFALSE
RateRangeFALSE
b1RangeFALSE
b2RangeFALSE
Vol1RangeFALSE
Vol2RangeFALSE
RhoRangeFALSE
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
BumpRangeFALSERSKAmericanExchangeOption_BumpRange_Range (creates a range object)
BumpParamFALSEVol1
Underlying1FALSERSKAmericanExchangeOption_Underlying1_Range (creates a range object)
Underlying2FALSERSKAmericanExchangeOption_Underlying2_Range (creates a range object)
Quantity1FALSERSKAmericanExchangeOption_Quantity1_Range (creates a range object)
Quantity2FALSERSKAmericanExchangeOption_Quantity2_Range (creates a range object)
TimeFALSERSKAmericanExchangeOption_Time_Range (creates a range object)
RateFALSERSKAmericanExchangeOption_Rate_Range (creates a range object)
b1FALSERSKAmericanExchangeOption_b1_Range (creates a range object)
b2FALSERSKAmericanExchangeOption_b2_Range (creates a range object)
Vol1FALSERSKAmericanExchangeOption_Vol1_Range (creates a range object)
Vol2FALSERSKAmericanExchangeOption_Vol2_Range (creates a range object)
RhoFALSERSKAmericanExchangeOption_Rho_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 RSKAmericanExchangeOption_BumpRange;


double[] arrBRSKAmericanExchangeOption_BumpRange = {
0.0215,
0.0198,
0.0205,
0.0196,
0.0196,
0.021,
0.0198,
0.0182,
0.0187,
0.0199,
0.019,
0.0213,
0.0204,
0.0194,
0.0201,
0.02,
0.0193,
0.0185,
0.0204,
0.02  //  Array Data

};

CTQL.DoubleVector arrRSKAmericanExchangeOption_BumpRange =
new  CTQL.DoubleVector(arrBRSKAmericanExchangeOption_BumpRange);

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


Example range for parameter : Underlying1

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


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

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



CTQL.CTRangeData RSKAmericanExchangeOption_Underlying1;


int[] arrBRSKAmericanExchangeOption_Underlying1 = {
97,
93,
94,
97,
92,
93,
102,
109,
107,
102,
101,
110,
106,
108,
97,
104,
99,
105,
108,
101  //  Array Data

};

CTQL.IntVector arrRSKAmericanExchangeOption_Underlying1 =
new  CTQL.IntVector(arrBRSKAmericanExchangeOption_Underlying1);

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


Example range for parameter : Underlying2

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


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

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



CTQL.CTRangeData RSKAmericanExchangeOption_Underlying2;


int[] arrBRSKAmericanExchangeOption_Underlying2 = {
100,
113,
108,
96,
102,
110,
111,
109,
105,
99,
95,
98,
107,
111,
95,
107,
110,
107,
100,
104  //  Array Data

};

CTQL.IntVector arrRSKAmericanExchangeOption_Underlying2 =
new  CTQL.IntVector(arrBRSKAmericanExchangeOption_Underlying2);

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


Example range for parameter : Quantity1

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


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

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



CTQL.CTRangeData RSKAmericanExchangeOption_Quantity1;


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

};

CTQL.IntVector arrRSKAmericanExchangeOption_Quantity1 =
new  CTQL.IntVector(arrBRSKAmericanExchangeOption_Quantity1);

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


Example range for parameter : Quantity2

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


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

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



CTQL.CTRangeData RSKAmericanExchangeOption_Quantity2;


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

};

CTQL.IntVector arrRSKAmericanExchangeOption_Quantity2 =
new  CTQL.IntVector(arrBRSKAmericanExchangeOption_Quantity2);

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


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

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


double[] arrBRSKAmericanExchangeOption_Rate = {
0.1074,
0.1081,
0.0914,
0.099,
0.1019,
0.1002,
0.0931,
0.1042,
0.1004,
0.1075,
0.1079,
0.0957,
0.1038,
0.1086,
0.0952,
0.1061,
0.1004,
0.0999,
0.103,
0.1  //  Array Data

};

CTQL.DoubleVector arrRSKAmericanExchangeOption_Rate =
new  CTQL.DoubleVector(arrBRSKAmericanExchangeOption_Rate);

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


Example range for parameter : b1

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


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

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



CTQL.CTRangeData RSKAmericanExchangeOption_b1;


double[] arrBRSKAmericanExchangeOption_b1 = {
0.0215,
0.0193,
0.018,
0.0194,
0.0216,
0.0196,
0.0202,
0.0208,
0.0181,
0.0203,
0.0204,
0.0218,
0.0194,
0.0214,
0.0194,
0.0195,
0.0196,
0.0217,
0.0206,
0.02  //  Array Data

};

CTQL.DoubleVector arrRSKAmericanExchangeOption_b1 =
new  CTQL.DoubleVector(arrBRSKAmericanExchangeOption_b1);

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


Example range for parameter : b2

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


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

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



CTQL.CTRangeData RSKAmericanExchangeOption_b2;


double[] arrBRSKAmericanExchangeOption_b2 = {
0.0402,
0.0412,
0.0367,
0.0395,
0.0429,
0.0429,
0.0438,
0.04,
0.0422,
0.0367,
0.0416,
0.0393,
0.0365,
0.0397,
0.0373,
0.0403,
0.0394,
0.0393,
0.0391,
0.04  //  Array Data

};

CTQL.DoubleVector arrRSKAmericanExchangeOption_b2 =
new  CTQL.DoubleVector(arrBRSKAmericanExchangeOption_b2);

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


Example range for parameter : Vol1

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


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

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



CTQL.CTRangeData RSKAmericanExchangeOption_Vol1;


double[] arrBRSKAmericanExchangeOption_Vol1 = {
0.1918,
0.1686,
0.1697,
0.1892,
0.1773,
0.1975,
0.1719,
0.1774,
0.1651,
0.1688,
0.1741,
0.1792,
0.1795,
0.1834,
0.1822,
0.1884,
0.1692,
0.1721,
0.1718,
0.18  //  Array Data

};

CTQL.DoubleVector arrRSKAmericanExchangeOption_Vol1 =
new  CTQL.DoubleVector(arrBRSKAmericanExchangeOption_Vol1);

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


Example range for parameter : Vol2

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


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

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



CTQL.CTRangeData RSKAmericanExchangeOption_Vol2;


double[] arrBRSKAmericanExchangeOption_Vol2 = {
0.1243,
0.1204,
0.1283,
0.1086,
0.1299,
0.1123,
0.1091,
0.1107,
0.1283,
0.1086,
0.1271,
0.1141,
0.1202,
0.1094,
0.1294,
0.1231,
0.1237,
0.1097,
0.1267,
0.12  //  Array Data

};

CTQL.DoubleVector arrRSKAmericanExchangeOption_Vol2 =
new  CTQL.DoubleVector(arrBRSKAmericanExchangeOption_Vol2);

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


Example range for parameter : Rho

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


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

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



CTQL.CTRangeData RSKAmericanExchangeOption_Rho;


double[] arrBRSKAmericanExchangeOption_Rho = {
0.8298,
0.7674,
0.828,
0.7766,
0.8095,
0.7447,
0.8677,
0.7826,
0.7759,
0.7721,
0.7252,
0.7909,
0.7686,
0.7813,
0.7753,
0.767,
0.8209,
0.7224,
0.858,
0.8  //  Array Data

};

CTQL.DoubleVector arrRSKAmericanExchangeOption_Rho =
new  CTQL.DoubleVector(arrBRSKAmericanExchangeOption_Rho);

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


Example
0.434503
0.2959
0.47195
0.115162
0.487241
0.486179
0.403551
0.0154479
0.387516
0.125499
0.0852313
0.0299364
0.255521
0.0364085
0.231176
0.448595
0.134308
0.113485
0.312508
0.438751



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