dashboard.data.pool_metrics
np
pd
math
random
PoolMetrics Objects
class PoolMetrics()
__init__
def __init__(prices)
Initialize the PoolMetrics class with a series of prices.
Arguments:
prices
: pandas Series of price data
calc_mean_drift
def calc_mean_drift()
Calculate mean drift based on log returns and price changes.
Returns:
tuple (return_drift, price_drift, price_drift_pct)
calc_mean_volatility
def calc_mean_volatility()
Calculate mean volatility based on log returns and price changes.
Returns:
tuple (return_volatility, price_volatility, price_volatility_pct)
calc_all_mean_metrics
def calc_all_mean_metrics()
Calculate all mean metrics: mean drift and mean volatility.
Returns:
tuple (return_drift, price_drift, price_drift_pct, return_volatility, price_volatility, price_volatility_pct)
random_bm
@staticmethod
def random_bm(mu, sigma)
Generate a random number using Box-Muller transform.
Arguments:
mu
: Meansigma
: Standard deviation
Returns:
Random number
calc_imp_loss
@staticmethod
def calc_imp_loss(lower_limit, upper_limit, px, alpha)
Calculate impermanent loss.
Arguments:
lower_limit
: Lower price limitupper_limit
: Upper price limitpx
: Current pricealpha
: Alpha parameter
Returns:
Impermanent loss
calc_exp_imp_loss
def calc_exp_imp_loss(range_perc, mu, sigma, alpha)
Calculate expected impermanent loss.
Arguments:
range_perc
: Range percentagemu
: Meansigma
: Standard deviationalpha
: Alpha parameter
Returns:
Expected impermanent loss
calc_iv
def calc_iv(range_perc, mu, alpha)
Calculate implied volatility.
Arguments:
range_perc
: Range percentagemu
: Meanalpha
: Alpha parameter
Returns:
Implied volatility