Skip to content

Add fixed-interval rebalance strategy with preset configurations#24

Open
taiiiiiiiiiiii wants to merge 3 commits into
mainfrom
claude/fixed-interval-rebalance-backtest-vZ43V
Open

Add fixed-interval rebalance strategy with preset configurations#24
taiiiiiiiiiiii wants to merge 3 commits into
mainfrom
claude/fixed-interval-rebalance-backtest-vZ43V

Conversation

@taiiiiiiiiiiii
Copy link
Copy Markdown
Contributor

Summary

Introduces a new calendar-driven rebalancing strategy (fixed_interval_rebalance) that rebalances to fixed target weights on a configurable interval, with optional drift-threshold gating. Includes three preset configurations (balanced 30d, conservative 30d, aggressive 90d) and full integration into the strategy registry and composition catalog.

Changes

  • New strategy implementation (fixed_interval_rebalance.py): Calendar-driven rebalancer supporting fixed target weights (BTC/ETH/SPY/Stable), configurable rebalance intervals, and optional minimum drift percentage gating before executing rebalances.
  • Strategy registry integration: Added recipe builder, parameter normalization, and strategy factory for fixed_interval_rebalance in strategy_registry.py.
  • Public parameters model (FixedIntervalRebalancePublicParams): Validates interval days (1–365), optional drift threshold (0–100%), and target weights that sum to 1.0.
  • Preset configurations (strategy_presets.py): Three seed configs—balanced (25/25/25/25, 30d), conservative (10/10/10/70, 30d), and aggressive (35/35/30/0, 90d).
  • Composition catalog support: Added benchmark strategy builder factory for fixed_interval_rebalance to enable saved-config-based instantiation.
  • Constants and display names: Registered strategy ID and display name with [RESEARCH] prefix (auto-excluded from 500-day snapshot).
  • Documentation (COMMANDS.md): Added curl examples for comparing presets and drift-gated variants, plus single-preset diagnostics via existing scripts.
  • Test updates: Updated config store and preset tests to include the three new seed configurations.

Test Plan

  • Existing tests updated to reflect new seed configs (3 new presets in list assertions)
  • pnpm turbo run test --filter=@zapengine/analytics-engine covers strategy registry, composition catalog, and config store integration
  • Parameter validation tested via Pydantic model (weights sum to 1.0, interval bounds, drift threshold bounds)

Risk

Blast radius: Analytics-engine backtesting only. No production execution risk (research-only strategy, auto-excluded from 500-day snapshot).

  • New strategy is experimental and clearly marked [RESEARCH] in display name.
  • Composition catalog and registry changes are additive; existing strategies unaffected.
  • Preset configs are read-only seed data; no database writes.

Rollback

Remove or comment out:

  1. FixedIntervalRebalanceStrategy class and imports in fixed_interval_rebalance.py
  2. _FIXED_INTERVAL_PRESET_DEFINITIONS and _build_fixed_interval_seed_config() in strategy_presets.py
  3. Recipe builder and factory in strategy_registry.py
  4. _fixed_interval_benchmark_factory() in composition_catalog.py
  5. Constant and display name in constants.py
  6. Revert test assertions in test_strategy_config_store.py and test_strategy_presets.py

Checklist

  • Followed conventions in apps/analytics-engine/CLAUDE.md
  • No env-var additions
  • Strategy snapshot tests pass (new strategy integrated into registry and composition catalog)
  • No cross-service contract changes

https://claude.ai/code/session_01PxZjcsQbZsB1ZkPtstMMpy

Adds a research-only `fixed_interval_rebalance` backtesting strategy that
rebalances a SPY/BTC/ETH/Stable portfolio to a target on a fixed calendar
interval, with optional drift-threshold gating. No DMA/FGI signals — meant
as a simple baseline to evaluate rule-based strategies against.

Reuses RuleBasedAllocationExecutor for atomic execution. The display name
carries the `[RESEARCH] ` prefix so sweep_production_window.py auto-excludes
it from the 500-day snapshot; `dma_fgi_portfolio_rules_default` remains the
sole production default.

Three seed presets:
- fixed_interval_balanced_30d (25/25/25/25, monthly)
- fixed_interval_conservative_30d (10/10/10/70, monthly)
- fixed_interval_aggressive_90d (35/35/30/0, quarterly)

COMMANDS.md gains curl/analyze_compare examples for comparing presets and
running drift-gated variants via the existing compare API.

https://claude.ai/code/session_01PxZjcsQbZsB1ZkPtstMMpy
@vercel
Copy link
Copy Markdown

vercel Bot commented May 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zap-engine-frontend Ready Ready Preview, Comment May 25, 2026 2:51pm
zap-engine-landing-page Ready Ready Preview, Comment May 25, 2026 2:51pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants