https://github.com/inv2004/orderbook-rs
OrderBook implementation in rust
https://github.com/inv2004/orderbook-rs
coinbase exchange orderbook rust
Last synced: 6 months ago
JSON representation
OrderBook implementation in rust
- Host: GitHub
- URL: https://github.com/inv2004/orderbook-rs
- Owner: inv2004
- License: apache-2.0
- Created: 2018-09-05T01:15:36.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-04-27T20:03:41.000Z (over 5 years ago)
- Last Synced: 2025-03-29T02:45:30.959Z (7 months ago)
- Topics: coinbase, exchange, orderbook, rust
- Language: Rust
- Homepage:
- Size: 35.2 KB
- Stars: 26
- Watchers: 5
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/inv2004/orderbook-rs)
[](https://crates.io/crates/orderbook)
[](https://docs.rs/orderbook)# orderbook-rs
I did this orderbook in addition to
*Its primitive orderbook with hardcoded minimal step to 1 cent.*
For performance I put it in flat array, that is why it uses memory actively.
For current coinbase BTC-USD pair it takes 188.1 Mb or RAM.It has hardcoded limit for 20000(max price) * 100(cents) = 2*10^6 values it can store.
Call the OB with values which are outside these boundaries will return None,
but, I suppose, this return can be ignored in most cases.It implements Display with the following output:
```
OB: sized of top 20 bids in 1-cent step | bid-price ask-price | sizes of low 20 asks in 1-cent step
OB: 0,0,0,0,0,0,0,0.001,0,0,0,0,0,0,0,0,0,0,0,5.5,26.047638720000013 | 6494.98 6494.99 | 5.006541749999999,10.0838,0,0,0,0,0,0,0.00130864,0.0052,0,0,0,0,0,0,0,0,0,0,0
```## Examples
- Coinbase orderbook with reload if sequence is missed: