HODLPool
- class HODLPool[source]
Bases:
AbstractPoolHODLPool is a subclass of AbstractPool that represents a pool with no activity. This class provides methods to calculate reserves assuming no trading activity occurs.
- __init__():
Initializes the HODLPool instance.
- calculate_reserves_with_fees(params, run_fingerprint, prices, start_index,
- additional_oracle_input=None):
Calculates the reserves with fees, which in this case is the same as reserves without fees due to no activity.
- calculate_reserves_zero_fees(params, run_fingerprint, prices, start_index,
- additional_oracle_input=None):
Calculates the reserves without fees, assuming no trading activity.
- calculate_reserves_with_dynamic_inputs(params, run_fingerprint, prices, start_index,
- fees_array, arb_thresh_array, arb_fees_array, trade_array, additional_oracle_input=None):
Calculates the reserves with dynamic inputs, which in this case is the same as reserves without fees due to no activity.
- init_base_parameters(initial_values_dict, run_fingerprint, n_assets,
n_parameter_sets=1, noise=”gaussian”):
- Initializes the base parameters for the pool, including weights and other initial values.
- calculate_initial_weights(params):
Calculates the initial weights for the assets in the pool based on the initial weights logits.
- make_vmap_in_axes(params, n_repeats_of_recurred=0):
Creates a dictionary for vectorized mapping of input axes.
- is_trainable():
Indicates whether the pool is trainable. Always returns False for HODLPool.
- calculate_reserves_with_fees(params, run_fingerprint, prices, start_index, additional_oracle_input=None)[source]
- calculate_reserves_zero_fees(params, run_fingerprint, prices, start_index, additional_oracle_input=None)[source]
Public interface for zero-fee reserve calculation.
This method can be safely overridden by hooks (e.g., LVR) while still allowing access to the original implementation through the protected _calculate_reserves_zero_fees method.
- calculate_reserves_with_dynamic_inputs(params, run_fingerprint, prices, start_index, fees_array, arb_thresh_array, arb_fees_array, trade_array, lp_supply_array=None, additional_oracle_input=None)[source]
- init_base_parameters(initial_values_dict, run_fingerprint, n_assets, n_parameter_sets=1, noise='gaussian')[source]
- calculate_weights(params, run_fingerprint, prices, start_index, additional_oracle_input=None)[source]
Calculate empirical weights for HODL.
HODL does not have weights in the same way as other pools, such as G3M pools or FM-AMM pools. Therefore, the weights are calculated based on the reserves that the pool has when run in the zero-fees case, and the empirical weights are derived from the empirical division of value between reserve over time. This method: 1. Calculates zero-fee reserves 2. Computes value distribution using prices 3. Returns normalized weights
- Parameters:
params (Dict[str, Any]) – The parameters for the pool.
run_fingerprint (Dict[str, Any]) – The fingerprint of the current run.
prices (jnp.ndarray) – The prices of the assets.
start_index (jnp.ndarray) – The starting index for the prices.
additional_oracle_input (Optional[jnp.ndarray]) – Additional input from the oracle, if any.
- Returns:
The calculated weights for the ECLP pool.
- Return type:
jnp.ndarray
Notes
This method uses the protected _calculate_reserves_zero_fees implementation to ensure consistent weight calculation even when hooks override the public interface. It is only called in the ‘versus rebalancing’ hooks.