Following https://www.macroption.com/black-scholes-formula/
(calc-annual-yield {:keys [annual-dividend-yield annual-dividend-rate
stock-price]})
(calc-d1
{s0 :stock-price q :yield X :strike t :t v :impliedVolatility :as data})
(calc-d2 d1 v t)
(calc-delta {q :yield d1 :d1 t :t opt-type :opt-type})
(calc-gamma {s0 :stock-price
X :strike
t :t
v :impliedVolatility
d1 :d1
q :yield
eqt :eqt
:as data})
(calc-premium {opt-type :opt-type
X :strike
s0 :stock-price
eqt :eqt
d1 :d1
d2 :d2
t :t
q :yield})
(calc-rho {opt-type :opt-type X :strike t :t d2 :d2})
(calc-theta {X :strike
t :t
d1 :d1
q :yield
:as data
v :impliedVolatility
d2 :d2
s0 :stock-price
opt-type :opt-type
eqt :eqt})
(calc-vega {s0 :stock-price
X :strike
t :t
v :impliedVolatility
d1 :d1
eqt :eqt
:as data})
(calculate-greeks {expiration :expiration v :impliedVolatility :as data})
(expiration-years t)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close