Gemmy
My goal with writing gemmy is to create a useful, and production ready high performance orderbook written in rust.
For now the work is ongoing, and the implementation is bound to be full of bugs. I will be adding more to this readme as I keep doing more.
To Dos
- Add exhaustive integration tests.
- Add unit tests for a few remaining methods.
- Complete the documentation of code.
- Replace this readme with a summary of everything.
- Publish the crate.
- Add stats tracking (volume, last_trade, etc.)
Usage
To add the crate to the project just run
Using gemmy is pretty straightforward, you can use this example as a test.
The following is the output of the above snippet.
// ask order created
created_order: LimitOrder {
id: 1,
price: 100,
quantity: 100,
side: Ask,
}
// orderbook state
min_ask: 100
depth: Depth {
levels: 1,
bids: [],
asks: [
Level {
price: 100,
quantity: 100,
},
],
}
// market bid filled
order_fills: [
FillMetaData {
order_id: 2,
matched_order_id: 1,
taker_side: Bid,
price: 100,
quantity: 50,
},
]
// orderbook state
depth: Depth {
levels: 1,
bids: [],
asks: [
Level {
price: 100,
quantity: 50, // a fill of 50 reflected
},
],
}
// a new bid side limit order placed at a lower price than ask
created_order: LimitOrder {
id: 3,
price: 50,
quantity: 100,
side: Bid,
}
// orderbook state
max_bid: 50
depth: Depth {
levels: 1,
bids: [
Level {
price: 50,
quantity: 100,
},
],
asks: [
Level {
price: 100,
quantity: 50,
},
],
}