Saltar al contenido principal

Strategy Browser

Doc map: alphaswarm_docs/index.md · Strategy lifecycle: alphaswarm_docs/strategy-lifecycle.md.

The Strategy Browser is a dedicated Solara page at /strategy-browser that exposes two complementary views of the strategy library:

  1. Saved strategies — everything a user has persisted via POST /strategies/ (the Strategy Development page). Filter by tag, status, name, or minimum Sharpe; click through for version history, recent tests, equity curves, and a deep link into the per-strategy MLflow experiment.
  2. Alpha catalog — the code-available IAlphaModel classes (both ported TA strategies and the native ML model wrappers), their tags, and a list of reference YAMLs in configs/strategies/ that instantiate each one. Handy for discovering what's available before saving your own.

API surface

  • GET /strategies/browse?tag=&status=&query=&min_sharpe= → list of enriched strategy rows with latest backtest metrics and the MLflow run id of the most recent run.
  • GET /strategies/browse/catalog → every registered IAlphaModel class, its module path, tag list, and reference YAMLs under configs/strategies/.
  • GET /strategies/{id}/experiment → experiment name (strategy/<id[:8]>), MLflow tracking URI, and up to 50 linked BacktestRun rows.

Strategy tags

Every new concrete alpha carries a module-level STRATEGY_TAGS tuple (e.g. ("pattern", "mean-reversion", "quant-trading")). alphaswarm.strategies .list_strategy_tags() aggregates the tuples across every class in alphaswarm.strategies.__all__, so the browser's tag filter reflects the code without any duplicated metadata.

MLflow wiring

When run_backtest_from_config is called with a strategy_id, the underlying log_backtest helper uses experiment_name_for_strategy(strategy_id) to pick the per-strategy experiment (strategy/<id[:8]>) and also sets the alphaswarm.strategy_id tag on the run. After the backtest completes, the resulting MLflow run id is written onto BacktestRun.mlflow_run_id so the browser can deep-link.

To prevent the generic Celery autolog signals from opening a parent MLflow run for every backtest task (which would swallow the nested log_backtest run), the alphaswarm.tasks.backtest_tasks.* / alphaswarm.tasks.paper_tasks.* / alphaswarm.tasks.ml_tasks.* / alphaswarm.tasks.factor_tasks.* task names are explicitly listed in alphaswarm.mlops.autolog._AUTOLOG_SKIP_TASKS.

Ported strategy catalog

Shipped alphas (at 0.4):

Alpha classTagsReference recipe
AwesomeOscillatorAlphamomentum, oscillator, quant-tradingconfigs/strategies/awesome_oscillator.yaml
HeikinAshiAlphapattern, reversal, quant-tradingconfigs/strategies/heikin_ashi.yaml
DualThrustAlphaintraday, breakout, quant-tradingconfigs/strategies/dual_thrust.yaml
ParabolicSARAlphatrend, quant-tradingconfigs/strategies/parabolic_sar.yaml
LondonBreakoutAlphabreakout, fx, quant-tradingconfigs/strategies/london_breakout.yaml
BollingerWAlphapattern, mean-reversion, quant-tradingconfigs/strategies/bollinger_w.yaml
ShootingStarAlphapattern, reversal, quant-tradingconfigs/strategies/shooting_star.yaml
RsiPatternAlphapattern, mean-reversion, quant-tradingconfigs/strategies/rsi_pattern.yaml
OilMoneyRegressionAlphastatistical, mean-reversion, quant-tradingconfigs/strategies/oil_money.yaml
SmaCrossmomentum, reference, backtesting.pyconfigs/strategies/sma_cross.yaml
Sma4Crossmomentum, reference, backtesting.pyconfigs/strategies/sma4_cross.yaml
TrailingATRAlphamomentum, trailing-stop, referenceconfigs/strategies/trailing_atr.yaml
BaseAlgoExamplereference, stock-analysis-engineconfigs/strategies/base_algo_example.yaml

ML Training page

A sibling Solara page at /ml — launch any alphaswarm.ml training run from a form (pick feature handler + model class + segments), stream progress through the existing /chat/stream/{task_id} WebSocket, and see the resulting ModelVersion rows.

Browser export flow