tracebook-sim 0.2.0__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/CHANGELOG.md +46 -0
  2. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/CONTRIBUTING.md +28 -2
  3. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/MANIFEST.in +4 -1
  4. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/PKG-INFO +183 -38
  5. tracebook_sim-0.3.0/PROJECT_PLAN.md +50 -0
  6. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/QUICKSTART.md +53 -0
  7. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/README.md +177 -35
  8. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/SECURITY.md +3 -1
  9. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/SUPPORT.md +5 -3
  10. tracebook_sim-0.3.0/docs/api-stability.md +42 -0
  11. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/docs/architecture.md +63 -2
  12. tracebook_sim-0.3.0/docs/ci.md +67 -0
  13. tracebook_sim-0.3.0/docs/coinbase-l3.md +156 -0
  14. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/docs/commands.md +95 -0
  15. tracebook_sim-0.3.0/docs/conformance.md +279 -0
  16. tracebook_sim-0.3.0/docs/corpora.md +228 -0
  17. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/docs/event-replay.md +13 -0
  18. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/docs/performance.md +24 -0
  19. tracebook_sim-0.3.0/docs/positioning.md +63 -0
  20. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/docs/release.md +18 -5
  21. tracebook_sim-0.3.0/docs/releases/0.3.0.md +88 -0
  22. tracebook_sim-0.3.0/examples/conformance_adapter.py +17 -0
  23. tracebook_sim-0.3.0/examples/data/coinbase_btcusd_full.jsonl +10 -0
  24. tracebook_sim-0.3.0/examples/data/coinbase_btcusd_l3_snapshot.json +12 -0
  25. tracebook_sim-0.3.0/examples/github-actions/conformance.yml +43 -0
  26. tracebook_sim-0.3.0/integrations/__init__.py +1 -0
  27. tracebook_sim-0.3.0/integrations/python_matching_engine/README.md +85 -0
  28. tracebook_sim-0.3.0/integrations/python_matching_engine/__init__.py +1 -0
  29. tracebook_sim-0.3.0/integrations/python_matching_engine/adapter.py +238 -0
  30. tracebook_sim-0.3.0/integrations/python_matching_engine/fifo-compatible.jsonl +13 -0
  31. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/setup.py +16 -2
  32. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/__init__.py +16 -0
  33. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/_version.py +1 -1
  34. tracebook_sim-0.3.0/src/tracebook/conformance/__init__.py +65 -0
  35. tracebook_sim-0.3.0/src/tracebook/conformance/cli.py +187 -0
  36. tracebook_sim-0.3.0/src/tracebook/conformance/compare.py +367 -0
  37. tracebook_sim-0.3.0/src/tracebook/conformance/external.py +302 -0
  38. tracebook_sim-0.3.0/src/tracebook/conformance/fixtures/__init__.py +1 -0
  39. tracebook_sim-0.3.0/src/tracebook/conformance/fixtures/v1/__init__.py +1 -0
  40. tracebook_sim-0.3.0/src/tracebook/conformance/fixtures/v1/deep-cancellation.jsonl +16 -0
  41. tracebook_sim-0.3.0/src/tracebook/conformance/fixtures/v1/fifo-lifecycle.jsonl +10 -0
  42. tracebook_sim-0.3.0/src/tracebook/conformance/fixtures/v1/manifest.json +16 -0
  43. tracebook_sim-0.3.0/src/tracebook/conformance/fixtures/v1/multi-symbol.jsonl +7 -0
  44. tracebook_sim-0.3.0/src/tracebook/conformance/fixtures/v1/order-instructions.jsonl +6 -0
  45. tracebook_sim-0.3.0/src/tracebook/conformance/fixtures/v1/pro-rata-allocation.jsonl +7 -0
  46. tracebook_sim-0.3.0/src/tracebook/conformance/fixtures/v1/stp-cancel-incoming.jsonl +5 -0
  47. tracebook_sim-0.3.0/src/tracebook/conformance/fixtures/v1/stp-cancel-resting.jsonl +5 -0
  48. tracebook_sim-0.3.0/src/tracebook/conformance/fixtures/v1/tick-grid.jsonl +4 -0
  49. tracebook_sim-0.3.0/src/tracebook/conformance/minimize.py +137 -0
  50. tracebook_sim-0.3.0/src/tracebook/conformance/model.py +527 -0
  51. tracebook_sim-0.3.0/src/tracebook/conformance/protocol.py +139 -0
  52. tracebook_sim-0.3.0/src/tracebook/conformance/reference.py +136 -0
  53. tracebook_sim-0.3.0/src/tracebook/conformance/suite.py +221 -0
  54. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/core/orderbook.py +69 -0
  55. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/core/replay.py +22 -4
  56. tracebook_sim-0.3.0/src/tracebook/corpus/__init__.py +29 -0
  57. tracebook_sim-0.3.0/src/tracebook/corpus/cli.py +195 -0
  58. tracebook_sim-0.3.0/src/tracebook/corpus/coinbase.py +1345 -0
  59. tracebook_sim-0.3.0/src/tracebook/corpus/fixtures/__init__.py +1 -0
  60. tracebook_sim-0.3.0/src/tracebook/corpus/fixtures/coinbase-btcusd-synthetic-v1/events.jsonl +8 -0
  61. tracebook_sim-0.3.0/src/tracebook/corpus/fixtures/coinbase-btcusd-synthetic-v1/feed.jsonl +10 -0
  62. tracebook_sim-0.3.0/src/tracebook/corpus/fixtures/coinbase-btcusd-synthetic-v1/golden.json +46 -0
  63. tracebook_sim-0.3.0/src/tracebook/corpus/fixtures/coinbase-btcusd-synthetic-v1/manifest.json +73 -0
  64. tracebook_sim-0.3.0/src/tracebook/corpus/fixtures/coinbase-btcusd-synthetic-v1/snapshot.json +20 -0
  65. tracebook_sim-0.3.0/src/tracebook/events/__init__.py +39 -0
  66. tracebook_sim-0.3.0/src/tracebook/events/coinbase_cli.py +192 -0
  67. tracebook_sim-0.3.0/src/tracebook/events/coinbase_l3.py +772 -0
  68. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/events/market_replay.py +24 -3
  69. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook_sim.egg-info/PKG-INFO +183 -38
  70. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook_sim.egg-info/SOURCES.txt +53 -1
  71. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook_sim.egg-info/entry_points.txt +3 -0
  72. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook_sim.egg-info/requires.txt +4 -0
  73. tracebook_sim-0.3.0/tests/fixtures/faulty_conformance_adapter.py +57 -0
  74. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_artifact_schemas.py +230 -2
  75. tracebook_sim-0.3.0/tests/test_coinbase_corpus.py +424 -0
  76. tracebook_sim-0.3.0/tests/test_coinbase_l3.py +410 -0
  77. tracebook_sim-0.3.0/tests/test_conformance.py +529 -0
  78. tracebook_sim-0.3.0/tests/test_external_integrations.py +66 -0
  79. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_market_event_replay.py +11 -1
  80. tracebook_sim-0.3.0/tests/test_order_reduction.py +98 -0
  81. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_release_metadata.py +7 -1
  82. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_replay.py +1 -1
  83. tracebook_sim-0.2.0/PROJECT_PLAN.md +0 -41
  84. tracebook_sim-0.2.0/docs/api-stability.md +0 -23
  85. tracebook_sim-0.2.0/src/tracebook/events/__init__.py +0 -21
  86. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/CODE_OF_CONDUCT.md +0 -0
  87. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/LICENSE +0 -0
  88. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/docs/logo.png +0 -0
  89. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/examples/advanced_profiling_check.py +0 -0
  90. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/examples/data/sample_events.jsonl +0 -0
  91. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/examples/full_simulation_demo.py +0 -0
  92. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/examples/magic_trace_integration_demo.py +0 -0
  93. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/pyproject.toml +0 -0
  94. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/setup.cfg +0 -0
  95. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/benchmarks/__init__.py +0 -0
  96. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/benchmarks/runner.py +0 -0
  97. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/core/__init__.py +0 -0
  98. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/core/matching_engine.py +0 -0
  99. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/core/order.py +0 -0
  100. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/core/price_level.py +0 -0
  101. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/events/cli.py +0 -0
  102. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/profiling/__init__.py +0 -0
  103. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/profiling/magic_trace_wrapper.py +0 -0
  104. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/profiling/performance_monitor.py +0 -0
  105. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/profiling/trace_analyzer.py +0 -0
  106. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/profiling/trace_visualizer.py +0 -0
  107. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/py.typed +0 -0
  108. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/simulation/__init__.py +0 -0
  109. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/simulation/order_generator.py +0 -0
  110. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/simulation/simulation_engine.py +0 -0
  111. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/utils/__init__.py +0 -0
  112. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/visualization/__init__.py +0 -0
  113. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/visualization/dashboard.py +0 -0
  114. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/visualization/web/__init__.py +0 -0
  115. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/visualization/web/app.js +0 -0
  116. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/visualization/web/index.html +0 -0
  117. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/visualization/web/styles.css +0 -0
  118. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook/visualization/web_server.py +0 -0
  119. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook_sim.egg-info/dependency_links.txt +0 -0
  120. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook_sim.egg-info/not-zip-safe +0 -0
  121. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/src/tracebook_sim.egg-info/top_level.txt +0 -0
  122. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/__init__.py +0 -0
  123. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/benchmarks/__init__.py +0 -0
  124. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/benchmarks/microbench.py +0 -0
  125. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/conftest.py +0 -0
  126. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_audit_hardening.py +0 -0
  127. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_benchmark_runner_json_output.py +0 -0
  128. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_benchmark_scenarios.py +0 -0
  129. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_concurrency_contracts.py +0 -0
  130. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_dashboard_demo_construction.py +0 -0
  131. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_invariants.py +0 -0
  132. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_lifecycle_hardening.py +0 -0
  133. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_metrics_honesty.py +0 -0
  134. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_orderbook_edge_contracts.py +0 -0
  135. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_orderbook_semantics.py +0 -0
  136. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_public_api.py +0 -0
  137. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_self_trade_prevention.py +0 -0
  138. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_simulation_benchmarks.py +0 -0
  139. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_simulation_event_metrics.py +0 -0
  140. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_tick_grid.py +0 -0
  141. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_v020_integrity.py +0 -0
  142. {tracebook_sim-0.2.0 → tracebook_sim-0.3.0}/tests/test_web_frontend.py +0 -0
