CapeTools Payoff
http://www.QuantTools.com
In total there are 6 functions present within the CapeTools Payoff category of functions.
General Description
Functions to price option products under a pricing engine framework.
To price a single product under this framework, you require 5 objects to be constructed. These are :
- A pricing engine object
- An exercise object
- A payoff object
- One or more process objects
- A pricer object
The pricing engine object specifies the method of calculation (Tree, MC, direct, integration etc...).
The exercise object specifies the date(s) that exercise can take place.
The payoff object specifies the payoff function.
The process object(s) specifies the characteristics of the underlyer(s) whether Equity, FX or Commodity.
The pricer object takes in the Engine, Exercise, Payoff and Process objects and compute a price.
This category of contains the Payoff objects that are to be passed to option pricing functions (see the 'CapeTools EngineOptions' category of functions). The following Payoff types can be constructed :
- PlainVanilla() ( For a call max(price-strike,0.0), for a put max(strike-price,0.0) )
- PercentageStrike() ( Strike expressed as a percentage. For a call, price*max(1-moneyness,0.0), for a put, price*max(moneyness-1,0.0) )
- CashOrNothing() ( Binary cash-or-nothing payoff. For a call, if(price-strike is greater than 0.0 , cashPayoff , 0.0), for a put, if(strike-price is greater than 0.0 , cashPayoff , 0.0) )
- AssetOrNothingPayoff() ( Binary asset-or-nothing payoff. For a call, if(price-strike is greater than 0.0 , price , 0.0), for a put, if(strike-price is greater than 0.0 , price , 0.0) )
- Gap() ( Binary gap payoff. For a call, if(price-strike is greater than 0.0 , price-strikePayoff , 0.0), for a put, if(strike-price is greater than 0.0 , strikePayoff-price , 0.0) )
- Gap() ( Binary gap payoff. For a call, if(price-strike is greater than 0.0 , price-strikePayoff , 0.0), for a put, if(strike-price is greater than 0.0 , strikePayoff-price , 0.0) )
You can also create a generic payoff function via the following function :
The custom Generic PayOff function takes one underlyer (x) and up to 16 constant arguments (strike being one of them). x represents the underlying price (stock, FX Rate etc...) and will be populated during the pricing. Parameters 'a' through 'n' are the user defined constants. The constant e is predefined as 2.718281828459045235360287; the constant pi is predefined as 3.141592653589793238462643.
Within this function you define both the 'call' and 'put' formulas and then indicate which one is to be priced. (ie callFormula=max(x-strike,a+b*c), putFormula=max(strike-x,a+b*c) )
Valid functions and operators that can be used within the payoff expressions are :
Predefined functions (case sensitive) :
- sin(x) ( sine function )
- cos(x) ( cosine function )
- tan(x) ( tangens function )
- asin(x) ( arcus sine function )
- acos(x) ( arcus cosine function )
- atan(x) ( arcus tangens function )
- sinh(x) ( hyperbolic sine function )
- cosh(x) ( hyperbolic cosine function )
- tanh(x) ( hyperbolic tangens function )
- asinh(x) ( hyperbolic arcus sine function )
- acosh(x) ( hyperbolic arcus cosine function )
- atanh(x) ( hyperbolic arcur tangens function )
- log2(x) ( logarithm to the base 2 )
- log10(x) ( logarithm to the base 10 )
- log(x) ( logarithm to the base 10 )
- ln(x) ( logarithm to the base e (2.71828...)
- exp(x) ( e raised to the power of x )
- sqrt(x) ( square root of a value )
- sign(x) ( sign function ) -1=(if x<0), 1=(if x>0 )
- rint(x) ( round to nearest integer )
- abs(x) ( absolute value )
- min(a,b,c,d,e,...) ( min of all arguments ie - min(-2,1,5,-6) )
- max(a,b,c,d,e,...) ( max of all arguments ie - max(-2,1,5,-6) )
- sum(a,b,c,d,e,...) ( sum of all arguments ie - sum(-2,1,5,-6) )
- avg(a,b,c,d,e,...) ( mean value of all arguments ie - avg(-2,1,5,-6) )
- ite(x,y,z) ( if ... then ... else ... : ie - ite(a<b, 5.0, -3.0) )
Predefined operators :
- + ( addition )
- - ( subtraction )
- * ( multiplication )
- / ( division )
- ^ ( raise x to the power of y )
Predefined operators that can be used within the first parameter of the ite() or iff() function :
- and ( logical and )
- or ( logical or )
- <= ( less or equal )
- >= ( greater or equal )
- != ( not equal )
- == ( equal to )
- > ( greater than )
- < ( less than )
- Brackets, '(' and ')', can also be used to simplify expressions.
Function list.
- AssetOrNothingPayoff - Creates an option payoff object which is a binary asset-or-nothing payoff.
- CashOrNothing - Creates an option payoff object which is a binary cash-or-nothing payoff.
- Gap - Creates an option payoff object which is a binary gap payoff.
- GenericPayOff - Creates a custom Generic PayOff function with one variable (x) and up to 16 constant arguments (strike being one of them).
- PercentageStrike - Creates an option payoff object based on a payoff with strike expressed as a percentage.
- PlainVanilla - Creates an option payoff object based on a Plain-vanilla payoff.
Copyright (c) 2003-2007 CapeTools - All Rights Reserved.