EuropeanStandardMonteCarlo: European Option price computed using Monte Carlo simulation

View source: R/EuropeanStandardMonteCarlo.R

EuropeanStandardMonteCarloR Documentation

European Option price computed using Monte Carlo simulation

Description

The function computes the price of a European Option using Monte Carlo simulation

Usage

EuropeanStandardMonteCarlo(s, K, r, b, v, nSim, t, type)

Arguments

s

price of underliying

K

strike price

r

risk free rate

b

cost of carry rate

v

volatility

nSim

number of simulations

t

time to maturity

type

call "C" or put "P"

Details

Monte Carlo simulation is a numerical method that is useful in many situations when no closed-form solution is available. Monte Carlo simulating in option pricing, originally introduced by Boyle (1977), can be used to value most types of European options and, as we will see, also American options

Value

Price European Option computed using Monte Carlo simulation given the price of the underlying s, the trike price K, the risk free rate r, the cost of carrying rate b, the volatility v, the number of simulation nSim, the time to maturity of the option t, the type of call "C" or put "P"

Author(s)

Colzani Luca, Magni Marta, Mancassola Gaia, Kakkanattu Jenson

References

Espen Gaarder Haug(2007):The Complete Guide to Option Pricing Formulas

Examples

EuropeanStandardMonteCarlo(100,90,0.05,0.02,0.3,1000,0.5,"C")
## The function is currently defined as
function (s, K, r, b, v, nSim, t, type) 
{
    sum <- 0
    if (type == "C") {
        for (j in 1:nSim) {
            st <- s * exp(((b - v^2)/2) * t + v * sqrt(t) * rnorm(j))
            sum <- sum + max((st - K), 0)
        }
    }
    if (type == "P") {
        for (j in 1:nSim) {
            st <- s * exp(((b - v^2)/2) * t + v * sqrt(t) * rnorm(j))
            sum <- sum + max((K - st), 0)
        }
        price <- (exp(-r * t) * sum)/nSim
    }
    price <- (exp(-r * t) * sum)/nSim
    return(round(price, 2))
  }

Lcolzani98/OptionPricingFunctions documentation built on June 13, 2022, 5:46 a.m.