User guide

Models

The models that are currently implemented in fyne are the Black-Scholes, Heston and Wishart models. In order to make notation clear, especially with the naming of the parameters, we state below the discounted underlying price dynamics of the models under the risk-neutral measure.

  • Black-Scholes
\[dS_t = \sigma S_t dW_t\]
  • Heston
\[\begin{split}dS_t & = \sqrt{V_t} S_t dW_t \\ dV_t & = \kappa(\theta - V_t)dt + \nu \sqrt{V_t}dZ_t \\ d[W, Z]_t & = \rho dt\end{split}\]
  • Wishart
\[\begin{split}dS_t & = S_t \mathrm{Tr} \left( \sqrt{V_t} \left( dW_t R + dZ_t \sqrt{I - RR^T} \right) \right) \\ dV_t & = \left(\beta QQ^T + M V_t + V_t M^T \right) dt + \sqrt{V_t} dW_t Q + Q^T dW_t^T \sqrt{V_t} \\ d[W, Z]_t & = 0\end{split}\]

Pricing

Each model has its own pricing formula. The available pricing functions are:

These functions return the price of the option in monetary units. If implied volatility is needed, it can be evaluated with fyne.blackscholes.implied_vol().

Example

In this example, we compute the implied volatility smile according to the Heston model.

import numpy as np
import pandas as pd
from fyne import blackscholes, heston


underlying_price = 100.
vol, kappa, theta, nu, rho = 0.0457, 5.07, 0.0457, 0.48, -0.767
strikes = pd.Index(np.linspace(80., 120., 40), name='Strike')
expiries = pd.Index([0.1, 0.3, 1.0], name='Expiry')

option_prices = heston.formula(underlying_price, strikes[:, None], expiries,
                               vol, kappa, theta, nu, rho)

implied_vols = pd.DataFrame(
    blackscholes.implied_vol(underlying_price, strikes[:, None], expiries,
                             option_prices),
    strikes, expiries)

implied_vols.plot().set_ylabel('Implied volatility')

(Source code, png, hires.png, pdf)

_images/heston_smile.png

Greeks

Greeks are usually associated to the derivatives of the Black-Scholes formula. However, Greeks can be computed according to other models as well. The following are the available Greeks in fyne:

Calibration

In fyne we distinguish two types of calibration:

  • Cross-sectional * Calibration from options prices at a single point in time
  • Panel * Calibration from options prices at a multiple points in time

Besides, calibration can recover the full parameter set and unobservable state variables or just the unobservable state variables.

The available calibration functions are the following: