7 releases

0.1.7 Jan 30, 2019
0.1.6 Jan 17, 2019
0.1.4 Sep 26, 2018

#247 in Data structures

Download history 3/week @ 2019-01-20 10/week @ 2019-01-27 4/week @ 2019-02-03 1/week @ 2019-02-10 7/week @ 2019-02-17 3/week @ 2019-02-24 14/week @ 2019-03-03 26/week @ 2019-03-10 2/week @ 2019-03-17 82/week @ 2019-03-24 3/week @ 2019-03-31 9/week @ 2019-04-07 1/week @ 2019-04-14 9/week @ 2019-04-21 2/week @ 2019-04-28

61 downloads per month

MIT/Apache

14KB
315 lines

Build Status Crates.io Docs.rs

orderbook-rs

I did this orderbook in addition to https://github.com/inv2004/coinbase-pro-rs

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

Dependencies

~1MB
~12K SLoC