Compute the price of a solarOption
solarOption_price(K, pdf_R, R_min, R_max, put = TRUE)When put = TRUE, the function evaluate a put payoff:
$$\mathbb{E}\{(K - R)^{+}\} = K \mathbb{P}\{R_T < K\} - \mathbb{E}\{R 1_{K > R_T}\}$$
When put = TRUE, the function evaluate a call payoff:
$$\mathbb{E}\{(K - R)^{+}\} = \mathbb{E}\{R 1_{K < R_T}\} - K \mathbb{P}\{R_T > K\}$$
Version 1.0.0.
# Parameters for the pdf of Rt
Ct <- 7
alpha <- 0.01
beta <- 0.92
Rt_min_max <- Ct * c(1-alpha-beta, 1-alpha)
pdf_R <- function(x) dsolarGHI(x, Ct, alpha, beta, function(x) dnorm(x))
cdf_R <- function(x) psolarGHI(x, Ct, alpha, beta, function(x) pnorm(x))
# Put price
solarOption_price(5, R_min = Rt_min_max[1], R_max = Rt_min_max[2], TRUE)
#> Error in solarOption_price(5, R_min = Rt_min_max[1], R_max = Rt_min_max[2], TRUE): pdf_R is not a function!
# Call price
solarOption_price(5, pdf_R, Rt_min_max[1], Rt_min_max[2], FALSE)
#> [1] 0.490686