AI Decision System
Replayable, offline-verifiable records for AI-assisted go/no-go decisions: experiment promotions, typed model answers and human-approved actions.
翻译准备中
尚未检测到更新。GitHub 发布版本后会显示在这里。
个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
在项目文件夹中运行 /nomorevibe verify,即可验证所有权并自行管理介绍。
一分钟完成验证A deterministic Rust limit order book and matching engine with price-time priority, differential testing and a WebAssembly playground. Synthetic data; no market connectivity.
翻译准备中
取自仓库 README
正在加载完整 README。
查看完整 README ↗A limit order book and matching engine in Rust: price-time priority, the order types real venues use, and a deterministic event stream, checked against a second implementation and compiled to WebAssembly so it runs in your browser.
Open the playground: place orders against a live book, step through guided scenarios, and run a million synthetic orders in your browser. The case study walks through the design, the testing and the results.
unsafe code.| Throughput, one core, synthetic flow | 15 to 16 million commands per second |
| Latency per command, p50 / p99 / p99.9 | 64 ns / 196 ns / 477 ns |
| Same session compiled to WebAssembly (Node.js) | about 8.3 million commands per second, with the same event digest and state hash as the native build |
| Differential tests against the reference model | 1,024 random command streams per local run, 4,096 in CI, plus a one-million-command check |
| Mutation testing (cargo-mutants) | 140 of 148 compiling mutants caught. Of the 8 survivors, 4 are now covered by new assertions, 2 pointed at redundant code that was deleted, and 2 only drop a capacity hint |
Measured on a 2.1 GHz Intel Xeon cloud VM, one pinned core, Rust 1.97 (medians of three seeds, 5 million commands each) with the commands in docs/BENCHMARKS.md. The matching core only: no network, parsing or persistence on the timed path.
Needs Rust 1.88 or newer.
git clone https://github.com/ult666666/crossbook
cd crossbook
cargo run --release -p crossbook-cli -- demo
The demo walks through a short session:
# A buy for 8 @ 101 takes the better price first, then the older order at 101
accepted #4 buy 8 @ 101
trade 5 @ 100 (taker #4, maker #3)
trade 3 @ 101 (taker #4, maker #1)
# Fill-or-kill for 20 cannot fill in full, so it is rejected and nothing changes
rejected #5: fill-or-kill order cannot fill in full
Other commands:
cargo run --release -p crossbook-cli -- bench --orders 5000000 # throughput and latency
cargo run --release -p crossbook-cli -- verify --orders 1000000 # fast engine vs reference model
cargo run --release -p crossbook-cli -- gen --out flow.xbk # write a binary command journal
cargo run --release -p crossbook-cli -- replay flow.xbk # replay it and print fingerprints
cargo test --workspace # all tests
use crossbook::{Command, Engine, Event, NewOrder, Side, TimeInForce};
let mut engine = Engine::new();
let mut events = Vec::new();
engine.process(&Command::New(NewOrder::limit(1, Side::Sell, 100, 10)), &mut events);
engine.process(
&Command::New(NewOrder::limit(2, Side::Buy, 100, 15).tif(TimeInForce::Ioc)),
&mut events,
);
// The IOC buy fills 10 lots and cancels the other 5 instead of resting.
assert!(engine.is_empty());
for event in &events {
println!("{event}");
}
Details: docs/TESTING.md.
Price levels sit in one BTreeMap per side, so the best price is the first or last key.
Each level is a FIFO queue threaded through a single slab of 48-byte order nodes with
u32 links, which makes cancel O(1) after the id lookup and reuses memory as orders come
and go. The engine never reads a clock or a random number generator and never iterates a
hash map, which is what makes it deterministic. Design notes, costs and the alternatives
considered: docs/DESIGN.md.
| Path | Contents |
|---|---|
crates/crossbook | The engine, the reference model, binary codec, journal, synthetic flow, tests and benchmarks |
crates/crossbook-cli | The crossbook command: demo, bench, verify, gen, replay |
crates/crossbook-wasm | WebAssembly bindings used by the playground |
web/ | The browser playground (static HTML, CSS and JavaScript) |
docs/ | Semantics, design, testing and benchmark notes |
crossbook is a learning and benchmarking project, not an exchange. It handles one instrument in memory, has no network gateway, and runs only on synthetic data. It is not connected to any market. Developed with AI assistance; the tests, CI checks and benchmark commands above are the evidence for each claim in this README.