Rust双轨加密匹配引擎 (Apache-2.0). 伴行于lanpishu6300/cypto交换.
High-performance cryptocurrency matching engines in Rust for contract (and spot) exchange paths — dual-track design with a Java-equivalent core and an experimental low-latency core.
Inspired in layout and packaging by perpetual_exchange / crypto-exchange (C++ R&D), while targeting Topic/JSON-compatible cutover against live Java services. Companion repository to that project.
License: Apache License 2.0
中文: README.zh-CN.md
Wiki: English · 中文
match-core)java-contract-match observablesmatch-replaymatch-core-hp)price_tick / qty_lot--features art)match-wal)match-contract)/healthz /readyz /metrics (Prometheus / OTel-aligned names)--features hp-engine for hp workers + L2/L3/L1 span counters…| Crate | Role | Production default |
|---|---|---|
match-protocol |
Shared order DTOs / checks | — |
match-core |
Equivalence engine | Yes |
match-core-hp |
HP experimental engine | No |
match-contract |
Contract process shell | uses match-core |
match-spot |
Spot shell (stub) | — |
match-replay |
Golden replay CLI | — |
match-bench |
Criterion + fair_compare |
— |
match-wal |
Async batched WAL | experimental |
rust-toolchain.toml)git clone https://github.com/lanpishu6300/match-rust.git
cd match-rust
cargo test --workspace
# or
make test
make ci # fmt + clippy + tests + art + fair_compareexport MATCH_CONTRACT_CONFIG=crates/match-contract/config.example.yaml
export MATCH_CONTRACT_LOCAL_SYMBOLS=btcusdt
cargo run -p match-contract
# make run-localHealth (default port 31015):
| Path | Meaning |
|---|---|
GET /healthz |
Process up |
GET /readyz |
Bootstrap finished |
GET /metrics |
Prometheus counters |
Fair microbench (fill_rate must be > 0 — rejects zero-fill “fake peaks”):
make fair
# cargo run -p match-bench --release --bin fair_compare -- --n 50000Criterion suite:
make benchART parity:
make test-artWAL throughput:
make wal-benchPublished numbers and methodology: bench-results (中文), fair-compare (中文), e2e-budget (中文).
End-to-end latency is usually dominated by MQ/JSON (L4), not the L1 microkernel. See the e2e budget doc before chasing nanoseconds.
| Doc | Description |
|---|---|
| Wiki Home (EN) / Wiki 首页(中文) | Getting started, FAQ, roadmap |
| Full docs index · 中文 | Specs, plans, ops |
| Architecture notes · 中文 | Crate map & dual-track rules |
| Equivalence design · 中文 | Protocol / cutover |
| HP design · 中文 | Fixed-point / price-level |
| PE optimizations · 中文 | Cache / ART / wal A→B→C |
| Coverage policy · 中文 | 100% branch gate (protocol/core/hp) |
| OSS best practices · 中文 | Disruptor / Aeron / Seastar mapping |
| Cutover runbook · 中文 | Per-symbol grey release |
| RMQ spike · 中文 | RocketMQ status |
See crates/match-contract/config.example.yaml.
RocketMQ production adapter is not wired yet (transport: memory). Details: docs/rmq-spike.md.
docker build -t match-rust:local .
docker run --rm -p 31015:31015 \
-e MATCH_CONTRACT_LOCAL_SYMBOLS=btcusdt \
match-rust:localCONTRIBUTING.md · CONTRIBUTING.zh-CN.md SECURITY.md · SECURITY.zh-CN.md · CODE_OF_CONDUCT.md · CODE_OF_CONDUCT.zh-CN.md · SUPPORT.md · SUPPORT.zh-CN.md CHANGELOG.md · CHANGELOG.zh-CN.md — version history .github/workflows/ci.yml · coverage gate: make cov .github/ISSUE_TEMPLATE/Suggested release tags: v0.1.0, v0.2.0, …
| Area | Status |
|---|---|
match-core equivalence |
In progress / golden replay |
match-core-hp |
Usable experimental |
match-contract shell |
Memory transport; RMQ TBD |
| Spot shell | Stub |
| Production default engine | match-core only |
java-contract-match, java-spot-matchcrypto-exchange) ART / persistence research暂无开放 Issues,或尚未同步最近议题。