tracebook-sim 0.4.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 (158) hide show
  1. tracebook_sim-0.4.0/CHANGELOG.md +183 -0
  2. tracebook_sim-0.4.0/CODE_OF_CONDUCT.md +22 -0
  3. tracebook_sim-0.4.0/CONTRIBUTING.md +91 -0
  4. tracebook_sim-0.4.0/LICENSE +21 -0
  5. tracebook_sim-0.4.0/MANIFEST.in +23 -0
  6. tracebook_sim-0.4.0/PKG-INFO +940 -0
  7. tracebook_sim-0.4.0/PROJECT_PLAN.md +51 -0
  8. tracebook_sim-0.4.0/QUICKSTART.md +150 -0
  9. tracebook_sim-0.4.0/README.md +844 -0
  10. tracebook_sim-0.4.0/SECURITY.md +27 -0
  11. tracebook_sim-0.4.0/SUPPORT.md +21 -0
  12. tracebook_sim-0.4.0/docs/api-stability.md +49 -0
  13. tracebook_sim-0.4.0/docs/architecture.md +204 -0
  14. tracebook_sim-0.4.0/docs/ci.md +73 -0
  15. tracebook_sim-0.4.0/docs/coinbase-l3.md +156 -0
  16. tracebook_sim-0.4.0/docs/commands.md +284 -0
  17. tracebook_sim-0.4.0/docs/conformance.md +418 -0
  18. tracebook_sim-0.4.0/docs/corpora.md +228 -0
  19. tracebook_sim-0.4.0/docs/event-replay.md +90 -0
  20. tracebook_sim-0.4.0/docs/logo.png +0 -0
  21. tracebook_sim-0.4.0/docs/performance.md +160 -0
  22. tracebook_sim-0.4.0/docs/positioning.md +63 -0
  23. tracebook_sim-0.4.0/docs/release.md +95 -0
  24. tracebook_sim-0.4.0/docs/releases/0.3.0.md +88 -0
  25. tracebook_sim-0.4.0/docs/releases/0.4.0.md +84 -0
  26. tracebook_sim-0.4.0/examples/advanced_profiling_check.py +298 -0
  27. tracebook_sim-0.4.0/examples/conformance_adapter.py +17 -0
  28. tracebook_sim-0.4.0/examples/data/coinbase_btcusd_full.jsonl +10 -0
  29. tracebook_sim-0.4.0/examples/data/coinbase_btcusd_l3_snapshot.json +12 -0
  30. tracebook_sim-0.4.0/examples/data/sample_events.jsonl +5 -0
  31. tracebook_sim-0.4.0/examples/full_simulation_demo.py +355 -0
  32. tracebook_sim-0.4.0/examples/github-actions/conformance.yml +47 -0
  33. tracebook_sim-0.4.0/examples/magic_trace_integration_demo.py +298 -0
  34. tracebook_sim-0.4.0/integrations/__init__.py +1 -0
  35. tracebook_sim-0.4.0/integrations/orderbook_rs/Cargo.lock +1154 -0
  36. tracebook_sim-0.4.0/integrations/orderbook_rs/Cargo.toml +29 -0
  37. tracebook_sim-0.4.0/integrations/orderbook_rs/README.md +182 -0
  38. tracebook_sim-0.4.0/integrations/orderbook_rs/fifo-compatible.jsonl +13 -0
  39. tracebook_sim-0.4.0/integrations/orderbook_rs/rust-toolchain.toml +4 -0
  40. tracebook_sim-0.4.0/integrations/orderbook_rs/src/adapter.rs +806 -0
  41. tracebook_sim-0.4.0/integrations/orderbook_rs/src/bin/faulty_orderbook_adapter.rs +14 -0
  42. tracebook_sim-0.4.0/integrations/orderbook_rs/src/lib.rs +3 -0
  43. tracebook_sim-0.4.0/integrations/orderbook_rs/src/main.rs +49 -0
  44. tracebook_sim-0.4.0/integrations/orderbook_rs/src/server.rs +204 -0
  45. tracebook_sim-0.4.0/integrations/orderbook_rs/src/wire.rs +273 -0
  46. tracebook_sim-0.4.0/integrations/python_matching_engine/README.md +85 -0
  47. tracebook_sim-0.4.0/integrations/python_matching_engine/__init__.py +1 -0
  48. tracebook_sim-0.4.0/integrations/python_matching_engine/adapter.py +238 -0
  49. tracebook_sim-0.4.0/integrations/python_matching_engine/fifo-compatible.jsonl +13 -0
  50. tracebook_sim-0.4.0/pyproject.toml +28 -0
  51. tracebook_sim-0.4.0/setup.cfg +4 -0
  52. tracebook_sim-0.4.0/setup.py +150 -0
  53. tracebook_sim-0.4.0/src/tracebook/__init__.py +62 -0
  54. tracebook_sim-0.4.0/src/tracebook/_version.py +3 -0
  55. tracebook_sim-0.4.0/src/tracebook/benchmarks/__init__.py +1 -0
  56. tracebook_sim-0.4.0/src/tracebook/benchmarks/runner.py +234 -0
  57. tracebook_sim-0.4.0/src/tracebook/conformance/__init__.py +99 -0
  58. tracebook_sim-0.4.0/src/tracebook/conformance/campaign.py +1032 -0
  59. tracebook_sim-0.4.0/src/tracebook/conformance/classification.py +58 -0
  60. tracebook_sim-0.4.0/src/tracebook/conformance/cli.py +347 -0
  61. tracebook_sim-0.4.0/src/tracebook/conformance/compare.py +367 -0
  62. tracebook_sim-0.4.0/src/tracebook/conformance/external.py +302 -0
  63. tracebook_sim-0.4.0/src/tracebook/conformance/fixtures/__init__.py +1 -0
  64. tracebook_sim-0.4.0/src/tracebook/conformance/fixtures/v1/__init__.py +1 -0
  65. tracebook_sim-0.4.0/src/tracebook/conformance/fixtures/v1/deep-cancellation.jsonl +16 -0
  66. tracebook_sim-0.4.0/src/tracebook/conformance/fixtures/v1/fifo-lifecycle.jsonl +10 -0
  67. tracebook_sim-0.4.0/src/tracebook/conformance/fixtures/v1/manifest.json +16 -0
  68. tracebook_sim-0.4.0/src/tracebook/conformance/fixtures/v1/multi-symbol.jsonl +7 -0
  69. tracebook_sim-0.4.0/src/tracebook/conformance/fixtures/v1/order-instructions.jsonl +6 -0
  70. tracebook_sim-0.4.0/src/tracebook/conformance/fixtures/v1/pro-rata-allocation.jsonl +7 -0
  71. tracebook_sim-0.4.0/src/tracebook/conformance/fixtures/v1/stp-cancel-incoming.jsonl +5 -0
  72. tracebook_sim-0.4.0/src/tracebook/conformance/fixtures/v1/stp-cancel-resting.jsonl +5 -0
  73. tracebook_sim-0.4.0/src/tracebook/conformance/fixtures/v1/tick-grid.jsonl +4 -0
  74. tracebook_sim-0.4.0/src/tracebook/conformance/junit.py +122 -0
  75. tracebook_sim-0.4.0/src/tracebook/conformance/minimize.py +151 -0
  76. tracebook_sim-0.4.0/src/tracebook/conformance/model.py +527 -0
  77. tracebook_sim-0.4.0/src/tracebook/conformance/protocol.py +139 -0
  78. tracebook_sim-0.4.0/src/tracebook/conformance/reference.py +136 -0
  79. tracebook_sim-0.4.0/src/tracebook/conformance/reproduce.py +128 -0
  80. tracebook_sim-0.4.0/src/tracebook/conformance/semantic_coverage.py +155 -0
  81. tracebook_sim-0.4.0/src/tracebook/conformance/suite.py +221 -0
  82. tracebook_sim-0.4.0/src/tracebook/core/__init__.py +0 -0
  83. tracebook_sim-0.4.0/src/tracebook/core/matching_engine.py +497 -0
  84. tracebook_sim-0.4.0/src/tracebook/core/order.py +436 -0
  85. tracebook_sim-0.4.0/src/tracebook/core/orderbook.py +1107 -0
  86. tracebook_sim-0.4.0/src/tracebook/core/price_level.py +309 -0
  87. tracebook_sim-0.4.0/src/tracebook/core/replay.py +191 -0
  88. tracebook_sim-0.4.0/src/tracebook/corpus/__init__.py +29 -0
  89. tracebook_sim-0.4.0/src/tracebook/corpus/cli.py +195 -0
  90. tracebook_sim-0.4.0/src/tracebook/corpus/coinbase.py +1345 -0
  91. tracebook_sim-0.4.0/src/tracebook/corpus/fixtures/__init__.py +1 -0
  92. tracebook_sim-0.4.0/src/tracebook/corpus/fixtures/coinbase-btcusd-synthetic-v1/events.jsonl +8 -0
  93. tracebook_sim-0.4.0/src/tracebook/corpus/fixtures/coinbase-btcusd-synthetic-v1/feed.jsonl +10 -0
  94. tracebook_sim-0.4.0/src/tracebook/corpus/fixtures/coinbase-btcusd-synthetic-v1/golden.json +46 -0
  95. tracebook_sim-0.4.0/src/tracebook/corpus/fixtures/coinbase-btcusd-synthetic-v1/manifest.json +73 -0
  96. tracebook_sim-0.4.0/src/tracebook/corpus/fixtures/coinbase-btcusd-synthetic-v1/snapshot.json +20 -0
  97. tracebook_sim-0.4.0/src/tracebook/events/__init__.py +39 -0
  98. tracebook_sim-0.4.0/src/tracebook/events/cli.py +83 -0
  99. tracebook_sim-0.4.0/src/tracebook/events/coinbase_cli.py +192 -0
  100. tracebook_sim-0.4.0/src/tracebook/events/coinbase_l3.py +772 -0
  101. tracebook_sim-0.4.0/src/tracebook/events/market_replay.py +608 -0
  102. tracebook_sim-0.4.0/src/tracebook/profiling/__init__.py +0 -0
  103. tracebook_sim-0.4.0/src/tracebook/profiling/magic_trace_wrapper.py +595 -0
  104. tracebook_sim-0.4.0/src/tracebook/profiling/performance_monitor.py +615 -0
  105. tracebook_sim-0.4.0/src/tracebook/profiling/trace_analyzer.py +534 -0
  106. tracebook_sim-0.4.0/src/tracebook/profiling/trace_visualizer.py +475 -0
  107. tracebook_sim-0.4.0/src/tracebook/py.typed +1 -0
  108. tracebook_sim-0.4.0/src/tracebook/simulation/__init__.py +0 -0
  109. tracebook_sim-0.4.0/src/tracebook/simulation/order_generator.py +960 -0
  110. tracebook_sim-0.4.0/src/tracebook/simulation/simulation_engine.py +701 -0
  111. tracebook_sim-0.4.0/src/tracebook/utils/__init__.py +0 -0
  112. tracebook_sim-0.4.0/src/tracebook/visualization/__init__.py +0 -0
  113. tracebook_sim-0.4.0/src/tracebook/visualization/dashboard.py +698 -0
  114. tracebook_sim-0.4.0/src/tracebook/visualization/web/__init__.py +1 -0
  115. tracebook_sim-0.4.0/src/tracebook/visualization/web/app.js +146 -0
  116. tracebook_sim-0.4.0/src/tracebook/visualization/web/index.html +66 -0
  117. tracebook_sim-0.4.0/src/tracebook/visualization/web/styles.css +312 -0
  118. tracebook_sim-0.4.0/src/tracebook/visualization/web_server.py +258 -0
  119. tracebook_sim-0.4.0/src/tracebook_sim.egg-info/PKG-INFO +940 -0
  120. tracebook_sim-0.4.0/src/tracebook_sim.egg-info/SOURCES.txt +156 -0
  121. tracebook_sim-0.4.0/src/tracebook_sim.egg-info/dependency_links.txt +1 -0
  122. tracebook_sim-0.4.0/src/tracebook_sim.egg-info/entry_points.txt +9 -0
  123. tracebook_sim-0.4.0/src/tracebook_sim.egg-info/not-zip-safe +1 -0
  124. tracebook_sim-0.4.0/src/tracebook_sim.egg-info/requires.txt +54 -0
  125. tracebook_sim-0.4.0/src/tracebook_sim.egg-info/top_level.txt +1 -0
  126. tracebook_sim-0.4.0/tests/__init__.py +0 -0
  127. tracebook_sim-0.4.0/tests/benchmarks/__init__.py +0 -0
  128. tracebook_sim-0.4.0/tests/benchmarks/microbench.py +126 -0
  129. tracebook_sim-0.4.0/tests/conftest.py +10 -0
  130. tracebook_sim-0.4.0/tests/fixtures/faulty_campaign_adapter.py +70 -0
  131. tracebook_sim-0.4.0/tests/fixtures/faulty_conformance_adapter.py +57 -0
  132. tracebook_sim-0.4.0/tests/test_artifact_schemas.py +652 -0
  133. tracebook_sim-0.4.0/tests/test_audit_hardening.py +343 -0
  134. tracebook_sim-0.4.0/tests/test_benchmark_runner_json_output.py +101 -0
  135. tracebook_sim-0.4.0/tests/test_benchmark_scenarios.py +58 -0
  136. tracebook_sim-0.4.0/tests/test_coinbase_corpus.py +424 -0
  137. tracebook_sim-0.4.0/tests/test_coinbase_l3.py +410 -0
  138. tracebook_sim-0.4.0/tests/test_concurrency_contracts.py +61 -0
  139. tracebook_sim-0.4.0/tests/test_conformance.py +575 -0
  140. tracebook_sim-0.4.0/tests/test_conformance_campaign.py +627 -0
  141. tracebook_sim-0.4.0/tests/test_dashboard_demo_construction.py +270 -0
  142. tracebook_sim-0.4.0/tests/test_external_integrations.py +134 -0
  143. tracebook_sim-0.4.0/tests/test_invariants.py +253 -0
  144. tracebook_sim-0.4.0/tests/test_lifecycle_hardening.py +88 -0
  145. tracebook_sim-0.4.0/tests/test_market_event_replay.py +363 -0
  146. tracebook_sim-0.4.0/tests/test_metrics_honesty.py +52 -0
  147. tracebook_sim-0.4.0/tests/test_order_reduction.py +98 -0
  148. tracebook_sim-0.4.0/tests/test_orderbook_edge_contracts.py +172 -0
  149. tracebook_sim-0.4.0/tests/test_orderbook_semantics.py +367 -0
  150. tracebook_sim-0.4.0/tests/test_public_api.py +16 -0
  151. tracebook_sim-0.4.0/tests/test_release_metadata.py +85 -0
  152. tracebook_sim-0.4.0/tests/test_replay.py +208 -0
  153. tracebook_sim-0.4.0/tests/test_self_trade_prevention.py +175 -0
  154. tracebook_sim-0.4.0/tests/test_simulation_benchmarks.py +273 -0
  155. tracebook_sim-0.4.0/tests/test_simulation_event_metrics.py +86 -0
  156. tracebook_sim-0.4.0/tests/test_tick_grid.py +163 -0
  157. tracebook_sim-0.4.0/tests/test_v020_integrity.py +212 -0
  158. tracebook_sim-0.4.0/tests/test_web_frontend.py +151 -0
