Plots and more
finmc.plots.impliedvol.plot_iv
Plot the implied volatility surface and forward curve.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
strikes |
array
|
The strike prices. |
required |
expirations |
array
|
The expiration times. |
required |
surface |
array
|
The implied volatility surface. |
required |
Examples:
Source code in finmc\plots\impliedvol.py
finmc.plots.impliedvol.plot_atmvols
Plot the implied volatility surface and forward curve.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
expirations |
array
|
The expiration times. |
required |
atm_vols |
array
|
The ATM volatilities. |
required |
Examples:
Source code in finmc\plots\impliedvol.py
(See Heston Notebook for complete example)
finmc.plots.asset.plot_asset
Plot the progression of an asset in a model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
MCBase
|
The model to use. |
required |
asset_name |
str
|
The name of the asset to plot. |
required |
sample_idxs |
array
|
The indices of the sample paths to plot in the foreground. Defaults to the first three. |
arange(0, 3, 1)
|
q_levels |
array
|
The quantiles to show in the background. Defaults to 25 levels from 2% to 98%. |
linspace(0.02, 0.98, 25)
|
times |
array
|
The timesteps. Defaults to 1 year in 100 steps. |
linspace(0, 1, 101)
|
Examples:
Source code in finmc\plots\asset.py
Utility to calculate option prices or implied volatility surface from a MC Simulation, for any model. This is useful for calibrating the model to Black-Scholes option prices.
finmc.calc.impliedvol.iv_surface_mc
Calculate the implied volatility surface using MC Simulation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
strikes |
The strikes of the options. |
required | |
expirations |
The expirations of the options in years. |
required | |
asset_name |
str
|
The name of the asset. |
required |
model |
MCBase
|
The model used to simulate the asset price. |
required |
is_log |
bool
|
if True, the strikes are in log, i.e. log(K/F). |
False
|
Returns:
Type | Description |
---|---|
The implied volatility surface as a 2D numpy array with a row for each strike and a column for each expiration. |
Examples:
>>> strikes = np.linspace(2900, 3100, 3)
>>> expirations = [0.25, 0.5, 1]
>>> surface = iv_surface_mc(strikes, expirations, "SPX", model)
Source code in finmc\calc\impliedvol.py
finmc.calc.impliedvol.atmvols_mc
Calculate the atmvols using MC Simulation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
expirations |
The expirations of the options in years. |
required | |
asset_name |
str
|
The name of the asset. |
required |
model |
MCBase
|
The model used to simulate the asset price. |
required |
Returns:
Type | Description |
---|---|
A tuple containing the ATM volatilities, and the forward prices. |
Examples:
>>> strikes = np.linspace(2900, 3100, 3)
>>> expirations = [0.25, 0.5, 1]
>>> atm_vols, fwds = atmvols_mc(expirations, "SPX", model)