AI Decision System
Replayable, offline-verifiable records for AI-assisted go/no-go decisions: experiment promotions, typed model answers and human-approved actions.
A deterministic matching engine in Rust, running in your browser through WebAssembly.
Translation pending
Developer toolsRust · JavaScriptGitHub @ult666666OnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
No updates detected yet. GitHub releases will appear here.
Owners of public repositories under a personal GitHub account can sign in to verify ownership and manage the introduction themselves. No administrator approval is needed.
Sign in, generate a verification file, and commit it to this repository’s default branch within 30 minutes. Files on other branches or forks do not count. Then check the file below to manage the project without administrator approval. Keep the file to retain your access.
If needed, you will go to sign-in. After signing in, return here and press your chosen verification button again.
Run /nomorevibe verify in your project folder to verify ownership and manage the introduction yourself.
Verify in one minuteAsk about other verification options
A deterministic Rust limit order book and matching engine with price-time priority, differential testing and a WebAssembly playground. Synthetic data; no market connectivity.
Taken from the repository README
Loading the full README.
Read the full 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.