fractal.strategies package

Submodules

fractal.strategies.basis_trading_strategy module

class fractal.strategies.basis_trading_strategy.BasisTradingStrategy(*args, params: BasisTradingStrategyHyperparams | None = None, debug: bool = False, **kwargs)[source]

Bases: BaseStrategy

A basis trading strategy that implements the BaseStrategy interface. This strategy aims to maintain a target leverage ratio between a hedge entity and a spot entity.

predict(*args, **kwargs) List[ActionToTake][source]

Predict the actions to take based on the current state of the entities. Returns a list of ActionToTake objects representing the actions to be executed.

set_up(*args, **kwargs)[source]

Set up the strategy by registering the hedge and spot entities.

exception fractal.strategies.basis_trading_strategy.BasisTradingStrategyException[source]

Bases: Exception

class fractal.strategies.basis_trading_strategy.BasisTradingStrategyHyperparams(MIN_LEVERAGE: float, TARGET_LEVERAGE: float, MAX_LEVERAGE: float, INITIAL_BALANCE: float)[source]

Bases: BaseStrategyParams

Hyperparameters for the BasisTradingStrategy.

MIN_LEVERAGE: float - Minimum leverage ratio to maintain. TARGET_LEVERAGE: float - Target leverage ratio to maintain. MAX_LEVERAGE: float - Maximum leverage ratio to maintain. INITIAL_BALANCE: float - Initial balance to deposit into the strategy.

INITIAL_BALANCE: float
MAX_LEVERAGE: float
MIN_LEVERAGE: float
TARGET_LEVERAGE: float

fractal.strategies.gmxv2_uniswapv3_basis module

class fractal.strategies.gmxv2_uniswapv3_basis.GMXV2UniswapV3Basis(*args, params: BasisTradingStrategyHyperparams | None = None, debug: bool = False, **kwargs)[source]

Bases: BasisTradingStrategy

set_up()[source]

Set up the strategy by registering the hedge and spot entities.

Module contents

class fractal.strategies.BasisTradingStrategy(*args, params: BasisTradingStrategyHyperparams | None = None, debug: bool = False, **kwargs)[source]

Bases: BaseStrategy

A basis trading strategy that implements the BaseStrategy interface. This strategy aims to maintain a target leverage ratio between a hedge entity and a spot entity.

predict(*args, **kwargs) List[ActionToTake][source]

Predict the actions to take based on the current state of the entities. Returns a list of ActionToTake objects representing the actions to be executed.

set_up(*args, **kwargs)[source]

Set up the strategy by registering the hedge and spot entities.

class fractal.strategies.BasisTradingStrategyHyperparams(MIN_LEVERAGE: float, TARGET_LEVERAGE: float, MAX_LEVERAGE: float, INITIAL_BALANCE: float)[source]

Bases: BaseStrategyParams

Hyperparameters for the BasisTradingStrategy.

MIN_LEVERAGE: float - Minimum leverage ratio to maintain. TARGET_LEVERAGE: float - Target leverage ratio to maintain. MAX_LEVERAGE: float - Maximum leverage ratio to maintain. INITIAL_BALANCE: float - Initial balance to deposit into the strategy.

INITIAL_BALANCE: float
MAX_LEVERAGE: float
MIN_LEVERAGE: float
TARGET_LEVERAGE: float
class fractal.strategies.GMXV2UniswapV3Basis(*args, params: BasisTradingStrategyHyperparams | None = None, debug: bool = False, **kwargs)[source]

Bases: BasisTradingStrategy

set_up()[source]

Set up the strategy by registering the hedge and spot entities.