Fit Market Parameters#
This module provides utilities to fit market-implied parameters from option prices.
Fit Rate and Dividend#
Fits the risk-free rate (r) and dividend yield (q) from put-call parity.
This function uses the prices of at-the-money (ATM) call-put pairs to
solve for the r
and q
that minimize the parity pricing error.
Parameters can be held fixed or fitted.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
calls
|
DataFrame
|
A DataFrame of call options with 'strike', 'maturity', 'marketPrice'. |
required |
puts
|
DataFrame
|
A DataFrame of put options with 'strike', 'maturity', 'marketPrice'. |
required |
spot
|
float
|
The current spot price of the underlying. |
required |
r_fixed
|
float | None
|
If provided, the risk-free rate is held fixed at this value. Defaults to None. |
None
|
q_fixed
|
float | None
|
If provided, the dividend yield is held fixed at this value. Defaults to None. |
None
|
Returns:
Type | Description |
---|---|
tuple[float, float]
|
A tuple containing the estimated (or fixed) risk-free rate and dividend yield. |
Source code in src/quantfin/calibration/fit_market_params.py
Find ATM Options#
Finds the closest at-the-money (ATM) call-put pair for each expiry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
calls
|
DataFrame
|
A DataFrame of call options. |
required |
puts
|
DataFrame
|
A DataFrame of put options. |
required |
spot
|
float
|
The current spot price of the underlying. |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
A DataFrame containing the merged ATM call-put pairs. |