The objective of this project is to price a European-style down-and-in put option using Monte Carlo simulation implemented in C++ via the Rcpp package. The project also examines how the theoretical price of the option depends on the volatility of the underlying asset and the time to maturity.
The pricing model is based on the following assumptions:
# install.packages("BarrierOptionRcpp")
library(BarrierOptionRcpp)
The option considered is a European down-and-in put option. The option becomes active only if the underlying asset price falls below a predefined barrier level at any time before maturity.
The payoff at maturity is given by:
max(K − S_T, 0), provided the barrier has been breached.
set.seed(123)
price <- downInPutMC(
S0 = 105,
K = 110,
B = 95,
r = 0.05,
sigma = 0.21,
T = 0.75,
nSteps = 200,
nSim = 100000
)
price
## [1] 7.445242
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.4.3
sigmas <- seq(0.1, 0.5, by = 0.05)
maturities <- seq(0.25, 1.5, by = 0.25)
results <- expand.grid(
sigma = sigmas,
T = maturities
)
results$price <- NA
set.seed(123)
for (i in 1:nrow(results)) {
results$price[i] <- downInPutMC(
S0 = 105,
K = 110,
B = 95,
r = 0.05,
sigma = results$sigma[i],
T = results$T[i],
nSteps = 200,
nSim = 50000
)
}
ggplot(results, aes(x = sigma, y = price, color = factor(T))) +
geom_line(linewidth = 1) +
labs(
title = "Down-and-In Put Option Price",
x = "Volatility (σ)",
y = "Option Price",
color = "Time to Maturity (T)"
) +
theme_minimal()
The Monte Carlo results show that the price of the down-and-in put option increases with both the volatility of the underlying asset and the time to maturity.
Higher volatility increases the likelihood that the asset price will breach the barrier level, thereby activating the option. Similarly, a longer time to maturity provides more opportunity for the barrier to be reached, which increases the expected payoff of the option.
However, the barrier feature reduces the option price compared to a standard European put option, as the payoff is conditional on the barrier being breached.
In accordance with the Honor Code, I certify that my answers here are my own work, and I did not make my solutions available to anyone else.