A fast and performant limit order book in Python utilizing a Rust backend. Install it with
pip install litebook
Get started with litebook using the following example:
import litebook as lb
# Create an OrderBook
orderbook = lb.OrderBook(tick_size=0.01)
# Create some orders (this not _add_ the order!)
buy_order = book.create_order(lb.OrderType.Buy, price=10.05, quantity=10.0)
sell_order = book.create_order(lb.OrderType.Sell, price=10.05, quantity=5.0)
# Add the orders (this returns a list of Fill objects)
_no_fills = book.add(buy_order)
fills = book.add(sell_order)
# Check the fill
print(fill)
# Check the status of the remainder of the open buy order
# DO NOT rely on the previous `buy_order` or `sell_order` objects
# to be updated! Fetch them from the book, instead
open_buy_order = orderbook.get_order(buy_order.id)
Please open an issue if you need help or have a feature request.