AntiMomentumPool

class AntiMomentumPool[source]

Bases: MomentumPool

A class for anti-momentum strategies run as TFMM liquidity pools.

This class implements a mean-reversion-based strategy for asset allocation within a TFMM framework. It uses price data to generate mean-reversion signals, which are then translated into weight adjustments.

Parameters:

None

calculate_rule_outputs(params, run_fingerprint, prices, additional_oracle_input)[source]

Calculate the raw weight outputs based on mean-reversion signals.

Parameters:
Return type:

Array

Notes

The class implements a mean-reversion-based strategy for asset allocation within a TFMM framework. It uses price data to generate mean-reversion signals, which are then translated into weight adjustments. The class provides methods to calculate raw weight outputs based on these signals and refine them into final asset weights, taking into account various parameters and constraints defined in the pool setup.

__init__()[source]

Initialize a new AntiMomentumPool instance.

Parameters:

None

calculate_rule_outputs(params, run_fingerprint, prices, additional_oracle_input=None)[source]

Calculate the raw weight outputs based on antimomentum signals. This method computes the raw weight adjustments for the antimomentum strategy. It processes the input prices to calculate gradients, which are then used to determine weight updates.

Parameters:
  • params (Dict[str, Any]) – A dictionary of strategy parameters.

  • run_fingerprint (Dict[str, Any]) – A dictionary containing run-specific settings.

  • prices (jnp.ndarray) – An array of asset prices over time.

  • additional_oracle_input (Optional[jnp.ndarray], optional) – Additional input data, if any.

Returns:

Raw weight outputs representing the suggested weight adjustments.

Return type:

jnp.ndarray

Notes

The method performs the following steps: 1. Calculates the memory days based on the lambda parameter. 2. Computes the ‘k’ factor which scales the weight updates. 3. Extracts chunkwise price values from the input prices. 4. Calculates price gradients using the calc_gradients function. 5. Applies the antimomentum weight update (momentum with negative k) formula to get raw weight outputs.

The raw weight outputs are not the final weights, but rather the changes to be applied to the previous weights. These will be refined in subsequent steps.