Rust Order Book β High-performance Limit Order Book in Rust
This crate is a Rust port of one of my Node.js projects, the nodejs-order-book.
It works, but don't be surprised if it's not 100% idiomatic yetβor if some features (like conditional orders) are still missing.
They will be added over time. β
Table of Contents
Features
- π Ultra-fast (no
unsafe) implementation in pure Rust - π Suitable for HFT and exchange backtesting
- β Standard price-time priority
- π¦ Market and limit orders
- π
post-onlysupport - β³ Time in force:
GTC,IOC,FOK - π Modify & cancel orders
- π§ͺ Tested with benchmarks and coverage
Installation
Run the following Cargo command in your project directory:
Or add the following line to your Cargo.toml:
[dependencies]
rust-order-book = "0.0.1"
Usage
use ;
let mut book = new.build;
let _ = book.limit;
let _ = book.market;
let _ = book.modify;
let _ = book.cancel;
Example Output
You can easily inspect the state of the book:
println!("{}", book);
Example:
1200 -> 10
1100 -> 5
------------------------------------
900 -> 15
850 -> 5
Development
Testing
cargo test
Coverage
cargo llvm-cov
Benchmarking
cargo bench
Contributing
I would greatly appreciate any contributions to make this project better. Please make sure to follow the below guidelines before getting your hands dirty.
- Fork the repository
- Create your branch (git checkout -b my-branch)
- Commit any changes to your branch
- Push your changes to your remote branch
- Open a pull request
Donation
- USDT (TRC20):
TXArNxsq2Ee8Jvsk45PudVio52Joiq1yEe - BTC:
1GYDVSAQNgG7MFhV5bk15XJy3qoE4NFenp - BTC (BEP20):
0xf673ee099be8129ec05e2f549d96ebea24ac5d97 - ETH (ERC20):
0xf673ee099be8129ec05e2f549d96ebea24ac5d97 - BNB (BEP20):
0xf673ee099be8129ec05e2f549d96ebea24ac5d97
License
Copyright Andrea Fassina, Licensed under MIT.