Skip to content

Strategy state

Decision and memory contracts shared by economic families and run modes.

almanak.strategy_api

Decision and memory contracts shared by economic families and run modes.

InvalidConfig

Bases: ValueError

Raise from validate_config to refuse the configuration with this message.

The run reports it as a final invalid_config refusal, never as a crash, and from any function in strategy.py that validate_config calls.

StrategyState

Bases: Memory

Subclass as State inside strategy.py; typed fields are persisted by the worker.

DecisionContext

Bases: Model

price

price(asset)

The declared series for one asset; a strategy declares at most one per asset.