Black Pricing#
- quantflow.options.bs.black_price(k: ndarray, sigma: ndarray[tuple[int, ...], dtype[floating[Any]]] | float, ttm: ndarray[tuple[int, ...], dtype[floating[Any]]] | float, s: ndarray[tuple[int, ...], dtype[floating[Any]]] | float) ndarray #
Calculate the Black call/put option prices in forward terms from the following params
\[ \begin{align}\begin{aligned}c &= \frac{C}{F} = N(d1) - e^k N(d2)\\p &= \frac{P}{F} = -N(-d1) + e^k N(-d2)\\d1 &= \frac{-k + \frac{\sigma^2 t}{2}}{\sigma \sqrt{t}}\\d2 &= d1 - \sigma \sqrt{t}\end{aligned}\end{align} \]- Parameters:
k – a vector of \(\log{\frac{K}{F}}\) also known as moneyness
sigma – a corresponding vector of implied volatilities (0.2 for 20%)
ttm – time to maturity
s – the call/put flag, 1 for calls, -1 for puts
The results are option prices divided by the forward price also known as option prices in forward terms.
- quantflow.options.bs.black_delta(k: ndarray, sigma: ndarray[tuple[int, ...], dtype[floating[Any]]] | float, ttm: ndarray[tuple[int, ...], dtype[floating[Any]]] | float, s: ndarray[tuple[int, ...], dtype[floating[Any]]] | float) ndarray #
Calculate the Black call/put option delta from the moneyness, volatility and time to maturity.
\[\begin{split}\begin{align} \delta_c &= \frac{\partial C}{\partial F} = N(d1) \\ \delta_p &= \frac{\partial P}{\partial F} = N(d1) - 1 \end{align}\end{split}\]- Parameters:
k – a vector of moneyness, see above
sigma – a corresponding vector of implied volatilities (0.2 for 20%)
ttm – time to maturity
s – the call/put flag, 1 for calls, -1 for puts
- quantflow.options.bs.black_vega(k: ndarray, sigma: ndarray, ttm: ndarray[tuple[int, ...], dtype[floating[Any]]] | float) ndarray #
Calculate the Black option vega from the moneyness, volatility and time to maturity.
\[\nu = \frac{\partial c}{\partial \sigma} = \frac{\partial p}{\partial \sigma} = N'(d1) \sqrt{t}\]- Parameters:
k – a vector of moneyness, see above
sigma – a corresponding vector of implied volatilities (0.2 for 20%)
ttm – time to maturity
Same formula for both calls and puts.
- quantflow.options.bs.implied_black_volatility(k: ndarray, price: ndarray, ttm: ndarray[tuple[int, ...], dtype[floating[Any]]] | float, initial_sigma: ndarray[tuple[int, ...], dtype[floating[Any]]], call_put: ndarray[tuple[int, ...], dtype[floating[Any]]] | float) RootResults #
Calculate the implied block volatility via Newton’s method
- Parameters:
k – a vector of log(strikes/forward) also known as moneyness
price – a corresponding vector of option_price/forward
ttm – time to maturity
initial_sigma – a vector of initial volatility guesses
call_put – a vector of call/put flags, 1 for calls, -1 for puts