@@ -0,0 +1,183 @@
1
+ # Changelog
2
+
3
+ All notable changes to `tracebook` will be documented here.
4
+
5
+ The project follows [Keep a Changelog](https://keepachangelog.com/) conventions.
6
+
7
+ ## Unreleased
8
+
9
+ ## 0.4.0 - 2026-07-13
10
+
11
+ - Began 0.4.0 development with deterministic, versioned differential campaigns.
12
+ Stateful generated traces are driven only by the reference engine, stop at
13
+ the first candidate divergence, and atomically emit the original failure,
14
+ exact semantic report, and automatically minimized reproducer.
15
+ - Added `fifo-limit-v1` and `fifo-full-v1` campaign profiles, a specified
16
+ cross-Python SplitMix64 generator, a stable campaign identity, and the
17
+ `tracebook-conformance campaign` command for local and CI use.
18
+ - Locked candidate identity across campaign and minimization subprocesses,
19
+ reserved the exact output path before candidate work, rejected changed output
20
+ reservations without overwriting them, failed closed where descriptor-safe
21
+ commits are unavailable, and fixed campaign IDs and trace hashes across the
22
+ Python CI matrix.
23
+ - Added a native Rust adapter for exactly pinned `orderbook-rs` 0.10.4. It
24
+ agrees on seven of eight standard cases, passes a 1,000-event generated FIFO
25
+ instruction campaign, documents the intentional pro-rata boundary, and runs
26
+ an injected Rust-side trade drift as a negative CI control. A scoped weekly
27
+ Dependabot feed proposes reviewed Cargo pin and lockfile updates.
28
+ - Added generator version 2's structured FIFO queue-priority probe. The public
29
+ seed-42 campaign detects an intentionally injected Rust maker-priority bug at
30
+ original event 173 and reduces the failing prefix to a one-minimal five-event
31
+ reproducer.
32
+ - Added deterministic failure-corpus bundles, stable failure classes,
33
+ `tracebook-conformance reproduce`, the option-friendly `--candidate-cmd`
34
+ form, and exact expected-versus-observed reproduction reports.
35
+ - Added reference-derived semantic capability coverage plus JSON and JUnit
36
+ outputs across run, suite, minimization, campaign, and reproduction paths.
37
+ - Included both correct and intentionally faulty native Rust adapter source in
38
+ the sdist, documented the `fifo-limit-v1` capability boundary, and updated the
39
+ copy-paste CI workflow to install `tracebook-sim==0.4.0` from public PyPI.
40
+
41
+ ## 0.3.0 - 2026-07-13
42
+
43
+ - Added the first maintained third-party engine integration: a commit-pinned
44
+ PythonMatchingEngine adapter, a 13-event native FIFO/LIMIT compatibility
45
+ trace, and a scheduled workflow that locks both the passing trace and the
46
+ honest `2/8` standard-suite contract profile.
47
+ - Added a real-engine README demo, a concise conformance architecture diagram,
48
+ a copy-paste GitHub Actions gate, and dedicated 0.3.0 release notes explaining
49
+ the move from Python simulator to matching-engine correctness lab.
50
+ - Repositioned Tracebook as a matching-engine conformance and reproducible
51
+ failure-analysis toolkit. Added a typed pluggable `EngineAdapter` API and an
52
+ incremental, language-neutral NDJSON protocol for testing external Rust,
53
+ C++, Java, Python, or other engines against the Tracebook reference path.
54
+ - Added `tracebook-conformance run` and `suite` with per-event applied/rejected
55
+ outcomes, stable rejection codes, source-ID trades, canonical queue-state
56
+ hashes, on-demand full snapshots, exact first-divergence paths, versioned JSON
57
+ artifacts, subprocess timeouts, and final-snapshot verification.
58
+ - Added deterministic delta-debugging through `tracebook-conformance minimize`,
59
+ which truncates after the first failure, emits a smaller JSONL reproducer,
60
+ and distinguishes a proven one-minimal result from run-budget exhaustion.
61
+ - Added a hash-locked, redistributable eight-case conformance suite covering
62
+ FIFO lifecycle and queue priority, IOC/FOK/market instructions, both
63
+ self-trade policies, pro-rata allocation, multiple symbols, tick-grid edge
64
+ cases, and deep-book cancellation pressure. Added property-based first-fault
65
+ tests and wheel-installed suite smoke coverage.
66
+ - Added `OrderBook.get_resting_orders()` for a detached, matching-priority view
67
+ of every resting order, including same-price queue order.
68
+ - Added `tracebook-corpus` for synchronized local Coinbase capture, offline
69
+ corpus preparation, pre-write field allowlisting and order-ID
70
+ pseudonymization, hash-locked manifests, exact golden replay verification,
71
+ machine-attributed import benchmarks, and environment-aware report
72
+ comparison. Live capture is an optional dependency and records that Coinbase
73
+ market-data redistribution rights are not granted by sanitization.
74
+ - Added a distributable synthetic BTC-USD corpus with canonical snapshot,
75
+ feed, normalized events, golden final state, and a stable corpus ID. System
76
+ smoke and wheel CI now reproduce it exactly.
77
+ - Added the dependency-free `tracebook-coinbase` offline adapter for Coinbase
78
+ Exchange REST L3 snapshots plus recorded `full` or compact `level3` feeds. It
79
+ validates dynamic compact schemas and per-product sequences, streams
80
+ normalized events, preserves observed exchange trades separately, ignores
81
+ future protocol message types without skipping sequence validation, and
82
+ rejects auction/crossed books rather than manufacturing queue state.
83
+ - Added priority-preserving `reduce_order()` and normalized `reduce` events for
84
+ partial maker fills and same-price size decreases. Core event logs and replay
85
+ summaries move to schema version 2; version 1 event logs remain readable.
86
+
87
+ ## 0.2.0 - 2026-07-10
88
+
89
+ Trust, installability, and real-data workflow release.
90
+
91
+ - Renamed the Python distribution to `tracebook-sim` because the `tracebook`
92
+ project name on PyPI belongs to an unrelated package. The import namespace and
93
+ existing `tracebook-*` console commands remain unchanged.
94
+ - Added `tracebook-replay` and the `tracebook.events` API for normalized CSV,
95
+ JSON, and JSONL order-event replay across multiple symbols. The strict mode
96
+ fails with event context; lenient mode records rejections and continues.
97
+ - Kept imported source order ids stable across replacement and later cancellation,
98
+ added configurable self-trade policy, and added optional trade output carrying
99
+ both source and engine ids.
100
+ - Made replacement an atomic cancel-and-new transaction with callbacks delivered
101
+ after unlocking, and preserved the original owner so replacement cannot bypass
102
+ either self-trade-prevention policy.
103
+ - Detached accepted orders, lookup results, trades, and callback payloads from
104
+ internal mutable state so callers cannot corrupt price levels or trade history.
105
+ - Tightened existing-order validation: ids, sides, order types, owners, timestamps,
106
+ prices, and quantities are type-checked without lossy integer coercion, and
107
+ malformed submissions return structured rejections.
108
+ - Added `clear` to deterministic event logs so recording and replay retain the
109
+ identical final book after a reset. Recorded submissions now retain an
110
+ externally supplied partial remaining quantity as well, and recording now
111
+ requires a pristine book with no earlier non-resting activity.
112
+ - Made pro-rata FOK preflight mirror level-wide `CANCEL_INCOMING` execution.
113
+ - Made fallback profiling collect configured matching functions through a real
114
+ Python profiling hook and emit completed calls and raw events.
115
+ - Made live frontend state atomic across depth, quote, trades, and statistics;
116
+ corrected chronological trade-direction coloring.
117
+ - Made the optional dashboard command keep `--help` and `--version` usable from
118
+ a core install and report the exact dashboard-extra install command otherwise.
119
+ - Separated achieved new-order rate from total event rate, made simulation metric
120
+ collection and batch ingestion configuration effective, and hardened cleanup
121
+ for failed or interrupted simulation and web sessions. Registered simulation
122
+ completion callbacks now receive the result artifact instead of being inert.
123
+ - Added PEP 561 `py.typed` metadata, Python 3.12/3.13 CI, a 75% coverage gate,
124
+ wheel-installed CLI smoke tests, package metadata checks, and a PyPI Trusted
125
+ Publishing release workflow.
126
+ - Added a dependency-free live order-book web frontend (`tracebook-web`): a
127
+ static HTML/CSS/JS page served by a stdlib HTTP server, backed by a background
128
+ simulation, showing a live depth ladder, top-of-book quote, engine metrics,
129
+ and a trade tape. It is loopback-only by default and ships in wheel/sdist.
130
+
131
+ ## 0.1.1 - 2026-07-02
132
+
133
+ Patch release from an adversarial QA pass: eight confirmed bugs fixed, each with a regression test.
134
+
135
+ - Required an empty book for `start_recording()` (QA found silent replay divergence): the event log captures only operations from the recording point on, so recording a book with pre-existing resting liquidity would replay to a different result (or crash on a later cancel of a pre-existing order). `start_recording()` now raises if any orders are resting.
136
+ - Stopped firing user callbacks while a lock is held (a deadlock vector found in QA): `replace_order` now submits the replacement with the book lock released, and `PerformanceMonitor.record_order_processing` fires alert callbacks after releasing the monitor lock. `replace_order` is now documented as cancel-then-new (its callbacks are lock-free like every other submission).
137
+ - Bounded the matching engine's trade history (found leaking in QA): `trades` is now a capped deque (retaining the recent tail for `get_recent_trades`) instead of an unbounded list, so a long-running book no longer grows memory per fill; `total_trades` remains the cumulative count.
138
+ - Hardened `MagicTraceSession.stop()` (found in QA): it now checks `poll()` before signalling, tolerates a self-exited child (magic-trace runs with a duration cap), always reaps the process, and marks the session inactive in a `finally` — previously a self-exited child raised `ProcessLookupError`, wedging the session and leaving a zombie.
139
+ - Fixed two tick-snapping matching bugs found in QA: an incoming limit whose price was within half a tick of a resting order could rest beside it and lock the book (the match decision used the raw price while resting prices were snapped), and a positive sub-half-tick price could snap to `0.0` and rest/execute for free. Incoming prices are now snapped onto the tick grid before validation and matching, and a price that snaps to a non-positive tick is rejected. The property-based invariants now fuzz off-grid prices.
140
+
141
+ ## 0.1.0 - 2026-07-02
142
+
143
+ First tagged alpha release. Consolidates the full alpha development history.
144
+
145
+ - Enabled `check_untyped_defs` in the mypy baseline (still `mypy src/tracebook` clean) and fixed the untyped-body issues it surfaced (nullable thread handles and an optional trace-file guard).
146
+ - Published a local benchmark baseline covering every scenario, including the newer ones, in `docs/performance.md`.
147
+ - Added benchmark scenarios: `deep_book` (deep resting liquidity), `high_cancellation` (heavier cancel/replace mix), `pro_rata_cancellation` (pro-rata with lifecycle events), and `multi_symbol` (independent books per symbol). `BenchmarkScenario` gained a `symbols` field threaded through to the simulation.
148
+ - Added artifact-level schema tests that lock the structure of the public JSON outputs (benchmark report, simulation results, and the replay `EventLog`), round-tripped through `json` the way the CLIs write them, so a refactor cannot silently change the output contract.
149
+ - Extended the mypy type-check baseline to the whole `src/tracebook` package and widened the CI gate to `mypy src/tracebook`. Fixed a real type-contract gap (the `OrderGenerator` ABC now declares the `order_factory`/`price_model` attributes its subclasses set and the stream assigns), made `SimulationConfig.symbols` a non-optional field with a default factory, and annotated the profiling/dashboard/simulation collections and implicit-`Optional` parameters.
150
+ - Established a mypy type-check baseline on the `core` package and enforce it in CI (initially `mypy src/tracebook/core`, clean). Added the annotations to get there, guarded `infer_price_decimals` against non-int `Decimal` exponents, and restored `mypy` as a dev dependency.
151
+ - Added a trusted fast path for orders built by the book's own factory: since the factory already validates side/type/price/quantity/owner and uses the book symbol with a fresh id, the `add_*`/`submit_*` methods skip the redundant book-level re-validation, symbol re-normalization, factory-id reconciliation, and a resting-state index lookup. Cut `add_deep` ~26% and `match` ~19%. The public `add_order`/`submit_order` (which accept externally built orders) still fully validate.
152
+ - Dropped `numba` as a dependency and removed the standalone `algorithms/{fifo,pro_rata}.py` analysis helpers, which were never wired into the live matching path. With `Order`/`Trade`/`PriceLevel` all plain Python, nothing on the order-book path used Numba; the package now imports and runs with Numba absent (verified with the import blocked).
153
+ - Made `Order` and `Trade` plain `__slots__` classes instead of Numba `jitclass` types. Profiling the per-order path showed the jitclass was about half the cost (`inspect`-based argument binding on every construction plus field-access boxing, all paid because the matching loop is pure Python); this roughly tripled `add_deep` and `match` throughput. Numba is no longer used on the order-book path.
154
+ - Made the FIFO match loop copy-free: it now iterates by repeatedly taking the O(1) price-level head instead of copying the entire level per aggressive order, so matching against a deep level is flat (O(1) per match) rather than O(level size). Verified by the `match` microbenchmark (now flat in level size) and a deep-sweep FIFO-order test.
155
+ - Replaced the price-level index's O(n) Python linear-scan insert and `list.remove` with `bisect` (per-side key), removing the Python-loop cost from level insert/removal. A local comparison against `sortedcontainers.SortedList` (command, machine, and Python cited in `docs/performance.md`) found `bisect` + list faster for realistic level counts, so no sorted-container dependency was added.
156
+ - Made in-level order removal O(1) by keying each price level's orders with an insertion-ordered dict (preserving FIFO order), replacing the previous O(n) linear scan. Moving `PriceLevel` off the Numba `jitclass` also removed per-access boundary cost from the pure-Python matching loop, substantially speeding up matching. Added a deterministic operation microbenchmark (`tests/benchmarks/microbench.py`) and before/after numbers in `docs/performance.md`.
157
+ - Added self-trade prevention: orders carry an optional `owner` id, and `OrderBook(self_trade_policy=...)` supports `CANCEL_RESTING` and `CANCEL_INCOMING` (default `NONE`). Both policies keep the book uncrossed, FOK fillability mirrors each policy (own liquidity excluded, and `CANCEL_INCOMING` stops at the first same-owner order so a FOK never partially executes), and the policy plus owners are captured in the replay log. Exported `SelfTradePolicy` and `NO_OWNER`.
158
+ - Made replay fail fast on a malformed or incompatible log: a hard-rejected submission (via a new `OrderResult.accepted` flag) or a cancel that finds no order now raises instead of diverging silently; soft outcomes such as an unfillable FOK still replay faithfully.
159
+ - Computed rolling throughput with an O(1) running window total instead of re-summing the deque on every order.
160
+ - Made `infer_price_decimals` use the tick's exact decimal representation so fine or scientific-notation tick sizes no longer collapse canonical prices to whole numbers.
161
+ - Added deterministic record/replay: `OrderBook.start_recording()`/`stop_recording()` capture a serializable `EventLog`, and `replay()` reconstructs the identical trade sequence and final book state (also across a JSON round-trip). Exported `EventLog` and `replay` from the package root.
162
+ - Reported throughput as a rolling one-second window rate instead of a lifetime cumulative average, so the dashboard shows an instantaneous rate.
163
+ - Removed the synchronous psutil sweep from the order-processing hot path; alerts and summaries now read the background-sampled resource snapshot.
164
+ - Attributed a replacement that crosses the book to matching latency rather than lifecycle-event latency, so replace-heavy scenarios no longer hide matching cost.
165
+ - Made `replace_order` atomic: an invalid replacement is rejected before the original is cancelled, and a replacement that fails to submit after cancellation restores the original resting order, so a replace never destroys liquidity.
166
+ - Bounded the order-id replay guard so long-running books no longer leak memory (most-recent-N window, configurable via `_seen_id_cap`).
167
+ - Keyed price levels by integer ticks (configurable `tick_size`, default `0.01`); prices now snap to a canonical grid, removing the float-identity hazard of dict-keying on raw prices.
168
+ - Consolidated execution pricing to a single rule (matches fill at the resting/maker price) and removed the unused JIT `match_orders_fifo` helper and the divergent timestamp-based `calculate_match_price`.
169
+ - Added property-based matching invariants (quantity conservation, no crossed book, level consistency) and tick-grid tests; added `hypothesis` as a dev dependency.
170
+ - Moved package code under the `tracebook` namespace.
171
+ - Added structured order submission results and richer order book lifecycle APIs.
172
+ - Added event-based simulation with new, cancel, and replace events.
173
+ - Added reproducible benchmark runner and local performance baseline docs.
174
+ - Added dashboard demo simulation support.
175
+ - Added GitHub Actions CI, packaging metadata, and open-source project templates.
176
+ - Reworked the README and docs into an artifact-first professional repo front door.
177
+ - Added release guidance, architecture docs, command docs, and richer package metadata.
178
+ - Added a source distribution manifest for docs, examples, tests, and project metadata.
179
+ - Hardened symbol, enum, numeric, duplicate-order-id, dashboard host, and magic-trace artifact validation.
180
+ - Made simulation lifecycle replacement IDs thread-safe and documented analyzer output as not yet collected.
181
+ - Refreshed local benchmark sample numbers from the current benchmark runner.
182
+ - Removed the unused mypy dev dependency/config until typed-package support has a real passing baseline.
183
+ - Added compile and dependency consistency checks to CI and clarified dependency grouping.
@@ -0,0 +1,22 @@
1
+ # Code Of Conduct
2
+
3
+ This project should be a place where people can do careful technical work without needless friction.
4
+
5
+ ## Expected Behavior
6
+
7
+ - Be respectful and specific.
8
+ - Assume good intent, but accept correction when impact differs from intent.
9
+ - Critique code and ideas, not people.
10
+ - Keep disagreements focused on evidence, tradeoffs, and project goals.
11
+ - Make space for new contributors to ask basic questions.
12
+
13
+ ## Unacceptable Behavior
14
+
15
+ - Harassment, threats, insults, or discriminatory language.
16
+ - Publishing private information without consent.
17
+ - Repeatedly derailing issues or pull requests.
18
+ - Bad-faith demands for unpaid support.
19
+
20
+ ## Enforcement
21
+
22
+ Maintainers may edit, hide, or remove comments; close issues; reject pull requests; or block users when behavior harms the project. If you need to report conduct privately, contact the maintainer through the GitHub profile for `Taz33m`.
@@ -0,0 +1,91 @@
1
+ # Contributing
2
+
3
+ Thanks for helping make `tracebook` better. This project is early alpha, so the best contributions are focused, tested, and honest about behavior.
4
+
5
+ ## Development Setup
6
+
7
+ ```bash
8
+ python -m venv venv
9
+ source venv/bin/activate
10
+ pip install -e ".[dev,dashboard]"
11
+ ```
12
+
13
+ ## Local Checks
14
+
15
+ Run these before opening a pull request:
16
+
17
+ ```bash
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
21
+ python -m pytest --cov=tracebook --cov-report=term-missing --cov-fail-under=75
22
+ python test_system.py
23
+ tracebook-benchmark --scenario smoke --duration 1 --throughput 50 --seed 1337 --warmup-seconds 0.01 --output benchmark_results/local-smoke.json
24
+ tracebook-dashboard --demo-simulation --help
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
29
+ ```
30
+
31
+ For packaging changes, also run:
32
+
33
+ ```bash
34
+ python -m build --sdist --wheel --outdir dist
35
+ python -m twine check dist/*
36
+ ```
37
+
38
+ Normalized feed adapters should emit `tracebook.MarketEvent` values and keep
39
+ venue-specific parsing, sequence checks, and assumptions outside the core replay
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.
48
+
49
+ The command reference in `docs/commands.md` is the source of truth for reviewer-facing smoke paths.
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
+
64
+ ## Pull Requests
65
+
66
+ - Keep changes scoped to one clear theme.
67
+ - Add or update tests for user-visible behavior.
68
+ - Keep performance claims tied to a reproducible benchmark command and machine context.
69
+ - Prefer public APIs under `tracebook.*`; do not reintroduce old `src/core` style imports.
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.
73
+
74
+ ## Commit Identity
75
+
76
+ GitHub contributor attribution depends on the commit author email being verified on your GitHub account. Check before committing:
77
+
78
+ ```bash
79
+ git config user.name
80
+ git config user.email
81
+ ```
82
+
83
+ ## Reporting Bugs
84
+
85
+ Please include:
86
+
87
+ - Python version and OS
88
+ - install command used
89
+ - minimal code or CLI command that reproduces the issue
90
+ - expected vs actual behavior
91
+ - relevant benchmark JSON when reporting performance regressions
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Tazeem Mahashin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,23 @@
1
+ include README.md
2
+ include LICENSE
3
+ include CHANGELOG.md
4
+ include CODE_OF_CONDUCT.md
5
+ include CONTRIBUTING.md
6
+ include PROJECT_PLAN.md
7
+ include QUICKSTART.md
8
+ include SECURITY.md
9
+ include SUPPORT.md
10
+
11
+ recursive-include docs *.md *.png
12
+ recursive-include examples *.py *.json *.jsonl *.yml
13
+ recursive-include integrations *.py *.md *.jsonl
14
+ recursive-include integrations/orderbook_rs/src *.rs
15
+ include integrations/orderbook_rs/Cargo.toml
16
+ include integrations/orderbook_rs/Cargo.lock
17
+ include integrations/orderbook_rs/rust-toolchain.toml
18
+ prune integrations/orderbook_rs/target
19
+ recursive-include tests *.py
20
+ recursive-include src/tracebook/visualization/web *.html *.css *.js
21
+ recursive-include src/tracebook/corpus/fixtures *.json *.jsonl
22
+ recursive-include src/tracebook/conformance/fixtures *.json *.jsonl
23
+ include src/tracebook/py.typed