orderbook

An order book implementation in Crystal.

OrderBook

A simple orderbook written in crystal. It currently supports FIFO matching.

Usage

# create a book
orderbook = OrderBook::Book.new

# add orders
order_1 = OrderBook::Order.new(OrderBook::Type::SELL, OrderBook::OrderType::LIMIT, 5, 100.5)
order_2 = OrderBook::Order.new(OrderBook::Type::BUY, OrderBook::OrderType::LIMIT, 10, 100.5)
order_3 = OrderBook::Order.new(OrderBook::Type::SELL, OrderBook::OrderType::MARKET, 5)
orderbook << order_1
orderbook << order_2
orderbook << order_3

# display bids
orderbook.disp_bids

# display asks
orderbook.disp_asks

Contributing

  1. Fork it (https://github.com/unullable/orderbook/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Repository

orderbook

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 0
  • 21 days ago
  • November 5, 2025
License

MIT License

Links
Synced at

Thu, 27 Nov 2025 04:27:42 GMT

Languages