Crates.io | rust-order-book |
lib.rs | rust-order-book |
version | 0.0.2 |
created_at | 2025-08-29 08:22:51.962428+00 |
updated_at | 2025-08-29 19:00:27.145431+00 |
description | A Rust Lmit Order Book for high-frequency trading (HFT). |
homepage | https://github.com/fasenderos/rust-order-book |
repository | https://github.com/fasenderos/rust-order-book |
max_upload_size | |
id | 1815528 |
size | 149,125 |
Ultra-fast Rust Limit Order Book for high-frequency trading (HFT) :rocket::rocket: :star: Star me on GitHub β it motivates me a lot!
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. β
unsafe
) implementation in pure Rustpost-only
supportGTC
, IOC
, FOK
Run the following Cargo command in your project directory:
cargo add rust-order-book
Or add the following line to your Cargo.toml
:
[dependencies]
rust-order-book = "0.0.1"
use rust_order_book::{LimitOrderOptions, MarketOrderOptions, OrderBookBuilder, Side};
let mut book = OrderBookBuilder::new("BTCUSD").build();
let _ = book.limit(LimitOrderOptions {
side: Side::Buy,
quantity: 100,
price: 50,
time_in_force: None,
post_only: None,
});
let _ = book.market(MarketOrderOptions {
side: Side::Sell,
quantity: 50,
});
let _ = book.modify(1, 60, None);
let _ = book.cancel(1);
You can easily inspect the state of the book:
println!("{}", book);
Example:
1200 -> 10
1100 -> 5
------------------------------------
900 -> 15
850 -> 5
cargo test
cargo llvm-cov
cargo bench
I would greatly appreciate any contributions to make this project better. Please make sure to follow the below guidelines before getting your hands dirty.
TXArNxsq2Ee8Jvsk45PudVio52Joiq1yEe
1GYDVSAQNgG7MFhV5bk15XJy3qoE4NFenp
0xf673ee099be8129ec05e2f549d96ebea24ac5d97
0xf673ee099be8129ec05e2f549d96ebea24ac5d97
0xf673ee099be8129ec05e2f549d96ebea24ac5d97
Copyright Andrea Fassina, Licensed under MIT.