orderbook
Version, currently 0.1.01 version
- 0.1.0latestMar 27, 2022
github.com/nolantait/orderbook.cr
An event driven orderbook for algotrading written in Crystal
2 stars
0 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
orderbook:
github: nolantait/orderbook.cr
version: ~> 0.1.0Then run:
shards installshard.yml
- Crystal
1.3.2- License
- MIT
- Author
- Nolan J Tait
Dependencies
Runtime Dependencies
- event_handler~> 1.0github: crystallabs/event_handler
README
Orderbook
An extensible limit order book model written in Crystal.
Designed to be used in live trading and backtesting market making strategies.
It uses the Dense Tick Format for all ticks and orders in an effort to keep the API somewhat uniform.
Installation
-
Add the dependency to your
shard.yml:dependencies: orderbook: github: nolantait/orderbook.cr -
Run
shards install
Usage
require "orderbook"
require "big"
Orderbook.run do |book|
book.on Orderbook::LimitOrderFilled do |order|
puts "ORDER FILLED"
end
sell_order = Orderbook::LimitOrder.new(
id: "1",
is_bid: false,
quantity: BigDecimal.new(0.5),
price: BigDecimal.new(0.1)
)
tick = Tick.new(
timestamp: 123456,
is_trade: true,
is_bid: true,
price: BigDecimal.new(0.1),
quantity: BigDecimal.new(1)
)
book.add_order sell_order
book.emit tick
end
OR you could initialize the book yourself without a block:
book = Orderbook.build
# Do stuff from above here
Running either would print "ORDER FILLED"
Development
shards install and then crystal specs
Contributing
- Fork it (https://github.com/nolantait/orderbook/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Nolan J Tait - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.0- Tagged
- Mar 27, 2022
- Commit
50f3b691f9e7- Crystal
1.3.2- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/nolantait/orderbook.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 14, 2026
- Synced
- Aug 14, 2026
- Versions
- 1