CashorNothing: Price of a Cash or Nothing Option

View source: R/CashorNothing.R

CashorNothingR Documentation

Price of a Cash or Nothing Option

Description

compute the price of a cash or nothing option

Usage

CashorNothing(s, K, X, r, b, v, t, type)

Arguments

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"

Details

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

Value

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"

Author(s)

Colzani Luca, Magni Marta, Mancassola Gaia, Kakkanattu Jenson

References

Espen Gaarder Haug(2007):The Complete Guide to Option Pricing Formulas

Examples

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))
  }

Lcolzani98/OptionPricingFunctions documentation built on June 13, 2022, 5:46 a.m.