Skip to content
Merged

Dev #27

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ historical reproduction.
- Explicit margin, leverage, fees, slippage, funding, and liquidation handling.
- Stable audit artifacts: metrics, plots, raw reports, trade logs, config JSON,
run manifest, and optional QuantStats HTML.
- Nautilus certification bundles with parity CSVs, tolerance profiles, known
differences, and explicit skip/pass status for optional trustee workflows.
- Nautilus package-depth preflight with OHLCV volume caps and synthetic-book
stress tests for spread, queue, participation, partial-fill, and package
rejection assumptions.
- Walk-forward and train/test optimization designed to avoid leaking OOS data
into parameter selection, plus full-sample robust calibration for final
production parameter discovery.
Expand Down Expand Up @@ -88,6 +93,21 @@ Cython/C++ work. See `benchmarks/phase9_optimization_report.md`,
`benchmarks/portfolio_real_parity_report.md` for parity and optimization
history.

Latest Phase 14C service-loop optimization benchmark:

| Workload | Cold / full route | Prepared / minimal route | Speedup | Parity |
|---|---:|---:|---:|---|
| Single-symbol WFO | 1.007s | 0.883s | 1.14x | pass |
| Portfolio WFO | 0.440s | 0.326s | 1.35x | pass |
| Native-event order replay | 0.0096s | 0.0046s | 2.10x | pass |
| Arbitrage package replay | 0.0746s | 0.0663s | 1.13x | pass |
| Native portfolio reports | 0.0410s full | 0.0233s minimal | 1.76x | pass |

Phase 14C added run-local prepared market-array reuse for WFO/service loops and
`report_level="full" | "standard" | "minimal"` for native portfolio reports.
The default remains `full`; lighter report levels are opt-in for optimizers and
services, and parity tests lock core accounting equality before any speed claim.

Ecosystem positioning:

| Tool | Core strength | Runtime model | QuantBT role beside it |
Expand Down Expand Up @@ -212,6 +232,12 @@ Experimental Nautilus package validation is available for DCA/grid,
bracket/OCO, basket, and portfolio workflows by compiling strategy state into
explicit order packages.

Package-depth validation is opt-in. `depth_model="ohlcv_volume_cap"` is the
default Level-1 preflight, `depth_model="synthetic_book"` creates deterministic
Level-2 stress books from spread/depth assumptions, and future
`depth_model="l2_replay"` is intentionally gated until real venue snapshots,
incremental updates, and trade prints are provided.

Supported Binance perpetual validation instruments:

`BTCUSDT-PERP.BINANCE`, `ETHUSDT-PERP.BINANCE`, `BNBUSDT-PERP.BINANCE`,
Expand Down
10 changes: 10 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@
from .core.execution_depth import (
NautilusExecutionDepthConfig,
PackageDepthPreflightResult,
SUPPORTED_DEPTH_MODELS,
l2_replay_available,
simulate_nautilus_order_package_depth,
)
from .core.structured_orders import (
Expand Down Expand Up @@ -194,6 +196,7 @@
from .reporting import (
build_arbitrage_domain_audit,
build_native_nautilus_parity_report,
build_nautilus_certification_profile,
build_nautilus_depth_execution_report,
build_nautilus_depth_parity_summary,
build_nautilus_pct_equity_diagnostic,
Expand All @@ -202,7 +205,9 @@
build_portfolio_nautilus_validation_report,
compare_native_arbitrage_results,
export_nautilus_report_bundle,
NautilusToleranceProfile,
summarize_native_nautilus_parity_report,
write_nautilus_certification_artifacts,
)

__version__ = "0.1.0"
Expand Down Expand Up @@ -237,6 +242,7 @@
"NATIVE_PORTFOLIO_SUPPORTED_SIZING_MODES",
"build_arbitrage_domain_audit",
"build_native_nautilus_parity_report",
"build_nautilus_certification_profile",
"build_nautilus_depth_execution_report",
"build_nautilus_depth_parity_summary",
"build_nautilus_pct_equity_diagnostic",
Expand All @@ -245,7 +251,9 @@
"build_portfolio_nautilus_validation_report",
"compare_native_arbitrage_results",
"export_nautilus_report_bundle",
"NautilusToleranceProfile",
"summarize_native_nautilus_parity_report",
"write_nautilus_certification_artifacts",
"WalkForwardConfig",
"WalkForwardEngine",
"WalkForwardFold",
Expand Down Expand Up @@ -343,6 +351,8 @@
"portfolio_capability_matrix",
"quantize_signed_quantity",
"round_down_to_step",
"SUPPORTED_DEPTH_MODELS",
"l2_replay_available",
"simulate_nautilus_order_package_depth",
"validate_portfolio_result_contract",
# metrics
Expand Down
41 changes: 41 additions & 0 deletions benchmarks/phase15a_nautilus_certification.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"diff_workflows": 0,
"failed_workflows": 0,
"include_nautilus": false,
"output_dir": "/root/bobby/pool_alpha/quantbt/benchmarks/phase15a_nautilus_bundles",
"passed_workflows": 0,
"skipped_workflows": 5,
"status": "pass",
"workflows": [
{
"bundle_dir": null,
"reason": "run with --include-nautilus",
"status": "skipped",
"workflow": "pct_equity_signal"
},
{
"bundle_dir": null,
"reason": "run with --include-nautilus",
"status": "skipped",
"workflow": "explicit_orders"
},
{
"bundle_dir": null,
"reason": "run with --include-nautilus",
"status": "skipped",
"workflow": "basket_package"
},
{
"bundle_dir": null,
"reason": "run with --include-nautilus",
"status": "skipped",
"workflow": "portfolio_package"
},
{
"bundle_dir": null,
"reason": "run with --include-nautilus",
"status": "skipped",
"workflow": "basis_arbitrage_package"
}
]
}
35 changes: 35 additions & 0 deletions benchmarks/phase15a_nautilus_certification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Phase 15A Nautilus Certification Bundles

