MExchangeExchangeOption





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

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

Key TAGs | Excel Index | API Index



Exchange options on Exchange Options.

1=Option to exchange Q*S2 for the option to exchange S2 for S1, 2=Option to exchange the option to exchange S2 for S1 in return for Q*S2, 3=Option to exchange Q*S2 for the option to exchange S1 for S2, 4=Option to exchange the option to exchange S1 for S2 in return for Q*S2 . 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.MExchangeExchangeOption




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

    Integer value (1 - 4) indicating option type.
  7. Underlying1 parameter

    Price of the first underlying
  8. Underlying2 parameter

    Price of the second underlying
  9. Q parameter

    Quantity of the second underlying S2.
  10. Timet1 parameter

    Time to expiration of the original option.
  11. TimeT parameter

    Time to expiration of the underlying option, (greater than dTimet1).
  12. 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.
  13. 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.
  14. 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.
  15. Vol1 parameter

    Volatility of the underlying UnderlyingS1.
  16. Vol2 parameter

    Volatility of the underlying UnderlyingS2.
  17. Rho parameter

    Correlation between the two assets.
  18. 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), 'dQ' (for the 'Q' parameter), 'dTimet1' (for the 'Timet1' parameter), 'dTimeT' (for the 'TimeT' 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 CTExoticAnalysis.MExchangeExchangeOption( _
Long ValueDate, _
DayCountEnum dayCounter, _
Variant Units, _
Variant Position, _
String Level, _
Variant OptionType, _
Variant Underlying1, _
Variant Underlying2, _
Variant Q, _
Variant Timet1, _
Variant TimeT, _
Variant Rate, _
Variant b1, _
Variant b2, _
Variant Vol1, _
Variant Vol2, _
Variant Rho, _
String Greek)


Excel Spreadsheet Syntax


=CT.MExchangeExchangeOption(
Excel Numeric Cell ValueDate,
Excel String Cell dayCounter,
XLRange Units,
XLRange Position,
Excel String Cell Level,
XLRange OptionType,
XLRange Underlying1,
XLRange Underlying2,
XLRange Q,
XLRange Timet1,
XLRange TimeT,
XLRange Rate,
XLRange b1,
XLRange b2,
XLRange Vol1,
XLRange Vol2,
XLRange Rho,
Excel String Cell Greek)


C++ Syntax


static CTRangeDataCPP MExchangeExchangeOption(
long ValueDate,
DayCountEnum dayCounter,
CTRangeDataCPP Units,
CTRangeDataCPP Position,
std::string Level,
CTRangeDataCPP OptionType,
CTRangeDataCPP Underlying1,
CTRangeDataCPP Underlying2,
CTRangeDataCPP Q,
CTRangeDataCPP Timet1,
CTRangeDataCPP TimeT,
CTRangeDataCPP Rate,
CTRangeDataCPP b1,
CTRangeDataCPP b2,
CTRangeDataCPP Vol1,
CTRangeDataCPP Vol2,
CTRangeDataCPP Rho,
std::string Greek);


DotNET Syntax


CTRangeData CTExoticAnalysisSA.MExchangeExchangeOption(
System.Int32 ValueDate,
CTIEnums.DayCountEnum dayCounter,
CTRangeData Units,
CTRangeData Position,
System.String Level,
CTRangeData OptionType,
CTRangeData Underlying1,
CTRangeData Underlying2,
CTRangeData Q,
CTRangeData Timet1,
CTRangeData TimeT,
CTRangeData Rate,
CTRangeData b1,
CTRangeData b2,
CTRangeData Vol1,
CTRangeData Vol2,
CTRangeData Rho,
System.String Greek);

Parameter data types

ArgNameArgTypeIsKey
ValueDateLongFALSE
dayCounterDayCountEnumFALSE
UnitsRangeFALSE
PositionRangeFALSE
LevelStringFALSE
OptionTypeRangeFALSE
Underlying1RangeFALSE
Underlying2RangeFALSE
QRangeFALSE
Timet1RangeFALSE
TimeTRangeFALSE
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
UnitsFALSEMExchangeExchangeOption_Units_Range (creates a range object)
PositionFALSEMExchangeExchangeOption_Position_Range (creates a range object)
LevelFALSEALL
OptionTypeFALSEMExchangeExchangeOption_OptionType_Range (creates a range object)
Underlying1FALSEMExchangeExchangeOption_Underlying1_Range (creates a range object)
Underlying2FALSEMExchangeExchangeOption_Underlying2_Range (creates a range object)
QFALSEMExchangeExchangeOption_Q_Range (creates a range object)
Timet1FALSEMExchangeExchangeOption_Timet1_Range (creates a range object)
TimeTFALSEMExchangeExchangeOption_TimeT_Range (creates a range object)
RateFALSEMExchangeExchangeOption_Rate_Range (creates a range object)
b1FALSEMExchangeExchangeOption_b1_Range (creates a range object)
b2FALSEMExchangeExchangeOption_b2_Range (creates a range object)
Vol1FALSEMExchangeExchangeOption_Vol1_Range (creates a range object)
Vol2FALSEMExchangeExchangeOption_Vol2_Range (creates a range object)
RhoFALSEMExchangeExchangeOption_Rho_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 MExchangeExchangeOption_Units;


int[] arrBMExchangeExchangeOption_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 arrMExchangeExchangeOption_Units =
new  CTQL.IntVector(arrBMExchangeExchangeOption_Units);

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


string[] arrBMExchangeExchangeOption_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 arrMExchangeExchangeOption_Position =
new  CTQL.StringVector(arrBMExchangeExchangeOption_Position);

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


Example range for parameter : OptionType

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


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

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



CTQL.CTRangeData MExchangeExchangeOption_OptionType;


int[] arrBMExchangeExchangeOption_OptionType = {
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2  //  Array Data

};

CTQL.IntVector arrMExchangeExchangeOption_OptionType =
new  CTQL.IntVector(arrBMExchangeExchangeOption_OptionType);

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


int[] arrBMExchangeExchangeOption_Underlying1 = {
115,
100,
106,
95,
115,
106,
100,
113,
112,
112,
110,
100,
102,
111,
115,
110,
110,
100,
110,
105  //  Array Data

};

CTQL.IntVector arrMExchangeExchangeOption_Underlying1 =
new  CTQL.IntVector(arrBMExchangeExchangeOption_Underlying1);

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


int[] arrBMExchangeExchangeOption_Underlying2 = {
105,
90,
97,
104,
99,
95,
109,
91,
91,
96,
97,
101,
107,
102,
110,
99,
93,
91,
110,
100  //  Array Data

};

CTQL.IntVector arrMExchangeExchangeOption_Underlying2 =
new  CTQL.IntVector(arrBMExchangeExchangeOption_Underlying2);

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


Example range for parameter : Q

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


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

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



CTQL.CTRangeData MExchangeExchangeOption_Q;


double[] arrBMExchangeExchangeOption_Q = {
0.1003,
0.0907,
0.091,
0.104,
0.0971,
0.1002,
0.1078,
0.1028,
0.0984,
0.1087,
0.11,
0.0986,
0.1088,
0.1087,
0.101,
0.0972,
0.1025,
0.1041,
0.0904,
0.1  //  Array Data

};

CTQL.DoubleVector arrMExchangeExchangeOption_Q =
new  CTQL.DoubleVector(arrBMExchangeExchangeOption_Q);

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


Example range for parameter : Timet1

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


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

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



CTQL.CTRangeData MExchangeExchangeOption_Timet1;


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

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


Example range for parameter : TimeT

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


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

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



CTQL.CTRangeData MExchangeExchangeOption_TimeT;


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

};

