quantammsim.pools.creator.create_pool
- create_pool(rule)[source]
Create a pool instance based on the specified rule type.
This function acts as a central registry for all available pool types in the system. New pool implementations must be:
Imported at the top of this file
Added to the if/elif chain below with a unique string identifier
to be accessible through the simulation runners.
- Parameters:
rule (str) –
The identifier string for the desired pool type. May optionally include hook prefixes using double-underscore syntax (see Notes).
Valid base pool types:
"balancer": Standard Balancer constant-weight pool."momentum": Momentum (trend-following) QuantAMM pool."anti_momentum": Anti-momentum (contrarian) QuantAMM pool."power_channel": Power-law channel QuantAMM pool."mean_reversion_channel": Mean-reversion channel QuantAMM pool."triple_threat_mean_reversion_channel": Combined mean-reversion channel + trend-following QuantAMM pool."difference_momentum": Difference-of-momentum QuantAMM pool."index_market_cap": Market-cap-weighted index pool."hodling_index_market_cap": HODLing variant of the market-cap index pool (on-chain reserve mechanics)."trad_hodling_index_market_cap": Traditional (off-chain) HODLing variant with realistic CEX trading costs."min_variance": Minimum-variance QuantAMM pool."hodl": Pure buy-and-hold (no rebalancing) pool."cow": CoW (Coincidence of Wants) AMM pool."gyroscope": Gyroscope E-CLP pool.
Available hook prefixes (prepended with
__separator):"lvr": Loss-versus-rebalancing accounting hook."rvr": Rebalancing-versus-rebalancing accounting hook."bounded": Bounded-weights guardrail hook."ensemble": Ensemble-averaging hook.
- Returns:
An instance of the specified pool class (or a hooked composite class) ready for use in simulations.
- Return type:
- Raises:
NotImplementedError – If the base pool type or any hook prefix is unrecognised.
Notes
Hook prefix system
Hooks are chained onto a base pool using double-underscore (
__) delimiters. The base pool type is always the last segment. For example:"ensemble__bounded__momentum"is parsed as hooks
[EnsembleAveragingHook, BoundedWeightsHook]applied toMomentumPool, withEnsembleAveragingHookhaving highest priority in the MRO.To add a new pool type:
Create the new pool class implementing the required interfaces.
Import the class at the top of this file.
Add a new
elifclause matching the desired identifier string.Return an instance of the new pool class.
Examples
>>> pool = create_pool("balancer") >>> pool = create_pool("momentum") >>> pool = create_pool("ensemble__bounded__momentum")