View source: R/GeneralizedBlackScholes.R
GeneralizedBlackScholes | R Documentation |
compute price of a option call or put with the Generalized BlackScholes formula
GeneralizedBlackScholes(s, K, r, b, v, t, type)
s |
price of the underlying asset |
K |
strike price |
r |
risk free rate |
b |
cost of carrying rate |
v |
volatility express in annual term |
t |
time to maturity of the option express in annual term |
type |
type of option Call "C" or Put "P |
The Black-Scholes-Merton model can be "generalized" by incorporating a cost-of-carry rate b. This model can be used to price European options on stocks, stocks paying a continuous dividend yield, options on futures, and currency options
price of a option call or put given the price of the underlying s, strike price K, risk free rate r, cost of carrying rate b, volatility express in annual term v, time to maturity of the option express in annual term t, type of option Call "C" or Put "P
Colzani Luca, Magni Marta, Mancassola Gaia, Kakkanattu Jenson
Espen Gaarder Haug(2007):The Complete Guide to Option Pricing Formulas
GeneralizedBlackScholes(75,70,0.1,0.05,0.35,0.5,"P") ## The function is currently defined as function (s, K, r, b, v, t, type) { d1 <- (log(s/K) + (b + v^2/2) * t)/(v * sqrt(t)) d2 <- d1 - v * sqrt(t) if (type == "C") { price <- (s * exp((b - r) * t) * pnorm(d1) - K * exp(-r * t) * pnorm(d2)) } if (type == "P") { price <- (K * exp(-r * t) * pnorm(-d2) - s * exp((b - r) * t) * pnorm(-d1)) } return(round(price, 2)) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.