User guide¶
Contents
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
- Heston
- Wishart
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)
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: