Learn R Programming

QFRM (version 1.0.1)

BarrierLT: Barrrier option valuation via lattice tree (LT)

Description

Use Binomial Tree to price barrier options with relatively large NSteps (NSteps > 100) steps. The price may be not as percise as BSM function cause the convergence speed for Binomial Tree is kind of slow.

Usage

BarrierLT(o = OptPx(Opt(Style = "Barrier"), vol = 0.25, r = 0.05, q = 0.02, NSteps = 5), dir = c("Up", "Down"), knock = c("In", "Out"), H = 60)

Arguments

o
An object of class OptPx
dir
A direction for the barrier, either 'Up' or 'Down' Default='Up'
knock
The option is either a knock-in option or knock-out option. Default='In'
H
The barrier level. H should less than S0 if 'Up', H should greater than S0 if 'Down' Default=60.

Value

A list of class BarrierLT consisting of the input object OptPx and the appended new parameters and option price.

References

Hull, John C., Options, Futures and Other Derivatives, 9ed, 2014. Prentice Hall. ISBN 978-0-13-345631-8, http://www-2.rotman.utoronto.ca/~hull/ofod/index.html p.467-468. Trinomial Trees, p.604-606: Barrier Options.

Examples

Run this code
# default Up and Knock-in Call Option with H=60, approximately 7.09
(o = BarrierLT())$PxLT

#Visualization of price changes as Nsteps change.
o = Opt(Style="Barrier")
visual=sapply(10:200,function(n) BarrierLT(OptPx(o,NSteps=n))$PxLT)

c=(10:200)
plot(visual~c,type="l",xlab="NSteps",ylab="Price",main="Price converence with NSteps")

# Down and Knock-out Call Option with H=40
o = OptPx(o=Opt(Style="Barrier"))
BarrierLT(o,dir="Down",knock="Out",H=40)

# Down and Knock-in Call Option with H=40
o = OptPx(o=Opt(Style="Barrier"))
BarrierLT(o,dir="Down",knock="In",H=40)

# Up and Knock-out Call Option with H=60
o = OptPx(o=Opt(Style="Barrier"))
BarrierLT(o,dir='Up',knock="Out")

# Down and Knock-out Put Option with H=40
o = OptPx(o=Opt(Style="Barrier",Right="Put"))
BarrierLT(o,dir="Down",knock="Out",H=40)

# Down and Knock-in Put Option with H=40
o = OptPx(o=Opt(Style="Barrier",Right="Put"))
BarrierLT(o,dir="Down",knock="In",H=40)

# Up and Knock-out Put Option with H=60
o = OptPx(o=Opt(Style="Barrier",Right="Put"))
BarrierLT(o,dir='Up',knock="Out")

# Up and Knock-in Put Option with H=60
BarrierLT(OptPx(o=Opt(Style="Barrier",Right="Put")))

Run the code above in your browser using DataLab