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: american asset bitree BlackScholes european mcmillan optstart IBTcrr IBTbc

Quantlet: barrier
Description: calculates barrier option prices.

Reference(s):

Usage: opv =barrier(S, K, Sb, r, d, sigma, tau, knock, type)
Input:
S d1 x ... x d8 array, the current value of the index
K d1 x ... x d8 array, exercise price
Sb d1 x ... x d8 array, barriers
r d1 x ... x d8 array, riskless interest rate
d d1 x ... x d8 array, divident rate
sigma d1 x ... x d8 array, volatility
tau d1 x ... x d8 array, time to expiration (in years)
knock string, if knock="out", "Out" or "OUT", the knock out option price is calculated; if knock="in", "In" or "IN" , the knock in option price is calculated.
type string, if type="call", "Call" or "CALL", the call option price is calculated; if type="put", "Put" or "PUT" , the put option price is calculated.
Output:
opv d1 x ... x d8 array, call option price or put option price

Note:

Example:
library("finance")
S=100
Sb = 120
r=0.03
d = 0
K=100
tau=1
sigma=0.1
knock="out"
type="call"
C=barrier(S, K, Sb, r, d, sigma, tau, knock, type)
C

Result:
Price of a knock out call option with one year expiration time.

Contents of C

[1,]   3.4335
Example:
library("finance")
S=#(100,105)~#(110,115)
Sb = 120*matrix(2,2)
r=0.03
d = 0
K=100
tau=1
sigma=#(01,0.05)~#(0.2,0.01)
knock="out"
type="call"
C=barrier(S, K, Sb, r, d, sigma, tau, knock, type)
C

Result:
Price of four knock out call options, all with same parameters but
 distinct underlying volatilities.


Contents of C

[1,]  0.012536  0.72439
[2,]   7.4645   15.416



Author: S. Borak, 20031222 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006