The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
CustomDerivative is an R package for transparent
derivative pricing and risk analytics. It combines analytical
Black-Scholes pricing with extensible Monte Carlo engines for terminal
and path-dependent payoffs.
R CMD check through GitHub Actionsinstall.packages("pak")
pak::pak("AIM-IT4/CustomDerivative")For the development branch:
pak::pak("AIM-IT4/CustomDerivative@agent/advanced-derivatives-engine")library(CustomDerivative)
black_scholes_price(
spot = 100,
strike = 100,
maturity = 1,
rate = 0.05,
volatility = 0.20,
type = "call"
)The package prices a payoff (g(S_T)) as
[ V_0 = e{-rT}{}[g(S_T)], ]
under risk-neutral geometric Brownian motion.
result <- price_european_mc(
payoff = call_payoff(100),
spot = 100,
maturity = 1,
rate = 0.05,
volatility = 0.20,
n_simulations = 100000,
seed = 42
)
result
result$diagnostics$variance_reduction_ratioA custom digital payoff can be supplied directly:
digital <- function(terminal_price) {
100 * as.numeric(terminal_price > 110)
}
price_european_mc(
payoff = digital,
spot = 100,
maturity = 1,
rate = 0.05,
volatility = 0.20,
seed = 42
)asian <- price_path_dependent_mc(
payoff = asian_call_payoff(strike = 100),
spot = 100,
maturity = 1,
rate = 0.05,
volatility = 0.20,
n_steps = 252,
n_simulations = 20000,
seed = 42
)
asiancall_pricer <- function(spot, maturity, rate, volatility) {
black_scholes_price(
spot = spot,
strike = 100,
maturity = maturity,
rate = rate,
volatility = volatility,
type = "call"
)
}
finite_difference_greeks(
pricer = call_pricer,
spot = 100,
maturity = 1,
rate = 0.05,
volatility = 0.20
)The current simulation model assumes a single tradable underlying following risk-neutral geometric Brownian motion with constant volatility, interest rate, and dividend yield. Path-dependent claims are monitored on a discrete grid. The package does not yet implement early exercise, stochastic volatility, jump diffusion, or multi-asset correlation models.
install.packages(c("devtools", "testthat"))
devtools::document()
devtools::test()
devtools::check()MIT. Copyright Amit Kumar Jha.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.