v2.0.0
ThetaGang v2.0.0
v2.0.0 is a major release that introduces the new config schema (v2), strategy/stage runtime refactors, a persistent state database, and major upgrades to regime-aware rebalancing.
Full Changelog: v1.16.3...v2.0.0
Breaking Changes
- Config schema v2 is now required (
meta.schema_version = 2). - Legacy v1 top-level sections are no longer valid in v2 configs (for example:
account,target,roll_when,symbols,infrastructure,overrides). runnow requires exactly one of:run.strategies(recommended)run.stages(advanced)
wheelandregime_rebalancecannot both be enabled inrun.strategies.
Highlights Since v1.16.3
Config and Runtime
- Added a new typed v2 config model and startup migration flow.
- Added CLI migration controls:
--migrate-configto migrate and exit--yesfor non-interactive migration approval
- Added stronger validation around strategy/stage plans and dependency ordering.
- Refactored orchestration into strategy engines and stage runners for clearer execution boundaries.
Regime-Aware Rebalancing
- Added flow/deficit rails and proxy weighting improvements.
- Added optional ratio-gate for soft rebalance decisions.
- Updated rebalance base handling to exclude options (and cash fund handling updates), improving sizing consistency.
- Switched cash rails to percentage thresholds and improved summary/telemetry output.
State, Persistence, and Observability
- Added SQLite/Alembic-backed state store and runtime telemetry tables.
- Added persistent order intent tracking and richer execution history.
- Added untracked position reporting/persistence.
Reliability and Operational Fixes
- Improved order completion timeout handling.
- Fixed watchdog execution to run inside the event loop task.
- Fixed exchange-hours out-of-bounds calendar checks.
- Improved market data contract qualification for IBKR.
- Reduced noisy third-party logging by default.
Config Migration Guide (v1 -> v2)
1) Run the built-in migration
thetagang --config thetagang.toml --migrate-configFor non-interactive environments (CI/containers):
thetagang --config thetagang.toml --migrate-config --yesThe migrator writes your updated v2 config in-place and creates a backup as:
thetagang.toml.old- or
thetagang.toml.old.Nif a backup already exists
2) Key section moves in v2
account,option_chains,exchange_hours,orders,database,ib_async,ibc,watchdog->runtime.*symbols->portfolio.symbolstarget,write_when,roll_when,constants->strategies.wheel.defaults.*regime_rebalance,vix_call_hedge,cash_management->strategies.*
3) Rebalance override migration details
Legacy per-symbol buy/sell-only knobs are migrated to:
strategies.wheel.equity_rebalance.symbol_overrides.<SYMBOL>
Legacy per-symbol call-write-only overrides are migrated to:
strategies.wheel.symbol_overrides.<SYMBOL>
4) Verify and dry-run
After migration, verify:
meta.schema_version = 2run.strategies(or advancedrun.stages) is present- your runtime/portfolio/strategy sections are nested under the new v2 hierarchy
Then run a dry-run before live trading:
uv run thetagang --config thetagang.toml --dry-runPull Requests by Category
Features
- Regime aware rebalancing, db (#629)
- feat(db): track order intents (#631)
- feat(regime): add flow/deficit rails and proxy weights (#636)
- feat(regime): add ratio gate for soft rebalances (#637)
- feat(portfolio): show and persist untracked positions (#638)
- feat(regime): base on net liq excluding options and cash fund (#642)
- feat(regime): exclude options from rebalance base (#643)
- feat(regime): switch cash rails to percentage thresholds (#644)
- feat(config): introduce v2 schema and startup migration (#647)
Bug Fixes
- fix(watchdog): run watchdog inside event loop task (#632)
- fix: silence third-party logging by default (#633)
- fix(exchange-hours): avoid out-of-bounds calendar checks (#635)
- fix(ibkr): qualify contracts for market data (#640)
- fix(execution): handle order completion timeouts gracefully (#645)
- fix(migration): enforce v2 strategy semantics (#648)