i25959341 / Orderbook
Licence: mit
Matching Engine for Limit Order Book in Golang
Stars: ✭ 181
Programming Languages
go
31211 projects - #10 most used programming language
Projects that are alternatives of or similar to Orderbook
Octobot
Cryptocurrency trading bot: high frequency, daily trading, social trading, ...
Stars: ✭ 706 (+290.06%)
Mutual labels: trading, exchange
Coinbasepro Python
The unofficial Python client for the Coinbase Pro API
Stars: ✭ 1,386 (+665.75%)
Mutual labels: trading, exchange
Eazebot
Free python/telegram bot for easy execution and surveillance of crypto trading plans on multiple exchanges.
Stars: ✭ 51 (-71.82%)
Mutual labels: trading, exchange
Qtbitcointrader
Secure multi crypto exchange trading client
Stars: ✭ 520 (+187.29%)
Mutual labels: trading, exchange
Coinnect
Coinnect is a Rust library aiming to provide a complete access to main crypto currencies exchanges via REST API.
Stars: ✭ 130 (-28.18%)
Mutual labels: trading, exchange
Python Poloniex
Poloniex API wrapper for Python 2.7 & 3
Stars: ✭ 557 (+207.73%)
Mutual labels: trading, exchange
Ccxt.net
CCXT.NET – CryptoCurrency eXchange Trading Library for .NET
Stars: ✭ 89 (-50.83%)
Mutual labels: trading, exchange
Ccxt
A JavaScript / Python / PHP cryptocurrency trading API with support for more than 100 bitcoin/altcoin exchanges
Stars: ✭ 22,501 (+12331.49%)
Mutual labels: trading, exchange
Tardis Node
Convenient access to tick-level real-time and historical cryptocurrency market data via Node.js
Stars: ✭ 126 (-30.39%)
Mutual labels: trading, exchange
Coinbase Pro Node
Coinbase Pro API written in TypeScript and covered by tests.
Stars: ✭ 116 (-35.91%)
Mutual labels: trading, exchange
Parity
Open source software platform for trading venues
Stars: ✭ 468 (+158.56%)
Mutual labels: trading, exchange
Socktrader
🚀 Websocket based trading bot for 💰cryptocurrencies 📈
Stars: ✭ 152 (-16.02%)
Mutual labels: trading, exchange
Tribeca
A high frequency, market making cryptocurrency trading platform in node.js
Stars: ✭ 3,646 (+1914.36%)
Mutual labels: trading, exchange
Cryptofeed
Cryptocurrency Exchange Websocket Data Feed Handler
Stars: ✭ 643 (+255.25%)
Mutual labels: trading, exchange
Wolfbot
Crypto currency trading bot written in TypeScript for NodeJS
Stars: ✭ 335 (+85.08%)
Mutual labels: trading, exchange
Crypto Trading Bot
Cryptocurrency trading bot in javascript for Bitfinex, Bitmex, Binance, FTX, Bybit ... (public edition)
Stars: ✭ 1,089 (+501.66%)
Mutual labels: trading, exchange
gemini-python
A python client for the Gemini API and Websocket
Stars: ✭ 71 (-60.77%)
Mutual labels: trading, exchange
idex-contracts-whistler
IDEX 2.0 smart contracts
Stars: ✭ 43 (-76.24%)
Mutual labels: trading, exchange
Kupi Terminal
Ccxt based, open source, customized, extendable trading platform that supports 130+ crypto exchanges.
Stars: ✭ 104 (-42.54%)
Mutual labels: trading, exchange
Roq Api
API for algorithmic and high-frequency trading
Stars: ✭ 132 (-27.07%)
Mutual labels: trading, exchange
Go orderbook
Improved matching engine written in Go (Golang)
Features
- Standard price-time priority
- Supports both market and limit orders
- Supports order cancelling
- High performance (above 300k trades per second)
- Optimal memory usage
- JSON Marshalling and Unmarsalling
- Calculating market price for definite quantity
Usage
To start using order book you need to create object:
import (
"fmt"
ob "github.com/muzykantov/orderbook"
)
func main() {
orderBook := ob.NewOrderBook()
fmt.Println(orderBook)
}
Then you be able to use next primary functions:
func (ob *OrderBook) ProcessLimitOrder(side Side, orderID string, quantity, price decimal.Decimal) (done []*Order, partial *Order, err error) { ... }
func (ob *OrderBook) ProcessMarketOrder(side Side, quantity decimal.Decimal) (done []*Order, partial *Order, quantityLeft decimal.Decimal, err error) { .. }
func (ob *OrderBook) CancelOrder(orderID string) *Order { ... }
About primary functions
ProcessLimitOrder
// ProcessLimitOrder places new order to the OrderBook
// Arguments:
// side - what do you want to do (ob.Sell or ob.Buy)
// orderID - unique order ID in depth
// quantity - how much quantity you want to sell or buy
// price - no more expensive (or cheaper) this price
// * to create new decimal number you should use decimal.New() func
// read more at https://github.com/shopspring/decimal
// Return:
// error - not nil if quantity (or price) is less or equal 0. Or if order with given ID is exists
// done - not nil if your order produces ends of anoter order, this order will add to
// the "done" slice. If your order have done too, it will be places to this array too
// partial - not nil if your order has done but top order is not fully done. Or if your order is
// partial done and placed to the orderbook without full quantity - partial will contain
// your order with quantity to left
// partialQuantityProcessed - if partial order is not nil this result contains processed quatity from partial order
func (ob *OrderBook) ProcessLimitOrder(side Side, orderID string, quantity, price decimal.Decimal) (done []*Order, partial *Order, err error) { ... }
For example:
ProcessLimitOrder(ob.Sell, "uinqueID", decimal.New(55, 0), decimal.New(100, 0))
asks: 110 -> 5 110 -> 5
100 -> 1 100 -> 56
-------------- -> --------------
bids: 90 -> 5 90 -> 5
80 -> 1 80 -> 1
done - nil
partial - nil
ProcessLimitOrder(ob.Buy, "uinqueID", decimal.New(7, 0), decimal.New(120, 0))
asks: 110 -> 5
100 -> 1
-------------- -> --------------
bids: 90 -> 5 120 -> 1
80 -> 1 90 -> 5
80 -> 1
done - 2 (or more orders)
partial - uinqueID order
ProcessLimitOrder(ob.Buy, "uinqueID", decimal.New(3, 0), decimal.New(120, 0))
asks: 110 -> 5
100 -> 1 110 -> 3
-------------- -> --------------
bids: 90 -> 5 90 -> 5
80 -> 1 90 -> 5
done - 1 order with 100 price, (may be also few orders with 110 price) + uinqueID order
partial - 1 order with price 110
ProcessMarketOrder
// ProcessMarketOrder immediately gets definite quantity from the order book with market price
// Arguments:
// side - what do you want to do (ob.Sell or ob.Buy)
// quantity - how much quantity you want to sell or buy
// * to create new decimal number you should use decimal.New() func
// read more at https://github.com/shopspring/decimal
// Return:
// error - not nil if price is less or equal 0
// done - not nil if your market order produces ends of anoter orders, this order will add to
// the "done" slice
// partial - not nil if your order has done but top order is not fully done
// partialQuantityProcessed - if partial order is not nil this result contains processed quatity from partial order
// quantityLeft - more than zero if it is not enought orders to process all quantity
func (ob *OrderBook) ProcessMarketOrder(side Side, quantity decimal.Decimal) (done []*Order, partial *Order, quantityLeft decimal.Decimal, err error) { .. }
For example:
ProcessMarketOrder(ob.Sell, decimal.New(6, 0))
asks: 110 -> 5 110 -> 5
100 -> 1 100 -> 1
-------------- -> --------------
bids: 90 -> 5 80 -> 1
80 -> 2
done - 2 (or more orders)
partial - 1 order with price 80
quantityLeft - 0
ProcessMarketOrder(ob.Buy, decimal.New(10, 0))
asks: 110 -> 5
100 -> 1
-------------- -> --------------
bids: 90 -> 5 90 -> 5
80 -> 1 80 -> 1
done - 2 (or more orders)
partial - nil
quantityLeft - 4
CancelOrder
// CancelOrder removes order with given ID from the order book
func (ob *OrderBook) CancelOrder(orderID string) *Order { ... }
CancelOrder("myUinqueID-Sell-1-with-100")
asks: 110 -> 5
100 -> 1 110 -> 5
-------------- -> --------------
bids: 90 -> 5 90 -> 5
80 -> 1 80 -> 1
done - 2 (or more orders)
partial - nil
quantityLeft - 4
License
The MIT License (MIT)
See LICENSE and AUTHORS files
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].