merge: release work from feat/feed-spec-schedule-rebalancing - #8
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Merges multiple released features back to main, expanding the backtest engine’s reproducibility and reporting surfaces (fills/predictions/portfolio-state + spec snapshot), adding quote-aware execution/marking, and introducing schedule-based rebalancing support alongside updated docs/build tooling.
Changes:
- Add quote-aware execution/marking (new
ExecutionPricesources, quote caches inDataFeed, quote context onFill/Trade, andmark_price). - Expand result surfaces + persistence (
fills.parquet,predictions.parquet,portfolio_state.parquet,spec.yamlsnapshot; new DataFrame helpers). - Add schedule-based rebalancing (
RebalanceSchedule, timestamp resolution utilities; template strategy + executor support) and migrate docs to MkDocs + deploy workflow.
Reviewed changes
Copilot reviewed 57 out of 60 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| validation/benchmark_suite.py | Update benchmark wiring to new commission/slippage enum names. |
| tests/test_trade_cost_decomposition.py | Rename trade slippage field usage; parquet backward-compat assertions. |
| tests/test_strategy_templates.py | Add tests for explicit/weekly rebalance schedules. |
| tests/test_result.py | Add tests for new result surfaces (fills/predictions/portfolio state/spec snapshot). |
| tests/test_export.py | Expect additional exported artifacts + new summary metrics. |
| tests/test_equity_curve.py | Add tests for config-driven annualization override. |
| tests/test_diagnostic_integration.py | Remove optional dependency integration tests. |
| tests/test_datafeed_memory.py | Add FeedSpec/contract mapping + quote cache tests. |
| tests/test_core.py | Add activity/portfolio-state metrics + prediction/config feed_spec wiring tests. |
| tests/test_config_wiring.py | Add mark_price + feed_spec resolution/merge tests. |
| tests/test_broker.py | Extend config roundtrip to include feed + metadata; assert rebalance_id propagation. |
| tests/test_artifact_spec.py | New tests for artifact spec bridge + spec IO (currently introduces undeclared deps). |
| tests/test_analysis.py | Update trade record field name to exit_slippage. |
| tests/helpers/invariants.py | Update invariants to expect exit_slippage column. |
| tests/futures/test_trade_record.py | Update futures trade slippage field name. |
| tests/execution/test_schedule.py | New schedule resolution unit tests. |
| tests/execution/test_rebalancer.py | Add schedule gating + rebalance_id assertions. |
| tests/contracts/test_public_api_surface.py | Extend public API surface contract for schedule utilities. |
| tests/contracts/test_execution_contracts.py | Add quote-side execution contract test. |
| tests/benchmark/test_hotpath_benchmarks.py | Adjust benchmark comparison to ignore new quote keys in optimized feed output. |
| src/ml4t/backtest/types.py | Add rebalance_id + quote fields; rename trade slippage to exit_slippage. |
| src/ml4t/backtest/strategy.py | Add on_prepare() callback hook. |
| src/ml4t/backtest/strategies/templates.py | Add optional schedule-based rebalance gating to LongShort template. |
| src/ml4t/backtest/spec_bridge.py | Add MarketDataSpec → FeedSpec/runtime-metadata bridge helpers. |
| src/ml4t/backtest/result.py | Add predictions/fills/portfolio_state surfaces + spec snapshot + parquet persistence. |
| src/ml4t/backtest/export.py | Add new activity/turnover metrics to batch export summary. |
| src/ml4t/backtest/execution/schedule.py | New schedule model + timestamp resolution implementation. |
| src/ml4t/backtest/execution/rebalancer.py | Add schedule gating + rebalance_id propagation (contains a bad TYPE_CHECKING import). |
| src/ml4t/backtest/execution/fill_executor.py | Quote-aware sizing/price-source tracking + quote context on fills/trades. |
| src/ml4t/backtest/execution/init.py | Export schedule utilities from execution package. |
| src/ml4t/backtest/engine.py | Merge feed_spec into config; record portfolio_state; compute activity metrics. |
| src/ml4t/backtest/datafeed.py | Add FeedSpec contract mapping + quote caches + timestamps property. |
| src/ml4t/backtest/core/shared.py | Add rebalance_id to SubmitOrderOptions. |
| src/ml4t/backtest/core/portfolio_ledger.py | Mark-to-market uses broker mark-price semantics. |
| src/ml4t/backtest/core/order_book.py | Propagate rebalance_id; mark prices via broker mark-price. |
| src/ml4t/backtest/core/fill_engine.py | Delegate fill price selection to broker price-source resolver. |
| src/ml4t/backtest/core/execution_engine.py | Mark-to-market via broker helper; notional sorting uses fill price resolver. |
| src/ml4t/backtest/config.py | Add mark_price, feed+metadata serialization, and resolved_* precedence helpers. |
| src/ml4t/backtest/broker.py | Add quote caches, price-source resolution, mark-price handling, rebalance_id plumbing. |
| src/ml4t/backtest/analytics/equity.py | Add config-driven periods-per-year override. |
| src/ml4t/backtest/analytics/bridge.py | Update trade record mapping for exit_slippage. |
| src/ml4t/backtest/analytics/annualization.py | New annualization + session-alignment helpers. |
| src/ml4t/backtest/_validation_imports.py | Include schedule utilities in validation import surface. |
| src/ml4t/backtest/init.py | Export schedule utilities at package root. |
| pyproject.toml | Add ml4t-data dep; migrate docs deps to MkDocs; update project URLs; adjust uv sources. |
| mkdocs.yml | Update site/repo URLs. |
| docs/user-guide/results.md | Document new result surfaces, persistence, and quote context. |
| docs/user-guide/profiles.md | Note quote-aware overrides atop profiles. |
| docs/user-guide/execution-semantics.md | Document quote-aware execution/marking + fill quote context. |
| docs/user-guide/data-feed.md | Document FeedSpec mapping, price field, and quote columns. |
| docs/user-guide/configuration.md | Document mark_price, feed/metadata, and resolved snapshot workflow. |
| docs/index.md | Highlight quote-aware execution and richer persistence. |
| docs/getting-started/quickstart.md | Update examples to use bar['price']; add quote-aware section. |
| docs/api/index.md | Add to_predictions_dataframe to API docs. |
| README.md | Update examples/docs for quote-aware execution and richer result surfaces. |
| CHANGELOG.md | Add changelog entries for v0.1.0b9–b11. |
| .gitignore | Ignore MkDocs site/ output. |
| .github/workflows/docs.yml | Add docs build + deploy workflow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Merges the released quote-aware execution, reproducible config snapshot, and raw prediction result-surface work back to main.\n\nIncludes releases v0.1.0b9, v0.1.0b10, and v0.1.0b11.