Add fixed-interval rebalance strategy with preset configurations#24
Open
taiiiiiiiiiiii wants to merge 3 commits into
Open
Add fixed-interval rebalance strategy with preset configurations#24taiiiiiiiiiiii wants to merge 3 commits into
taiiiiiiiiiiii wants to merge 3 commits into
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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.fixed_interval_rebalanceinstrategy_registry.py.FixedIntervalRebalancePublicParams): Validates interval days (1–365), optional drift threshold (0–100%), and target weights that sum to 1.0.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).fixed_interval_rebalanceto enable saved-config-based instantiation.[RESEARCH]prefix (auto-excluded from 500-day snapshot).COMMANDS.md): Added curl examples for comparing presets and drift-gated variants, plus single-preset diagnostics via existing scripts.Test Plan
pnpm turbo run test --filter=@zapengine/analytics-enginecovers strategy registry, composition catalog, and config store integrationRisk
Blast radius: Analytics-engine backtesting only. No production execution risk (research-only strategy, auto-excluded from 500-day snapshot).
[RESEARCH]in display name.Rollback
Remove or comment out:
FixedIntervalRebalanceStrategyclass and imports infixed_interval_rebalance.py_FIXED_INTERVAL_PRESET_DEFINITIONSand_build_fixed_interval_seed_config()instrategy_presets.pystrategy_registry.py_fixed_interval_benchmark_factory()incomposition_catalog.pyconstants.pytest_strategy_config_store.pyandtest_strategy_presets.pyChecklist
apps/analytics-engine/CLAUDE.mdhttps://claude.ai/code/session_01PxZjcsQbZsB1ZkPtstMMpy