Mean Inversion Models API
Mean inversion pricing model for asset pricing.
This module implements the Ornstein-Uhlenbeck process for mean-reverting assets such as commodities, interest rates, and volatility.
analytical_mean_inversion_option(current_price, long_term_mean, mean_reversion_rate, volatility, time_to_expiry, risk_free_rate, strike_price, option_type='call')
Price European options on mean-reverting assets using an analytical approximation.
This function implements an analytical approximation for pricing European options on mean-reverting assets based on the Ornstein-Uhlenbeck process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
current_price
|
float
|
Current price of the underlying asset |
required |
long_term_mean
|
float
|
Long-term mean level that the asset price reverts to |
required |
mean_reversion_rate
|
float
|
Speed at which the asset price reverts to the long-term mean (annualized) |
required |
volatility
|
float
|
Volatility of the asset price (annualized) |
required |
time_to_expiry
|
float
|
Time to option expiration in years |
required |
risk_free_rate
|
float
|
Risk-free interest rate (annualized) |
required |
strike_price
|
float
|
Strike price of the option |
required |
option_type
|
str
|
Type of option ('call' or 'put'), by default 'call' |
'call'
|
Returns:
Type | Description |
---|---|
dict
|
Option price and details |
Raises:
Type | Description |
---|---|
ValueError
|
If Current price, volatility, time to expiry, mean reversion rate, or strike price are not positive. If option type is not 'call' or 'put'. |
mean_inversion_pricing(current_price, long_term_mean, mean_reversion_rate, volatility, time_to_expiry, risk_free_rate, strike_price, option_type='call', simulations=10000, time_steps=252, seed=None)
Price options on mean-reverting assets using Monte Carlo simulation.
This function implements the Ornstein-Uhlenbeck process to model mean-reverting assets and prices options using Monte Carlo simulation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
current_price
|
float
|
Current price of the underlying asset |
required |
long_term_mean
|
float
|
Long-term mean level that the asset price reverts to |
required |
mean_reversion_rate
|
float
|
Speed at which the asset price reverts to the long-term mean (annualized) |
required |
volatility
|
float
|
Volatility of the asset price (annualized) |
required |
time_to_expiry
|
float
|
Time to option expiration in years |
required |
risk_free_rate
|
float
|
Risk-free interest rate (annualized) |
required |
strike_price
|
float
|
Strike price of the option |
required |
option_type
|
str
|
Type of option ('call' or 'put'), by default 'call' |
'call'
|
simulations
|
int
|
Number of Monte Carlo simulations, by default 10000 |
10000
|
time_steps
|
int
|
Number of time steps in each simulation, by default 252 |
252
|
seed
|
int
|
Random seed for reproducibility, by default None |
None
|
Returns:
Type | Description |
---|---|
dict
|
Option price and details |
Raises:
Type | Description |
---|---|
ValueError
|
If Current price, volatility, time to expiry, mean reversion rate, or simulations are not positive. If option type is not 'call' or 'put'. If time steps is not a positive integer. |