MFloatingStrikeLookback





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

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

Key TAGs | Excel Index | API Index



Call option the right to buy the underlying security at the lowest price observed Smin, put gives the right to sell the underlying security at the highest price observed Smax.

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




High level graphic of MFloatingStrikeLookback() 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
  8. Smin parameter

    Minimum underlying price observed thus far
  9. Smax parameter

    Maximum underlying price observed thus far
  10. Time parameter

    Time to expiration of the option.
  11. 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.
  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.
  13. Vol 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 : 'dUnderlying' (for the 'Underlying' parameter), 'dSmin' (for the 'Smin' parameter), 'dSmax' (for the 'Smax' 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.MFloatingStrikeLookback( _
Long ValueDate, _
DayCountEnum dayCounter, _
Variant Units, _
Variant Position, _
String Level, _
Variant CallPut, _
Variant Underlying, _
Variant Smin, _
Variant Smax, _
Variant Time, _
Variant Rate, _
Variant B, _
Variant Vol, _
String Greek)


Excel Spreadsheet Syntax


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


C++ Syntax


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


DotNET Syntax


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

Parameter data types

ArgNameArgTypeIsKey
ValueDateLongFALSE
dayCounterDayCountEnumFALSE
UnitsRangeFALSE
PositionRangeFALSE
LevelStringFALSE
CallPutRangeFALSE
UnderlyingRangeFALSE
SminRangeFALSE
SmaxRangeFALSE
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
UnitsFALSEMFloatingStrikeLookback_Units_Range (creates a range object)
PositionFALSEMFloatingStrikeLookback_Position_Range (creates a range object)
LevelFALSEALL
CallPutFALSEMFloatingStrikeLookback_CallPut_Range (creates a range object)
UnderlyingFALSEMFloatingStrikeLookback_Underlying_Range (creates a range object)
SminFALSEMFloatingStrikeLookback_Smin_Range (creates a range object)
SmaxFALSEMFloatingStrikeLookback_Smax_Range (creates a range object)
TimeFALSEMFloatingStrikeLookback_Time_Range (creates a range object)
RateFALSEMFloatingStrikeLookback_Rate_Range (creates a range object)
BFALSEMFloatingStrikeLookback_B_Range (creates a range object)
VolFALSEMFloatingStrikeLookback_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 MFloatingStrikeLookback_Units;


int[] arrBMFloatingStrikeLookback_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 arrMFloatingStrikeLookback_Units =
new  CTQL.IntVector(arrBMFloatingStrikeLookback_Units);

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


string[] arrBMFloatingStrikeLookback_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 arrMFloatingStrikeLookback_Position =
new  CTQL.StringVector(arrBMFloatingStrikeLookback_Position);

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


string[] arrBMFloatingStrikeLookback_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 arrMFloatingStrikeLookback_CallPut =
new  CTQL.StringVector(arrBMFloatingStrikeLookback_CallPut);

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


int[] arrBMFloatingStrikeLookback_Underlying = {
126,
111,
131,
112,
114,
125,
117,
122,
112,
128,
127,
116,
131,
116,
124,
108,
122,
130,
130,
120  //  Array Data

};

CTQL.IntVector arrMFloatingStrikeLookback_Underlying =
new  CTQL.IntVector(arrBMFloatingStrikeLookback_Underlying);

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


Example range for parameter : Smin

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


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

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



CTQL.CTRangeData MFloatingStrikeLookback_Smin;


int[] arrBMFloatingStrikeLookback_Smin = {
93,
106,
98,
90,
97,
102,
107,
97,
102,
93,
98,
99,
98,
102,
109,
102,
106,
95,
103,
100  //  Array Data

};

CTQL.IntVector arrMFloatingStrikeLookback_Smin =
new  CTQL.IntVector(arrBMFloatingStrikeLookback_Smin);

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


Example range for parameter : Smax

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


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

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



CTQL.CTRangeData MFloatingStrikeLookback_Smax;


int[] arrBMFloatingStrikeLookback_Smax = {
119,
114,
132,
119,
131,
111,
120,
124,
119,
119,
110,
116,
111,
127,
122,
120,
130,
125,
130,
120  //  Array Data

};

CTQL.IntVector arrMFloatingStrikeLookback_Smax =
new  CTQL.IntVector(arrBMFloatingStrikeLookback_Smax);

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


int[] arrBMFloatingStrikeLookback_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 arrMFloatingStrikeLookback_Time =
new  CTQL.IntVector(arrBMFloatingStrikeLookback_Time);

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


double[] arrBMFloatingStrikeLookback_Rate = {
0.1043,
0.0901,
0.0973,
0.0959,
0.0983,
0.1001,
0.0962,
0.0971,
0.1057,
0.1096,
0.0974,
0.1092,
0.1068,
0.0992,
0.0953,
0.1007,
0.1024,
0.1074,
0.0905,
0.1  //  Array Data

};

CTQL.DoubleVector arrMFloatingStrikeLookback_Rate =
new  CTQL.DoubleVector(arrBMFloatingStrikeLookback_Rate);

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


double[] arrBMFloatingStrikeLookback_B = {
0.043,
0.043,
0.0374,
0.0431,
0.0416,
0.0386,
0.0391,
0.0421,
0.0414,
0.0423,
0.0367,
0.0421,
0.0416,
0.0435,
0.038,
0.0416,
0.0427,
0.043,
0.0411,
0.04  //  Array Data

};

CTQL.DoubleVector arrMFloatingStrikeLookback_B =
new  CTQL.DoubleVector(arrBMFloatingStrikeLookback_B);

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


double[] arrBMFloatingStrikeLookback_Vol = {
0.314,
0.2907,
0.301,
0.2804,
0.2778,
0.2796,
0.2887,
0.2894,
0.2893,
0.3254,
0.2856,
0.2704,
0.3266,
0.2872,
0.3136,
0.2808,
0.3267,
0.3281,
0.3223,
0.3  //  Array Data

};

CTQL.DoubleVector arrMFloatingStrikeLookback_Vol =
new  CTQL.DoubleVector(arrBMFloatingStrikeLookback_Vol);

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


Example
NoOfUnitsPositionCallPutUnderlyingSminSmaxTimeRateBVolPREMIUM
1LONGCall11091123387340.10620.04210.32825.4735
1LONGCall11993122387340.09580.03680.310430.4046
1LONGCall127108123387340.09190.03990.285925.7197
1LONGCall120103115387340.09760.03850.287724.1031
1LONGCall124100128387340.09260.03810.328129.9759
1LONGCall111110125387340.10980.04290.275717.4954
1LONGCall129109109387340.09560.04150.327928.3087
1LONGCall117107127387340.09450.03970.302321.1987
1LONGCall111108109387340.10290.04260.297718.6305
1LONGCall123109110387340.10070.03940.282122.8357
1LONGCall124104112387340.10220.03940.278226.0701
1LONGCall114107129387340.10210.03750.318421.0033
1LONGCall127104129387340.10280.03670.303229.3012
1LONGCall126102126387340.09810.03980.299229.3722
1LONGCall11392126387340.10380.04380.321226.666
1LONGCall112107126387340.10030.04160.281718.2154
1LONGCall12196127387340.10380.03840.271329.1256
1LONGCall11698123387340.09350.04290.295724.13
1LONGCall11295128387340.10770.03670.284623.4151
1LONGCall120100120387340.10.040.326.2656



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