simprice | R Documentation |
simprice
computes simulated lognormal price
paths, with or without jumps. Saves and restores random number
seed.
simprice(s0 = 100, v = 0.3, r = .08, tt = 1, d = 0, trials =
2, periods = 3, jump = FALSE, lambda = 0, alphaj = 0, vj = 0, seed
= NULL, long = TRUE, scalar_v_is_stddev = TRUE)
simprice(s0, v, r, tt, d, trials, periods, jump, lambda, alphaj, vj, seed, long, scalar_v_is_stddev)
s0 |
Initial price of the underlying asset |
v |
If scalar, default is volatility of the asset price,
defined as the annualized standard deviation of the
continuously-compounded return. The parameter
|
r |
Annual continuously-compounded risk-free interest rate |
tt |
Time to maturity in years |
d |
Dividend yield, annualized, continuously-compounded |
trials |
number of simulated price paths |
periods |
number of equal-length periods in each simulated path |
jump |
boolean controlling use of jump parameters |
lambda |
expected number of jumps in one year
( |
alphaj |
Expected continuously compounded jump percentage |
vj |
lognormal volatility of the jump amount |
seed |
random number seed |
long |
if |
scalar_v_is_stddev |
if |
A dataframe with trials
simulated stock price paths
# simple Monte Carlo option price example. Since there are two # periods we can compute options prices for \code{tt} and # \code{tt/2} s0=40; k=40; v=0.30; r=0.08; tt=0.25; d=0; st = simprice(s0, k, v, r, tt, d, trials=3, periods=2, jump=FALSE) callprice1 = exp(-r*tt/2)*mean(pmax(st[st$period==1,] - k, 0)) callprice2 = exp(-r*tt)*mean(pmax(st[st$period==2,] - k, 0))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.