View source: R/CashorNothing.R
CashorNothing | R Documentation |
compute the price of a cash or nothing option
CashorNothing(s, K, X, r, b, v, t, type)
s |
price of the underlying |
K |
strike price |
X |
cash payout |
r |
risk free interest rate |
b |
cost of carrying rate |
v |
volatility |
t |
time to maturity |
type |
call "C" or put "P" |
Cash-or-nothing options are a type of digital or binary option used in forex trading that either pays off or expires worthless. these options pay in full value if a condition is met, or zero if not; there is no partial or multiple payment
price of a cash or nothing option given the value of the underlying s, the strike price K, the risk free rate r, the cost of carrying rate b, the volatility v, the time to maturity t , and the 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
CashorNothing(100,80, 10,0.06,0,0.35,0.75,"P") ## The function is currently defined as function (s, K, X, r, b, v, t, type) { d <- (log(s/K) + (b - v^(2)/2) * t)/(v * sqrt(t)) if (type == "C") { price <- X * exp(-r * t) * pnorm(d) } if (type == "P") { price <- X * exp(-r * t) * pnorm(-d) } return(round(price, 2)) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.