DM_AmericanExchangeOption





http://www.QuantTools.com
CapeTools Derivative Matrix 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 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_AmericanExchangeOption




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

    Price of the first underlying
  4. Underlying2 parameter

    Price of the second underlying
  5. Quantity1 parameter

    Quantity of the first underlying.
  6. Quantity2 parameter

    Quantity of the second underlying.
  7. Time parameter

    Expiration date of the option.
  8. 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.
  9. 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.
  10. 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.
  11. Vol1 parameter

    Volatility of the underlying Price1.
  12. Vol2 parameter

    Volatility of the underlying Price2.
  13. Rho parameter

    Correlation between the two assets.


Extended information

Function Syntax

VB Syntax


Variant CTDerivativeMatrix.DM_AmericanExchangeOption( _
Long ValueDate, _
DayCountEnum dayCounter, _
Double Underlying1, _
Double Underlying2, _
Double Quantity1, _
Double Quantity2, _
Long Time, _
Double Rate, _
Double b1, _
Double b2, _
Double Vol1, _
Double Vol2, _
Double Rho)


Excel Spreadsheet Syntax


=CT.DM_AmericanExchangeOption(
Excel Numeric Cell ValueDate,
Excel String Cell dayCounter,
Excel Numeric Cell Underlying1,
Excel Numeric Cell Underlying2,
Excel Numeric Cell Quantity1,
Excel Numeric Cell Quantity2,
Excel Numeric Cell Time,
Excel Numeric Cell Rate,
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_AmericanExchangeOption(
long ValueDate,
DayCountEnum dayCounter,
double Underlying1,
double Underlying2,
double Quantity1,
double Quantity2,
long Time,
double Rate,
double b1,
double b2,
double Vol1,
double Vol2,
double Rho);


DotNET Syntax


CTRangeData CTDerivativeMatrixSA.DM_AmericanExchangeOption(
System.Int32 ValueDate,
CTIEnums.DayCountEnum dayCounter,
System.Double Underlying1,
System.Double Underlying2,
System.Double Quantity1,
System.Double Quantity2,
System.Int32 Time,
System.Double Rate,
System.Double b1,
System.Double b2,
System.Double Vol1,
System.Double Vol2,
System.Double Rho);

Parameter data types

ArgNameArgTypeIsKey
ValueDateLongFALSE
dayCounterDayCountEnumFALSE
Underlying1DoubleFALSE
Underlying2DoubleFALSE
Quantity1DoubleFALSE
Quantity2DoubleFALSE
TimeLongFALSE
RateDoubleFALSE
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
Underlying1FALSE101
Underlying2FALSE104
Quantity1FALSE1
Quantity2FALSE1
TimeFALSE17/Jan/2006 (serial date type)
RateFALSE0.1
b1FALSE0.02
b2FALSE0.04
Vol1FALSE0.18
Vol2FALSE0.12
RhoFALSE0.8


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


Example
DUNDERLYING1DUNDERLYING2DQUANTITY1DQUANTITY2DTIMEDRATEDB1DB2DVOL1DVOL2DRHO
DUNDERLYING10.04899-0.04757685.36147-4.947990.2015780-2.673392.467220.758911-0.216832-0.195149
DUNDERLYING2-0.04757680.0462044-4.805264.4255-0.15919802.39605-2.20669-0.5357620.1530750.137767
DQUANTITY15.36147-4.80526499.747-499.74720.35940-270.012249.18976.65-21.9-19.71
DQUANTITY2-4.947994.4255-499.747499.747-16.55660249.189-229.496-55.719215.919814.3278
DTIME0.201578-0.15919820.3594-16.5566-2.52750-51.913447.749822.9328-6.55222-5.89699
DRATE00000000000
DB1-2.673392.39605-270.012249.189-51.91340134.636-124.253-38.2210.929.828
DB22.46722-2.20669249.189-229.49647.74980-124.253114.43327.7833-7.93808-7.14428
DVOL10.758911-0.53576276.65-55.719222.93280-38.2227.7833114.079-160.7424.83799
DVOL2-0.2168320.153075-21.915.9198-6.55222010.92-7.93808-160.742238.148-54.7771
DRHO-0.1951490.137767-19.7114.3278-5.8969909.828-7.144284.83799-54.7771-8.93291



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