Status: **pass**

- Include Nautilus: `False`
- Output directory: `/root/bobby/pool_alpha/quantbt/benchmarks/phase15a_nautilus_bundles`
- Passed workflows: `0`
- Skipped workflows: `5`
- Failed workflows: `0`

## Workflow Matrix

| workflow | status | bundle | tolerance status | reason |
| --- | --- | --- | --- | --- |
| `pct_equity_signal` | `skipped` | `` | `` | run with --include-nautilus |
| `explicit_orders` | `skipped` | `` | `` | run with --include-nautilus |
| `basket_package` | `skipped` | `` | `` | run with --include-nautilus |
| `portfolio_package` | `skipped` | `` | `` | run with --include-nautilus |
| `basis_arbitrage_package` | `skipped` | `` | `` | run with --include-nautilus |

## Required Bundle Files

- `config.json`
- `run_manifest.json`
- `metrics_summary.json`
- `equity_curve.csv`, `returns.csv`, `account_report.csv`
- `orders_report.csv`, `fills_report.csv`, `positions_report.csv`
- `trade_log.csv`, `fill_log.txt`
- `native_vs_nautilus_parity.csv`
- `tolerance_profile.json`
- `known_differences.md`

## Interpretation

A skipped workflow is not a pass claim. It means the optional Nautilus dependency or instrument route was not available in this environment. A pass means the workflow produced a bundle and satisfied the declared tolerance profile.
38 changes: 38 additions & 0 deletions benchmarks/phase15b_synthetic_depth.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"phase": "15B",
"status": "pass",
"l2_replay_available": false,
"cases": [
{
"case": "synthetic_market_vwap",
"depth_model": "synthetic_book",
"status": "filled",
"filled_qty": 2.0,
"fill_price": 100.1,
"levels_consumed": 2,
"accepted_orders": 1,
"rejected_orders": 0
},
{
"case": "synthetic_partial_queue",
"depth_model": "synthetic_book",
"status": "partial",
"filled_qty": 1.5,
"fill_price": 100.02333333333333,
"levels_consumed": 2,
"accepted_orders": 1,
"rejected_orders": 0
},
{
"case": "ohlcv_all_or_none_baseline",
"depth_model": "ohlcv_volume_cap",
"status": "filled",
"filled_qty": 1.0,
"fill_price": 100.0,
"levels_consumed": 1,
"accepted_orders": 1,
"rejected_orders": 0
}
],
"claim_scope": "Level-2 synthetic stress only; not venue L2 replay."
}
16 changes: 16 additions & 0 deletions benchmarks/phase15b_synthetic_depth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Phase 15B Synthetic Depth Evidence

Status: **pass**

- L2 replay provider available: `False`
- Claim scope: Level-2 synthetic stress only; not venue L2 replay.

| case | depth model | status | filled qty | fill price | levels | accepted | rejected |
| --- | --- | --- | ---: | ---: | ---: | ---: | ---: |
| `synthetic_market_vwap` | `synthetic_book` | `filled` | 2.00000000 | 100.10000000 | 2 | 1 | 0 |
| `synthetic_partial_queue` | `synthetic_book` | `partial` | 1.50000000 | 100.02333333 | 2 | 1 | 0 |
| `ohlcv_all_or_none_baseline` | `ohlcv_volume_cap` | `filled` | 1.00000000 | 100.00000000 | 1 | 1 | 0 |

## Interpretation

Synthetic depth proves deterministic queue, participation, spread and level-consumption behavior. It does not certify real exchange queue priority. Real L2 certification remains gated by venue snapshots, incremental updates and trade prints.
Loading
Loading