Description Usage Arguments Details Value References Examples
Applications of he Black-Scholes option pricing formula
1 2 |
cp |
Direction of the option: call or put. |
strike |
Strike price of the option. If left |
delta |
Delta of the option. Used to calculate the strike if |
time.to.mat |
Time to maturity of the option, expressed in years. If left |
val.date, exp.date |
Valuation and expiration dates. Used to calculate time to maturity if |
spot |
Spot price of the underlying. |
vol |
Volatility of the underlying. |
price |
Price of the option. |
rate |
Risk-free or forward rate. If left |
fwd |
Forward price of the underlying. Used to calculate forward rate if |
These functions take inputs necessary for evaluating options and run them through the Black-Scholes formula and its derivatives.
The bs.fx.opt
variant implements the conventions of FX options that are priced in the currency of the underlying. E.g., a EUR/USD option (the option to buy or sell EUR vs USD) is priced in EUR. In this function:
P' = P/S \\ Δ' = dP'/dS * S = Δ - P' \\ Γ' = dΔ'/dS = Γ - Δ'/S
A data.frame
with inputs, price, and sensitivities.
http://en.wikipedia.org/wiki/Black%E2%80%93Scholes_model
1 2 3 4 5 6 7 8 9 10 11 12 | ## puts on SPX
bs.opt("put", strike=seq(1940, 1960, 5), time.to.mat=63/365, spot=1960, vol=0.025, fwd=1954)
## use dates instead of time.to.mat
today <- Sys.Date()
bs.opt("put", strike=seq(1940, 1960, 5), val.date=today, exp.date=today+63, spot=1960, vol=0.025, rate=0.0197)
## EUR/USD -- use fwd instead of rate
bs.fx.opt("call", strike=135:138/100, val.date=today, exp.date=today+365, spot=1.365, vol=0.07, fwd=1.365)
## back into strikes from deltas
bs.fx.opt(c("put", "put", "call", "call"), delta=c(-.25, -.50, .50, .25), time.to.mat=0.25, spot=1.365, vol=0.05, rate=0)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.