@@ -6,6 +6,52 @@ The project follows [Keep a Changelog](https://keepachangelog.com/) conventions.
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## 0.3.0 - 2026-07-13
10
+
11
+ - Added the first maintained third-party engine integration: a commit-pinned
12
+ PythonMatchingEngine adapter, a 13-event native FIFO/LIMIT compatibility
13
+ trace, and a scheduled workflow that locks both the passing trace and the
14
+ honest `2/8` standard-suite contract profile.
15
+ - Added a real-engine README demo, a concise conformance architecture diagram,
16
+ a copy-paste GitHub Actions gate, and dedicated 0.3.0 release notes explaining
17
+ the move from Python simulator to matching-engine correctness lab.
18
+ - Repositioned Tracebook as a matching-engine conformance and reproducible
19
+ failure-analysis toolkit. Added a typed pluggable `EngineAdapter` API and an
20
+ incremental, language-neutral NDJSON protocol for testing external Rust,
21
+ C++, Java, Python, or other engines against the Tracebook reference path.
22
+ - Added `tracebook-conformance run` and `suite` with per-event applied/rejected
23
+ outcomes, stable rejection codes, source-ID trades, canonical queue-state
24
+ hashes, on-demand full snapshots, exact first-divergence paths, versioned JSON
25
+ artifacts, subprocess timeouts, and final-snapshot verification.
26
+ - Added deterministic delta-debugging through `tracebook-conformance minimize`,
27
+ which truncates after the first failure, emits a smaller JSONL reproducer,
28
+ and distinguishes a proven one-minimal result from run-budget exhaustion.
29
+ - Added a hash-locked, redistributable eight-case conformance suite covering
30
+ FIFO lifecycle and queue priority, IOC/FOK/market instructions, both
31
+ self-trade policies, pro-rata allocation, multiple symbols, tick-grid edge
32
+ cases, and deep-book cancellation pressure. Added property-based first-fault
33
+ tests and wheel-installed suite smoke coverage.
34
+ - Added `OrderBook.get_resting_orders()` for a detached, matching-priority view
35
+ of every resting order, including same-price queue order.
36
+ - Added `tracebook-corpus` for synchronized local Coinbase capture, offline
37
+ corpus preparation, pre-write field allowlisting and order-ID
38
+ pseudonymization, hash-locked manifests, exact golden replay verification,
39
+ machine-attributed import benchmarks, and environment-aware report
40
+ comparison. Live capture is an optional dependency and records that Coinbase
41
+ market-data redistribution rights are not granted by sanitization.
42
+ - Added a distributable synthetic BTC-USD corpus with canonical snapshot,
43
+ feed, normalized events, golden final state, and a stable corpus ID. System
44
+ smoke and wheel CI now reproduce it exactly.
45
+ - Added the dependency-free `tracebook-coinbase` offline adapter for Coinbase
46
+ Exchange REST L3 snapshots plus recorded `full` or compact `level3` feeds. It
47
+ validates dynamic compact schemas and per-product sequences, streams
48
+ normalized events, preserves observed exchange trades separately, ignores
49
+ future protocol message types without skipping sequence validation, and
50
+ rejects auction/crossed books rather than manufacturing queue state.
51
+ - Added priority-preserving `reduce_order()` and normalized `reduce` events for
52
+ partial maker fills and same-price size decreases. Core event logs and replay
53
+ summaries move to schema version 2; version 1 event logs remain readable.
54
+
9
55
  ## 0.2.0 - 2026-07-10
10
56
 
11
57
  Trust, installability, and real-data workflow release.
@@ -15,13 +15,17 @@ pip install -e ".[dev,dashboard]"
15
15
  Run these before opening a pull request:
16
16
 
17
17
  ```bash
18
- python -m black --check src tests examples install_deps.py test_system.py
19
- python -m flake8 src tests examples install_deps.py test_system.py
18
+ python -m black --check src tests examples integrations install_deps.py test_system.py
19
+ python -m flake8 src tests examples integrations install_deps.py test_system.py
20
+ python -m bandit -q -r src integrations
20
21
  python -m pytest --cov=tracebook --cov-report=term-missing --cov-fail-under=75
21
22
  python test_system.py
22
23
  tracebook-benchmark --scenario smoke --duration 1 --throughput 50 --seed 1337 --warmup-seconds 0.01 --output benchmark_results/local-smoke.json
23
24
  tracebook-dashboard --demo-simulation --help
24
25
  tracebook-replay examples/data/sample_events.jsonl --output /tmp/tracebook-replay.json
26
+ tracebook-coinbase examples/data/coinbase_btcusd_l3_snapshot.json examples/data/coinbase_btcusd_full.jsonl --tick-size 0.01 --output /tmp/tracebook-coinbase.json
27
+ tracebook-corpus verify src/tracebook/corpus/fixtures/coinbase-btcusd-synthetic-v1
28
+ tracebook-conformance suite src/tracebook/conformance/fixtures/v1 --candidate python examples/conformance_adapter.py
25
29
  ```
26
30
 
27
31
  For packaging changes, also run:
@@ -34,9 +38,29 @@ python -m twine check dist/*
34
38
  Normalized feed adapters should emit `tracebook.MarketEvent` values and keep
35
39
  venue-specific parsing, sequence checks, and assumptions outside the core replay
36
40
  engine. Include a small fixture and strict rejection tests with each adapter.
41
+ Fixtures must be synthetic or explicitly redistributable, and adapter semantics
42
+ must cite the venue's primary documentation.
43
+
44
+ Do not commit a live market-data corpus unless the repository has explicit
45
+ redistribution permission. Pseudonymized captures are still market data. Corpus
46
+ format changes must update schema tests, regenerate the synthetic fixture, and
47
+ document an intentional corpus-ID change.
37
48
 
38
49
  The command reference in `docs/commands.md` is the source of truth for reviewer-facing smoke paths.
39
50
 
51
+ Candidate adapters must keep stdout reserved for protocol NDJSON, report source
52
+ order IDs rather than private engine IDs, preserve queue order in snapshots, and
53
+ include timeout/error tests. Protocol changes require an artifact schema test,
54
+ cross-process coverage, a changelog entry, and an explicit versioning decision.
55
+ New standard-suite cases must be synthetic, document the semantic edge they
56
+ cover, and update the manifest hash intentionally.
57
+
58
+ Maintained third-party integrations belong under `integrations/`. Pin the exact
59
+ upstream revision, link its license and primary repository, keep its dependencies
60
+ optional, include one native compatibility trace, and run the real upstream code
61
+ in a dedicated workflow. Document unsupported semantics as divergences; do not
62
+ retrofit them in the adapter merely to produce a green suite.
63
+
40
64
  ## Pull Requests
41
65
 
42
66
  - Keep changes scoped to one clear theme.
@@ -44,6 +68,8 @@ The command reference in `docs/commands.md` is the source of truth for reviewer-
44
68
  - Keep performance claims tied to a reproducible benchmark command and machine context.
45
69
  - Prefer public APIs under `tracebook.*`; do not reintroduce old `src/core` style imports.
46
70
  - If a change affects matching semantics, include a small example in the PR description.
71
+ - If a change fixes a conformance failure, include the minimized trace or add it
72
+ as a regression case.
47
73
 
48
74
  ## Commit Identity
49
75
 
@@ -9,7 +9,10 @@ include SECURITY.md
9
9
  include SUPPORT.md
10
10
 
11
11
  recursive-include docs *.md *.png
12
- recursive-include examples *.py *.jsonl
12
+ recursive-include examples *.py *.json *.jsonl *.yml
13
+ recursive-include integrations *.py *.md *.jsonl
13
14
  recursive-include tests *.py
14
15
  recursive-include src/tracebook/visualization/web *.html *.css *.js
16
+ recursive-include src/tracebook/corpus/fixtures *.json *.jsonl
17
+ recursive-include src/tracebook/conformance/fixtures *.json *.jsonl
15
18
  include src/tracebook/py.typed
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tracebook-sim
3
- Version: 0.2.0
4
- Summary: Latency-focused order book simulation with reproducible benchmarks and trace-level profiling hooks
3
+ Version: 0.3.0
4
+ Summary: Matching-engine conformance testing, reproducible failure reduction, and honest local benchmarks
5
5
  Home-page: https://github.com/Taz33m/tracebook
6
6
  Author: Taz33m
7
7
  Author-email: tazeemmahashin@gmail.com
@@ -13,7 +13,7 @@ Project-URL: Documentation, https://github.com/Taz33m/tracebook/tree/main/docs
13
13
  Project-URL: Issues, https://github.com/Taz33m/tracebook/issues
14
14
  Project-URL: Security, https://github.com/Taz33m/tracebook/blob/main/SECURITY.md
15
15
  Project-URL: Source, https://github.com/Taz33m/tracebook
16
- Keywords: order-book,matching-engine,market-microstructure,benchmarking,profiling,simulation
16
+ Keywords: order-book,matching-engine,conformance-testing,differential-testing,delta-debugging,market-microstructure,benchmarking,profiling,simulation
17
17
  Classifier: Development Status :: 3 - Alpha
18
18
  Classifier: Intended Audience :: Developers
19
19
  Classifier: Intended Audience :: Financial and Insurance Industry
@@ -40,6 +40,8 @@ Requires-Dist: plotly>=6.8.0; extra == "analysis"
40
40
  Requires-Dist: pyarrow>=24.0.0; extra == "analysis"
41
41
  Requires-Dist: seaborn>=0.13.2; extra == "analysis"
42
42
  Requires-Dist: tables>=3.10.1; extra == "analysis"
43
+ Provides-Extra: capture
44
+ Requires-Dist: websockets>=16.1; extra == "capture"
43
45
  Provides-Extra: dashboard
44
46
  Requires-Dist: dash>=4.3.0; extra == "dashboard"
45
47
  Requires-Dist: plotly>=6.8.0; extra == "dashboard"
@@ -76,6 +78,7 @@ Requires-Dist: pytest>=9.1.1; extra == "all"
76
78
  Requires-Dist: seaborn>=0.13.2; extra == "all"
77
79
  Requires-Dist: tables>=3.10.1; extra == "all"
78
80
  Requires-Dist: twine>=6.1.0; extra == "all"
81
+ Requires-Dist: websockets>=16.1; extra == "all"
79
82
  Dynamic: author
80
83
  Dynamic: author-email
81
84
  Dynamic: classifier
@@ -98,7 +101,7 @@ Dynamic: summary
98
101
  <h1 align="center">tracebook</h1>
99
102
 
100
103
  <p align="center">
101
- <strong>Inspectable order-book semantics, normalized event replay, paced benchmarks, and trace-level profiling.</strong>
104
+ <strong>Conformance testing and reproducible failure analysis for matching engines.</strong>
102
105
  </p>
103
106
 
104
107
  <p align="center">
@@ -106,11 +109,57 @@ Dynamic: summary
106
109
  <a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-green"/></a>
107
110
  <img alt="Python" src="https://img.shields.io/badge/python-3.10--3.13-blue"/>
108
111
  <img alt="matching" src="https://img.shields.io/badge/matching-FIFO%20%2B%20pro--rata-7fc7a6"/>
109
- <img alt="tests" src="https://img.shields.io/badge/tests-203%20passing-brightgreen"/>
112
+ <img alt="tests" src="https://img.shields.io/badge/tests-260%20passing-brightgreen"/>
110
113
  <img alt="claims" src="https://img.shields.io/badge/claims-bounded-important"/>
111
114
  </p>
112
115
 
113
- > **TL;DR:** `tracebook` is an alpha Python market microstructure workbench for testing matching semantics, replaying normalized historical order events, generating synthetic flow, and measuring local latency with explicit boundaries. It is built for systems engineers and quant-minded developers who want inspectable behavior before making performance claims.
116
+ > **TL;DR:** Give Tracebook a normalized event trace and an adapter for your Rust, C++, Java, Python, or other matching engine. It runs the trace against an inspectable reference engine, identifies the first difference in outcomes, trades, resting orders, or queue priority, and reduces failures to a small reproducible trace. It also retains deterministic replay, verified L3 data workflows, and explicitly bounded local benchmarks.
117
+
118
+ ## Real-Engine Demo
119
+
120
+ The repository includes a pinned integration with the MIT-licensed
121
+ [PythonMatchingEngine](https://github.com/Surbeivol/PythonMatchingEngine). This
122
+ is a real second implementation, not a renamed Tracebook adapter.
123
+
124
+ ```bash
125
+ git clone https://github.com/Surbeivol/PythonMatchingEngine.git /tmp/PythonMatchingEngine
126
+ git -C /tmp/PythonMatchingEngine checkout f94150294a85d7b415ca4518590b5a661d6f9958
127
+ python -m pip install -e . "pandas>=2.3.3" "PyYAML>=6.0.2"
128
+
129
+ export PYTHON_MATCHING_ENGINE_PATH=/tmp/PythonMatchingEngine
130
+ tracebook-conformance run \
131
+ integrations/python_matching_engine/fifo-compatible.jsonl \
132
+ --output /tmp/python-matching-engine-report.json \
133
+ --timeout 20 \
134
+ --candidate python integrations/python_matching_engine/adapter.py
135
+ ```
136
+
137
+ Relevant report fields:
138
+
139
+ ```json
140
+ {
141
+ "candidate_engine": {
142
+ "language": "Python",
143
+ "name": "PythonMatchingEngine FIFO/LIMIT",
144
+ "version": "f94150294a85"
145
+ },
146
+ "compared_events": 13,
147
+ "conformant": true,
148
+ "divergence": null
149
+ }
150
+ ```
151
+
152
+ Those 13 events cover FIFO fills, decimal partial fills, reduction, cancellation,
153
+ replacement priority, rejection, clear, and multiple symbols. Against the full
154
+ eight-case suite, the same unmodified engine agrees on two native FIFO cases and
155
+ reports six expected contract differences for instructions, STP, pro-rata,
156
+ market orders, and tick policy. Tracebook records those differences instead of
157
+ calling a narrower feature set a failure or silently emulating it.
158
+
159
+ See the [integration guide](integrations/python_matching_engine/README.md) and
160
+ the [copy-paste CI workflow](docs/ci.md). The
161
+ [0.3.0 release notes](docs/releases/0.3.0.md) explain why this changes the
162
+ project category.
114
163
 
115
164
  ## Video Walkthrough
116
165
 
@@ -124,28 +173,34 @@ Watch **Trace The Match** on YouTube: https://youtu.be/RXOcB2k7qTQ
124
173
 
125
174
  ## Best Way To Review
126
175
 
127
- 1. Run the unit tests and system smoke.
128
- 2. Execute a deterministic simulation with cancel and replace events.
129
- 3. Generate a benchmark JSON report with warmup excluded.
130
- 4. Launch the dashboard demo if you want live depth and performance telemetry.
131
- 5. Read the claims, non-claims, and limitations before treating any number as a production latency claim.
176
+ 1. Run the bundled conformance suite through the example external adapter.
177
+ 2. Inspect a first-divergence artifact and a minimized failing trace.
178
+ 3. Run the unit tests and system smoke.
179
+ 4. Verify the checked Coinbase corpus and its deterministic golden state.
180
+ 5. Generate a benchmark JSON report with warmup excluded.
181
+ 6. Read the claims and limitations before treating any number as production latency.
132
182
 
133
183
  ```bash
134
184
  python -m pip install -e ".[dev,dashboard]"
135
185
  python -m pytest
136
186
  python test_system.py
187
+ tracebook-conformance sample /tmp/tracebook-conformance-v1
188
+ tracebook-conformance suite /tmp/tracebook-conformance-v1 --candidate python examples/conformance_adapter.py
137
189
  tracebook-replay examples/data/sample_events.jsonl --output /tmp/tracebook-replay.json
190
+ tracebook-coinbase examples/data/coinbase_btcusd_l3_snapshot.json examples/data/coinbase_btcusd_full.jsonl --tick-size 0.01 --output /tmp/tracebook-coinbase.json
191
+ tracebook-corpus sample /tmp/tracebook-sample-corpus
192
+ tracebook-corpus verify /tmp/tracebook-sample-corpus
138
193
  tracebook-sim --duration 1 --throughput 50 --algorithm FIFO --seed 1337 --cancel-ratio 0.05 --replace-ratio 0.02 --warmup-seconds 0.01
139
194
  tracebook-benchmark --scenario smoke --seed 1337 --warmup-seconds 0.01 --output benchmark_results/smoke.json
140
195
  ```
141
196
 
142
197
  ## Why This Matters
143
198
 
144
- Order book projects are easy to overstate. A simulator can advertise high throughput while silently mixing order generation time into matching latency, ignoring cancellations, using only integer quantities, or skipping basic exchange-style order semantics.
199
+ Matching-engine bugs often hide behind a long event prefix: a reduction that should retain priority, a replacement that should lose it, a partial fill followed by self-trade prevention, or a cancellation addressed through an old internal ID. A final depth snapshot can look plausible while the wrong order sits at the front of a queue.
145
200
 
146
- `tracebook` takes the opposite path. It keeps the matching behavior explicit, separates generation and matching metrics, supports lifecycle events, validates incoming orders, and publishes benchmark output as reproducible local artifacts rather than universal performance claims.
201
+ `tracebook` makes those semantics executable. It compares a candidate after every event, uses source IDs across implementations, hashes the complete queue state, requests a full snapshot only when needed, and preserves the exact disagreement as a versioned artifact. Its minimizer removes irrelevant prefixes and events, then states whether the result is one-minimal or stopped at its run budget.
147
202
 
148
- The goal is a credible open-source alpha: small enough to audit, complete enough to demonstrate real mechanics, and honest enough that future optimization work has a stable baseline.
203
+ The reference engine is intentionally small and readable. It is an oracle and learning surface, not a production exchange. See [`docs/positioning.md`](docs/positioning.md) for the product boundary.
149
204
 
150
205
  ## Current Local Benchmark Snapshot
151
206
 
@@ -176,8 +231,8 @@ All checks below were run during the latest production repo pass in this checkou
176
231
 
177
232
  | Proof surface | Verified result |
178
233
  | --- | --- |
179
- | Unit tests | `203` pytest tests passing with a `75%` coverage gate |
180
- | System smoke | `python test_system.py` passes all 4 checks |
234
+ | Unit tests | `260` pytest tests passing with `79.40%` statement coverage and a `75%` gate |
235
+ | System smoke | `python test_system.py` passes all 6 checks |
181
236
  | Format and lint | Black and Flake8 cover package, tests, examples, and smoke tooling with `0` issues |
182
237
  | Type check | `python -m mypy src/tracebook` reports `0` issues |
183
238
  | Compile and dependency checks | `python -m compileall -q src tests examples install_deps.py` and `python -m pip check` pass |
@@ -191,13 +246,19 @@ All checks below were run during the latest production repo pass in this checkou
191
246
 
192
247
  | Component | What it does | Why it matters |
193
248
  | --- | --- | --- |
249
+ | External-engine conformance | Drives any stdio NDJSON adapter event by event against the reference engine | Tests Rust, C++, Java, Python, or other engines without embedding them in Tracebook |
250
+ | Semantic diffing | Compares outcomes, rejection codes, ordered trades, resting orders, and queue priority | Reports the exact first event and state path where behavior diverges |
251
+ | Failing-trace minimization | Uses deterministic delta debugging to remove irrelevant events and reports whether the result is one-minimal or budget-limited | Turns long failures into reviewable regression fixtures without overstating reduction completeness |
252
+ | Standard conformance suite | Ships eight SHA-256-locked synthetic cases across FIFO, pro-rata, IOC/FOK, STP, tick, lifecycle, depth, and multi-symbol semantics | Gives engine authors a stable shared correctness corpus |
194
253
  | FIFO matching | Matches resting orders by price-time priority | Provides the standard exchange-style baseline |
195
254
  | Pro-rata matching | Allocates fills by resting size at a price level | Supports futures-style allocation experiments |
196
255
  | Decimal quantities | Handles float quantities for crypto-style sizing | Avoids legacy integer-only simulator behavior |
197
256
  | Order types | Supports limit, market, IOC, and FOK semantics | Covers common execution workflows |
198
- | Lifecycle APIs | Cancels, replaces, active-order lookup, and structured `OrderResult` submissions | Makes simulations and demos inspectable |
257
+ | Lifecycle APIs | Cancels, priority-preserving quantity reductions, replaces, active-order lookup, and structured `OrderResult` submissions | Makes simulations and imported books inspectable |
199
258
  | Self-trade prevention | Owner-tagged orders with `CANCEL_RESTING`/`CANCEL_INCOMING` policies | Stops a participant from matching its own resting liquidity |
200
259
  | Historical event replay | Loads normalized CSV, JSON, and JSONL order events across symbols while preserving source ids through replacement | Connects real feed adapters to the validated matching path |
260
+ | Coinbase Exchange L3 adapter | Streams REST L3 snapshots plus recorded `full`/compact `level3` messages with sequence validation | Provides one concrete, auditable path from venue data to normalized events |
261
+ | Verified market-data corpora | Captures or prepares sanitized local sessions with SHA-256 manifests, canonical events, deterministic golden state, and comparable import benchmarks | Makes adapter correctness and performance independently reproducible |
201
262
  | Detached public state | Returns copies from submission, lookup, trade, and callback APIs | Prevents callers from mutating live engine indexes |
202
263
  | Event simulation | Interleaves `NEW`, `CANCEL`, and `REPLACE` events with deterministic seeds | Exercises more than one-way order ingestion |
203
264
  | Synthetic streams | Generates random, trend, mean-reverting, momentum, passive, market-making, aggressive, and mixed flows | Enables repeatable workload variation |
@@ -211,20 +272,14 @@ All checks below were run during the latest production repo pass in this checkou
211
272
 
212
273
  ```mermaid
213
274
  flowchart LR
214
- A["OrderFactory / user API"] --> B["OrderBook"]
215
- B --> C["Validation"]
216
- C --> D["MatchingEngine"]
217
- D --> E1["FIFO path"]
218
- D --> E2["Pro-rata path"]
219
- D --> F["Price levels"]
220
- F --> G["Trades + resting book"]
221
- G --> H["Market data snapshots"]
222
- I["SyntheticOrderStream"] --> J["Simulation events"]
223
- J --> B
224
- B --> K["PerformanceMonitor"]
225
- K --> L["Benchmark JSON"]
226
- K --> M["Dashboard"]
227
- H --> M
275
+ T["Normalized event trace"] --> R["Conformance runner"]
276
+ R --> O["Tracebook reference"]
277
+ R --> A["stdio adapter"]
278
+ A <--> E["External engine"]
279
+ O --> D["Semantic diff"]
280
+ A --> D
281
+ D --> P["Versioned report"]
282
+ P --> M["Minimal failing trace"]
228
283
  ```
229
284
 
230
285
  Core paths:
@@ -233,6 +288,9 @@ Core paths:
233
288
  - `src/tracebook/core/orderbook.py`: public book API, validation, lifecycle operations, callbacks, snapshots.
234
289
  - `src/tracebook/core/matching_engine.py`: FIFO and pro-rata matching coordination.
235
290
  - `src/tracebook/core/price_level.py`: price-level storage and depth snapshots.
291
+ - `src/tracebook/conformance/`: adapters, protocol, semantic diffing, minimization, and standard suite.
292
+ - `src/tracebook/events/`: normalized event replay and Coinbase Exchange L3 adaptation.
293
+ - `src/tracebook/corpus/`: safe local capture, corpus manifests, golden verification, and corpus benchmarks.
236
294
  - `src/tracebook/simulation/`: synthetic order streams and event-based simulation engine.
237
295
  - `src/tracebook/benchmarks/runner.py`: reproducible benchmark scenarios and JSON reports.
238
296
  - `src/tracebook/profiling/`: performance monitor and magic-trace/fallback profiling.
@@ -258,6 +316,20 @@ source venv/bin/activate
258
316
  python -m pip install -e ".[dev,dashboard]"
259
317
  ```
260
318
 
319
+ Run the bundled conformance suite through the example process adapter:
320
+
321
+ ```bash
322
+ tracebook-conformance sample /tmp/tracebook-conformance-v1
323
+ tracebook-conformance suite \
324
+ /tmp/tracebook-conformance-v1 \
325
+ --output /tmp/conformance-suite.json \
326
+ --candidate python examples/conformance_adapter.py
327
+ ```
328
+
329
+ See [`docs/conformance.md`](docs/conformance.md) to adapt an external engine and
330
+ to read the versioned protocol, hashing rules, report schemas, and minimizer
331
+ guarantees.
332
+
261
333
  Run a minimal match:
262
334
 
263
335
  ```python
@@ -417,6 +489,50 @@ addressable after cancel-and-new replacement; optional trade output includes
417
489
  both source and engine ids. See
418
490
  [`docs/event-replay.md`](docs/event-replay.md) for the schema and adapter guidance.
419
491
 
492
+ ### Coinbase Exchange L3
493
+
494
+ Normalize and replay the included Coinbase-style REST L3 snapshot and recorded
495
+ `full` feed without adding a network or authentication dependency:
496
+
497
+ ```bash
498
+ tracebook-coinbase \
499
+ examples/data/coinbase_btcusd_l3_snapshot.json \
500
+ examples/data/coinbase_btcusd_full.jsonl \
501
+ --tick-size 0.01 \
502
+ --events-output /tmp/coinbase-events.jsonl \
503
+ --include-trades \
504
+ --output /tmp/coinbase-replay.json
505
+ ```
506
+
507
+ The adapter enforces per-product sequence continuity, parses the compact
508
+ channel's announced schema, preserves maker reductions without resetting FIFO
509
+ priority, and keeps observed exchange trades separate from simulated trades.
510
+ See [`docs/coinbase-l3.md`](docs/coinbase-l3.md) for synchronization and
511
+ limitations.
512
+
513
+ ### Verified Coinbase Corpora
514
+
515
+ The checked synthetic corpus binds sanitized source input, normalized events,
516
+ and complete final depth to one stable SHA-256 identity:
517
+
518
+ ```bash
519
+ tracebook-corpus sample /tmp/tracebook-sample-corpus
520
+ tracebook-corpus verify /tmp/tracebook-sample-corpus
521
+
522
+ tracebook-corpus benchmark \
523
+ /tmp/tracebook-sample-corpus \
524
+ --iterations 10 \
525
+ --warmups 2 \
526
+ --output benchmark_results/corpus.json
527
+ ```
528
+
529
+ Optional live capture subscribes before taking one REST L3 snapshot, sanitizes
530
+ before disk, and never accepts credentials. Coinbase's market-data terms may
531
+ restrict redistribution, so live manifests say `redistribution=not_granted`
532
+ and the root `corpora/` directory is ignored by Git. Install
533
+ `tracebook-sim[capture]` and review [`docs/corpora.md`](docs/corpora.md) before
534
+ capturing.
535
+
420
536
  ## Reproducible Paced Workloads
421
537
 
422
538
  ```bash
@@ -485,6 +601,10 @@ requires `--allow-remote`.
485
601
 
486
602
  | Command | Purpose |
487
603
  | --- | --- |
604
+ | `tracebook-conformance sample suite/` | Copy the hash-locked synthetic conformance suite |
605
+ | `tracebook-conformance suite suite/ --candidate ./adapter` | Test an external engine across every standard case |
606
+ | `tracebook-conformance run events.jsonl --candidate ./adapter` | Stop at the first semantic divergence in one trace |
607
+ | `tracebook-conformance minimize events.jsonl --events-output minimal.jsonl --candidate ./adapter` | Reduce a failure and report minimality or budget exhaustion |
488
608
  | `tracebook-sim --duration 5 --throughput 500 --algorithm FIFO` | Run a FIFO simulation |
489
609
  | `tracebook-sim --algorithm PRO_RATA --seed 1337` | Run the pro-rata path deterministically |
490
610
  | `tracebook-sim --cancel-ratio 0.05 --replace-ratio 0.02` | Interleave lifecycle events |
@@ -492,6 +612,9 @@ requires `--allow-remote`.
492
612
  | `tracebook-benchmark --scenario smoke` | Run the benchmark smoke scenario |
493
613
  | `tracebook-benchmark --scenario all --output benchmark_results/local.json` | Produce a full local benchmark report |
494
614
  | `tracebook-replay events.jsonl --output replay.json` | Replay normalized historical order events |
615
+ | `tracebook-coinbase snapshot.json full.jsonl --tick-size 0.01` | Normalize and replay Coinbase Exchange L3 data |
616
+ | `tracebook-corpus verify corpus/` | Verify hashes, events, and deterministic golden state |
617
+ | `tracebook-corpus benchmark corpus/ --output report.json` | Measure corpus import and replay phases |
495
618
  | `tracebook-dashboard --demo-simulation` | Launch the Dash dashboard with live demo data |
496
619
  | `tracebook-web --port 8080` | Serve the dependency-free live order-book frontend |
497
620
  | `python -m pytest` | Run unit tests |
@@ -540,6 +663,12 @@ Public top-level exports:
540
663
  | `ReplayTrade` | Trade record annotated with source and engine order ids |
541
664
  | `load_market_events` | Load CSV, JSON, or JSONL event files |
542
665
  | `replay_market_events` | Replay normalized events into per-symbol books |
666
+ | `ConformanceConfig` | Matching and numeric-normalization contract for a comparison |
667
+ | `EngineAdapter` | Typed interface for pluggable in-process candidate engines |
668
+ | `ReferenceEngineAdapter` | Incremental adapter over Tracebook's reference semantics |
669
+ | `ExternalProcessAdapterFactory` | Fresh stdio candidate process for each run or minimization trial |
670
+ | `run_conformance` | Produce the first-divergence or conformant report for one trace |
671
+ | `minimize_failing_trace` | Delta-debug a divergent trace under a run budget |
543
672
 
544
673
  ## Outputs
545
674
 
@@ -548,6 +677,11 @@ Public top-level exports:
548
677
  | Simulation JSON | Raw simulation config, summary metrics, performance data, order book stats, stream stats, algorithm analysis |
549
678
  | Benchmark JSON | Scenario summaries plus raw simulation results, machine metadata, dependency versions, warmup and seed |
550
679
  | Event replay JSON | Config, applied/rejected counts, active source-id mapping, final depth, per-book statistics, and optional trades |
680
+ | Corpus manifest and golden JSON | Source rights, sanitization/capture metadata, file hashes, canonical event digest, sequence range, and complete final depth |
681
+ | Corpus benchmark/comparison JSON | Raw timing samples, machine/dependency metadata, corpus identity, phase summaries, and explicit environment differences |
682
+ | Conformance report JSON | Trace/config identity, engine metadata, compared event count, final state hash, and exact first divergence |
683
+ | Minimization JSON + JSONL | Reduction statistics, target failure category, minimized trace hash, and executable reproducer |
684
+ | Conformance suite JSON | Per-case fixture hashes, tags, and complete candidate reports |
551
685
  | Dashboard charts | Throughput, latency, resources, trade volume, and depth |
552
686
  | Performance docs | Local baseline samples and reporting rules |
553
687
 
@@ -558,14 +692,17 @@ Generated benchmark outputs and trace artifacts are ignored by git.
558
692
  ```text
559
693
  src/tracebook/ package source
560
694
  core/ orders, price levels, matching engine, order book API
695
+ conformance/ adapters, protocol, semantic diffing, minimizer, suite
561
696
  events/ normalized file loading and historical event replay
697
+ corpus/ capture, manifests, bundled fixture, verification, benchmarks
562
698
  simulation/ synthetic order streams and event simulation
563
699
  benchmarks/ reproducible benchmark runner
564
700
  profiling/ performance monitor and tracing tools
565
701
  visualization/ Dash dashboard + static web frontend (web/)
566
702
  tests/ pytest correctness and integration coverage
567
- docs/ architecture, commands, and performance notes
568
- examples/ runnable example scripts
703
+ integrations/ pinned optional adapters for independently built engines
704
+ docs/ architecture, CI, release, command, and performance notes
705
+ examples/ runnable scripts, CI templates, and source feed fixtures
569
706
  .github/workflows/ CI across supported Python versions
570
707
  setup.py package metadata, extras, console scripts
571
708
  pyproject.toml build-system and tool configuration
@@ -575,11 +712,15 @@ pyproject.toml build-system and tool configuration
575
712
 
576
713
  Claims:
577
714
 
715
+ - Runs external matching engines through a versioned, language-neutral stdio protocol and compares each event's observable semantics.
716
+ - Localizes the first difference in outcome, rejection code, trade, resting state, or queue priority and can reduce the failing trace.
717
+ - Ships a synthetic, SHA-256-locked standard conformance suite with independently configurable matching policies.
578
718
  - Implements FIFO and pro-rata matching paths for supported order types.
579
719
  - Supports decimal order quantities.
580
720
  - Validates symbols, sides, order types, prices, and quantities before matching.
581
721
  - Supports atomic replacement, cancellation, detached active-order lookup, and coherent state snapshots.
582
722
  - Replays normalized CSV, JSON, and JSONL order events across independent symbol books with stable source-id lifecycle mapping.
723
+ - Verifies hash-locked corpus inputs by reproducing canonical events and golden final book state exactly.
583
724
  - Runs deterministic synthetic simulations with new, cancel, and replace events.
584
725
  - Reports benchmark output with warmup, seed, machine metadata, generation timing, matching latency, event latency, memory, and monitoring overhead.
585
726
  - Provides a dashboard demo path without requiring external market connectivity.
@@ -587,11 +728,13 @@ Claims:
587
728
  Non-claims:
588
729
 
589
730
  - Not a production exchange matching engine.
590
- - Not a trading venue, broker, market data vendor, or exchange connector.
731
+ - Not a trading venue, broker, production feed handler, or market-data vendor.
732
+ - Not a grant of rights to redistribute captured exchange market data.
591
733
  - Not investment advice.
592
734
  - Not a guarantee of live low-latency performance.
593
735
  - Not a full fixed-point implementation yet; prices snap to an integer tick grid but quantities remain float64.
594
736
  - Not a complete market microstructure research platform.
737
+ - Not exchange certification or proof of thread safety, durability, risk controls, networking behavior, or adapter honesty.
595
738
  - Not proof that a listed benchmark number will reproduce on another machine.
596
739
 
597
740
  ## Limitations
@@ -600,16 +743,18 @@ Non-claims:
600
743
  - Current storage uses plain Python dicts and lists (orders per level are an insertion-ordered dict; price levels are a bisect-indexed list), not a final low-latency memory layout.
601
744
  - Prices snap to a configurable integer tick grid (`OrderBook(symbol, tick_size=...)`, default `0.01`); quantities remain float64 and full fixed-point accounting is a later performance phase.
602
745
  - The normalized replay contract is venue-neutral; exchange sequence checks and feed-specific semantics belong in adapters.
746
+ - Protocol version 1 compares quantities after explicit decimal normalization; engines requiring different fixed-point rules must configure and document that boundary.
747
+ - Live Coinbase corpora are local artifacts. Pseudonymization removes unnecessary identifiers but does not alter Coinbase's market-data terms.
603
748
  - Dashboard is a local demo and monitoring surface, not a secured production service.
604
749
  - Magic-trace is optional and platform-dependent; fallback profiling is available when magic-trace is not installed.
605
750
  - Benchmark results are local artifacts and should always cite the command, seed, machine, Python version, and dependency versions.
606
751
 
607
752
  ## Roadmap
608
753
 
609
- - Publish `tracebook-sim` through PyPI Trusted Publishing.
610
- - Add documented adapters for public crypto and equities order-event formats.
611
- - Add an explicit unpaced capacity benchmark beside the existing paced workloads.
612
- - Stabilize artifact schemas and the top-level API for 1.0.
754
+ - Validate the protocol with an independently implemented Rust, C++, or Java adapter.
755
+ - Add state-machine-aware property generation for lifecycle and self-trade-prevention traces.
756
+ - Separate adapter/protocol overhead from candidate engine timing in a dedicated benchmark mode.
757
+ - Stabilize protocol and artifact schemas after external-engine feedback.
613
758
 
614
759
  ## Open Source Project Health
615
760
 
@@ -0,0 +1,50 @@
1
+ # Tracebook Project Plan
2
+
3
+ ## Product Position
4
+
5
+ `tracebook` is the conformance-testing and reproducible failure-analysis toolkit
6
+ for matching engines. It runs canonical order-event traces against its
7
+ inspectable Python reference engine and external engines, localizes semantic
8
+ drift, reduces failures, and keeps correctness and performance artifacts
9
+ reproducible. It is distributed as `tracebook-sim` and imported as `tracebook`.
10
+
11
+ The project optimizes for deterministic behavior and auditability before raw
12
+ speed. Its optional public capture is research tooling, not a production feed
13
+ handler or trading infrastructure.
14
+
15
+ ## Maintained Surfaces
16
+
17
+ ```text
18
+ src/tracebook/
19
+ core/ matching, lifecycle, snapshots, deterministic replay
20
+ conformance/ adapters, semantic diffing, trace minimization, standard suite
21
+ events/ normalized event replay and offline venue adapters
22
+ corpus/ safe local capture, manifests, golden state, import benchmarks
23
+ simulation/ synthetic order flow and paced workload execution
24
+ benchmarks/ reproducible local scenario reports
25
+ profiling/ metrics, magic-trace, and selected-function fallback tracing
26
+ visualization/ Dash dashboard and dependency-free live web frontend
27
+ integrations/
28
+ python_matching_engine/ pinned external adapter and compatibility trace
29
+ ```
30
+
31
+ ## Next Milestones
32
+
33
+ 1. Validate the protocol with one independently implemented Rust, C++, or Java
34
+ adapter and publish it as an integration example.
35
+ 2. Add grammar-aware, property-based trace generation for lifecycle and
36
+ self-trade-prevention state machines.
37
+ 3. Add a benchmark mode for candidate adapters that separates protocol overhead
38
+ from engine execution and never presents it as production latency.
39
+ 4. Stabilize the protocol, event, and report schemas after external-adapter
40
+ feedback, then publish a 1.0 policy.
41
+
42
+ ## Decision Rules
43
+
44
+ - Matching behavior changes require executable semantic and invariant tests.
45
+ - Conformance protocol changes require cross-process tests, artifact schema
46
+ tests, a version decision, and migration notes.
47
+ - Exported schema changes require artifact tests and a changelog entry.
48
+ - Performance claims require a command, seed, environment, and JSON artifact.
49
+ - New dependencies need a measurable benefit and must remain optional unless
50
+ they are required by the core order-processing path.