CTQL.IntVector arrMExchangeExchangeOption_TimeT =
new  CTQL.IntVector(arrBMExchangeExchangeOption_TimeT);

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


double[] arrBMExchangeExchangeOption_Rate = {
0.0921,
0.0982,
0.0963,
0.0963,
0.1022,
0.1005,
0.0961,
0.1014,
0.0979,
0.1052,
0.0913,
0.0928,
0.0979,
0.1074,
0.103,
0.1082,
0.1054,
0.1091,
0.0912,
0.1  //  Array Data

};

CTQL.DoubleVector arrMExchangeExchangeOption_Rate =
new  CTQL.DoubleVector(arrBMExchangeExchangeOption_Rate);

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

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

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

// Parse the string into the Range object.
MExchangeExchangeOption_b1.RangeFromStr( MExchangeExchangeOption_b1_builder.ToString() );


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 MExchangeExchangeOption_b2 = new CTQL.CTRangeData();

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

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

// Parse the string into the Range object.
MExchangeExchangeOption_b2.RangeFromStr( MExchangeExchangeOption_b2_builder.ToString() );


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


double[] arrBMExchangeExchangeOption_Vol1 = {
0.2061,
0.2173,
0.1868,
0.2064,
0.1907,
0.1856,
0.2052,
0.1904,
0.2105,
0.1809,
0.1849,
0.2048,
0.1975,
0.18,
0.1977,
0.186,
0.2044,
0.1968,
0.2045,
0.2  //  Array Data

};

