Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: finance
See also: optstart influence

Quantlet: greeks
Description: calculates or displays the different sensitivities (the so called greeks) which are used for trading with options.

Usage: dat=greeks() or dat=greeks(S,K,r,sigma,tau,carry,opt,pder{,v1,ub1{,v2,ub2}})
Input:
S price of the underlying asset, see the notes for further information about the dimension of all parameters
K exercise price
r domestic interest rate in the interval: [0%, 100%]
sigma volatility per year which can be found in the following interval (0%,100%)
tau time to expiration (in years)
carry cost of carry in percent of the value of the underlying object (0%, 100%)
opt type of the option, if opt = 1, a call is assumed, opt = 0, a put is considered
pder scalar, determines which partial derivative should be computed: 1 for delta, 2 for gamma, 3 for eta, 4 for delta-k, 5 for vega, 6 for theta, 7 for rho, 8 for rho-b
v1 scalar, explanatory variable for the a 2- or 3-dimensional plot: 1 for S, 2 for K , 3 for r, 4 for sigma, 5 for tau, 6 for carry. If not specified, no plot will be displayed.
ub1 upper bound for the chosen explanatory variable v1. The lower bound represents the already specified value (S,K,r,sigma,tau or carry).
v2 scalar, second explanatory variable for the 3-dimensional plot.
ub2 upper bound for the second explanatory variable v2.
Output:
dat the computed values of greeks at the specified points

Note:

Example:
library("finance")
dat = greeks()

Result:
Opens several interactive menus where you are asked to
specify the option features and your variables of interest.
According to your choice a two or three dimensional graph
displays the sensitivities.
Example:
library("finance")
S   = 230       ; spot price
K   = 210       ; strike price
r   = 5         ; interest rate
sigma = 25      ; volatility
tau = 0.5       ; time to expiration
carry = 5       ; cost of carry
opt  = 0        ; put
pder = 3        ; eta
v1 = 4          ; volatility
ub1 = 40
v2 = 3          ; interest rate
ub2 = 10
g2=greeks(S,K,r,sigma,tau,carry,opt,pder,v1,ub1,v2,ub2)
g2[1:10,]       ; the first ten values of eta can be found
; in the last column

Result:
Contents of _tmp
[ 1,]     0.25  0.04879  -14.699
[ 2,]    0.255  0.04879  -14.273
[ 3,]     0.26  0.04879  -13.872
[ 4,]    0.265  0.04879  -13.495
[ 5,]     0.27  0.04879   -13.14
[ 6,]    0.275  0.04879  -12.804
[ 7,]     0.28  0.04879  -12.487
[ 8,]    0.285  0.04879  -12.186
[ 9,]     0.29  0.04879    -11.9
[10,]    0.295  0.04879  -11.629

The first column contains different values of volatility,
the second column consists of one value only, which corresponds
to the continuous interest rate of 5% (other values of the
interest rate are in the following rows). The third column
contains the corresponding values of eta at the specified
points. A three-dimensional plot, the eta-surface of the specified
European put option, is depicted as well.
Example:
library("finance")
S = aseq(150,16,10)
K = aseq(150,16,15)
r = 10
sigma = aseq(5,  16,2)
tau   = 5:20
carry = 5:20
opt  =(matrix(8)|0*matrix(8))
pder =(1:8|1:8)
greeks(S,K,r,sigma,tau,carry,opt,pder)

Result:
Contents of dat
[ 1,]      150      150       10        5        5        5        1        1  0.77547
[ 2,]      160      165       10        7        6        6        1        2  0.0068436
[ 3,]      170      180       10        9        7        7        1        3   2.3355
[ 4,]      180      195       10       11        8        8        1        4 -0.18682
[ 5,]      190      210       10       13        9        9        1        5   203.47
[ 6,]      200      225       10       15       10       10        1        6   3.0756
[ 7,]      210      240       10       17       11       11        1        7   96.214
[ 8,]      220      255       10       19       12       12        1        8   619.08
[ 9,]      230      270       10       21       13       13        0        1  -1.2112
[10,]      240      285       10       23       14       14        0        2  0.0015297
[11,]      250      300       10       25       15       15        0        3   1.1903
[12,]      260      315       10       27       16       16        0        4  0.21657
[13,]      270      330       10       29       17       17        0        5   328.81
[14,]      280      345       10       31       18       18        0        6  -69.859
[15,]      290      360       10       33       19       19        0        7  -1117.9
[16,]      300      375       10       35       20       20        0        8   -33480



Author: K. Komorad, W. Haerdle, 20011215 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006