SOLVEPartialTimeTwoAssetBarrier





http://www.QuantTools.com
CapeTools Option Solver function list

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

Key TAGs | Excel Index | API Index



A partial-time tow-asset barrier option is similar to a standard two-asset barrier option, except that the barrier hits are monitored only for a fraction of the option's lifetime.

The option is knocked in or out if asset S2 hits the Barrier H during the monitoring period, while the payoff depends on asset S1 and the strike price X. 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 tries to solve for the value indicated by the 'SolveFor' parameter.

Simply enter the name of the parameter you wish to solve for.



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




High level graphic of SOLVEPartialTimeTwoAssetBarrier() function with parameters. Blue square node is the actual function with the parameters ordered.



Parameter Description


  1. ValueDate parameter

    This parameter cannot be solved for. Valuation Date (typically equal to Today's date)
  2. dayCounter parameter

    This parameter cannot be solved for. 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. PremiumVal parameter

    This parameter cannot be solved for. Premium Value that will be tested against.
  4. SolverKey parameter

    This parameter cannot be solved for. Key to an already created Solver object (Within the 'CapeTools One-Dimensional Solvers' category of functions).
  5. tolerance parameter

    This parameter cannot be solved for. tolerance (ie - 0.0001).
  6. TypeFlag parameter

    This parameter cannot be solved for. Option Types cdi, cui, pdi, pui, cdo,cuo, pdo, puo
  7. S1 parameter

    Underlying1 price
  8. S2 parameter

    Underlying2 price
  9. X parameter

    Strike price of the option
  10. H parameter

    Continuous Barrier level
  11. AdjBarrFreq parameter

    This parameter cannot be solved for. Monitoring frequency that you wish the continuous barrier level value entered to have. (Basically will convert the barrier from continuous to discrete. If you choose 'Continuously', the barrier will still be a Continuous barrier). Valid values are : Continuously, Hourly, Daily, Weekly or Monthly.
  12. t1 parameter

    This parameter cannot be solved for. Barrier LifeTime.
  13. T2 parameter

    This parameter cannot be solved for. Time to option maturity.
  14. 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.
  15. 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.
  16. 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.
  17. v1 parameter

    Volatility of the first underlying.
  18. v2 parameter

    Volatility of the second underlying.
  19. rho parameter

    Correlation between the two assets.
  20. SolveFor parameter

    The parameter in which you would like to solve for.


Extended information

Function Syntax

VB Syntax


Double CTOptionSolver.SOLVEPartialTimeTwoAssetBarrier( _
Long ValueDate, _
DayCountEnum dayCounter, _
Double PremiumVal, _
String SolverKey, _
Double tolerance, _
String TypeFlag, _
Double S1, _
Double S2, _
Double X, _
Double H, _
String AdjBarrFreq, _
Long t1, _
Long T2, _
Double r, _
Double b1, _
Double b2, _
Double v1, _
Double v2, _
Double rho, _
String SolveFor)


Excel Spreadsheet Syntax


=CT.SOLVEPartialTimeTwoAssetBarrier(
Excel Numeric Cell ValueDate,
Excel String Cell dayCounter,
Excel Numeric Cell PremiumVal,
Excel String Cell SolverKey,
Excel Numeric Cell tolerance,
Excel String Cell TypeFlag,
Excel Numeric Cell S1,
Excel Numeric Cell S2,
Excel Numeric Cell X,
Excel Numeric Cell H,
Excel String Cell AdjBarrFreq,
Excel Numeric Cell t1,
Excel Numeric Cell T2,
Excel Numeric Cell r,
Excel Numeric Cell b1,
Excel Numeric Cell b2,
Excel Numeric Cell v1,
Excel Numeric Cell v2,
Excel Numeric Cell rho,
Excel String Cell SolveFor)


C++ Syntax


static double SOLVEPartialTimeTwoAssetBarrier(
long ValueDate,
DayCountEnum dayCounter,
double PremiumVal,
std::string SolverKey,
double tolerance,
std::string TypeFlag,
double S1,
double S2,
double X,
double H,
std::string AdjBarrFreq,
long t1,
long T2,
double r,
double b1,
double b2,
double v1,
double v2,
double rho,
std::string SolveFor);


DotNET Syntax


System.Double CTOptionSolverSA.SOLVEPartialTimeTwoAssetBarrier(
System.Int32 ValueDate,
CTIEnums.DayCountEnum dayCounter,
System.Double PremiumVal,
System.String SolverKey,
System.Double tolerance,
System.String TypeFlag,
System.Double S1,
System.Double S2,
System.Double X,
System.Double H,
System.String AdjBarrFreq,
System.Int32 t1,
System.Int32 T2,
System.Double r,
System.Double b1,
System.Double b2,
System.Double v1,
System.Double v2,
System.Double rho,
System.String SolveFor);

Parameter data types

ArgNameArgTypeIsKey
ValueDateLongFALSE
dayCounterDayCountEnumFALSE
PremiumValDoubleFALSE
SolverKeyStringTRUE
toleranceDoubleFALSE
TypeFlagStringFALSE
S1DoubleFALSE
S2DoubleFALSE
XDoubleFALSE
HDoubleFALSE
AdjBarrFreqStringFALSE
t1LongFALSE
T2LongFALSE
rDoubleFALSE
b1DoubleFALSE
b2DoubleFALSE
v1DoubleFALSE
v2DoubleFALSE
rhoDoubleFALSE
SolveForStringFALSE


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
PremiumValFALSE8
SolverKeyFALSESolverKeyNAME.EXTTAG.TICKER (from a function call)
toleranceFALSE0.0001
TypeFlagFALSEcdo
S1FALSE100.0
S2FALSE100.0
XFALSE95
HFALSE90
AdjBarrFreqFALSEDaily
t1FALSE18/Oct/2005 (serial date type)
T2FALSE17/Jan/2006 (serial date type)
rFALSE0.08
b1FALSE0.00
b2FALSE0.00
v1FALSE0.2
v2FALSE0.2
rhoFALSE0.5
SolveForFALSEv1


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 SOLVEPartialTimeTwoAssetBarrier() 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.

These are the financial QuantTools sub-function calls that are used within the examples :





The objects generated by these sub-functions are inter-connected in the following way :




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


0.12659566513828

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