CTQL.DoubleVector arrMExchangeExchangeOption_Vol1 =
new  CTQL.DoubleVector(arrBMExchangeExchangeOption_Vol1);

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


double[] arrBMExchangeExchangeOption_Vol2 = {
0.2706,
0.2287,
0.2645,
0.2365,
0.2543,
0.2336,
0.2447,
0.2737,
0.2716,
0.2573,
0.2592,
0.2354,
0.2328,
0.2471,
0.2319,
0.2534,
0.2332,
0.2453,
0.2516,
0.25  //  Array Data

};

CTQL.DoubleVector arrMExchangeExchangeOption_Vol2 =
new  CTQL.DoubleVector(arrBMExchangeExchangeOption_Vol2);

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


double[] arrBMExchangeExchangeOption_Rho = {
0.5225,
0.4821,
0.4557,
0.4713,
0.5338,
0.4618,
0.5001,
0.5123,
0.5135,
0.5402,
0.5379,
0.5046,
0.5444,
0.5496,
0.5286,
0.5011,
0.4737,
0.5297,
0.5091,
0.5  //  Array Data

};

CTQL.DoubleVector arrMExchangeExchangeOption_Rho =
new  CTQL.DoubleVector(arrBMExchangeExchangeOption_Rho);

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


Example
NoOfUnitsPositionOptionTypeUnderlying1Underlying2QTimet1TimeTRateb1b2Vol1Vol2RhoPREMIUM
1LONG21061010.091438826389170.0999000.20070.25260.49573.854
1LONG295930.090638826389170.0981000.19890.240.47363.94256
1LONG295910.102838826389170.1021000.20840.24930.45444.16
1LONG21071040.100338826389170.0934000.21480.25350.53724.91603
1LONG2115970.094338826389170.0938000.1880.2540.5071.98305
1LONG2109950.107138826389170.0985000.19880.23530.46162.90439
1LONG2108900.102938826389170.1006000.21250.22680.54891.83926
1LONG2991090.096438826389170.1042000.2010.2430.50247.32998
1LONG295950.101438826389170.107000.20430.23190.48975.115
1LONG2991060.103838826389170.1062000.19520.22510.50327.42921
1LONG2971100.103738826389170.0999000.21720.25020.48018.38875
1LONG2103950.106738826389170.1041000.21480.25780.46583.89743
1LONG21081060.098238826389170.0992000.20930.24570.45325.01104
1LONG2113960.095638826389170.099000.21140.27110.47622.22643
1LONG21111010.106538826389170.0978000.20530.2620.49583.87731
1LONG21131070.107938826389170.1056000.19040.23530.54035.05331
1LONG2991030.090338826389170.0939000.19260.23650.49045.48853
1LONG2109900.096838826389170.1026000.1810.24120.50841.59352
1LONG2991080.095238826389170.109000.18850.23680.49357.07049
1LONG21051000.138826389170.1000.20.250.54.31957



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