All Projects → hroptatyr → clob

hroptatyr / clob

Licence: other
Simple limit order book and matching engine.

Programming Languages

c
50402 projects - #5 most used programming language
M4
1887 projects
Makefile
30231 projects
Roff
2310 projects

Projects that are alternatives of or similar to clob

roq-samples
How to use the Roq C++20 API for Live Cryptocurrency Algorithmic and High-Frequency Trading as well as for Back-Testing and Historical Simulation
Stars: ✭ 119 (+600%)
Mutual labels:  order-book, matching-engine
ITCH
Nasdaq Order Book Reconstructor
Stars: ✭ 146 (+758.82%)
Mutual labels:  order-book
gome
gome- Golang Match Engine, uses Golang for calculations, gRPC for services, ProtoBuf for data exchange, RabbitMQ for queues, and Redis for cache implementation of high-performance matching engine microservices/ gome-高性能撮合引擎微服务
Stars: ✭ 47 (+176.47%)
Mutual labels:  matching-engine
matching-engine
Superfast Matching Engine written in golang
Stars: ✭ 35 (+105.88%)
Mutual labels:  matching-engine
dingir-exchange
A high performance crypto trading engine
Stars: ✭ 169 (+894.12%)
Mutual labels:  matching-engine
orderbook-rs
Basic order matching engine written in Rust
Stars: ✭ 276 (+1523.53%)
Mutual labels:  matching-engine
pytradesimulator
Python based exchange simulator using FIX protocol
Stars: ✭ 20 (+17.65%)
Mutual labels:  matching-engine
adamant-tradebot
Free market-making software for cryptocurrency projects and exchanges. Makes trade volume, maintains spread and liquidity/depth, set price range, and builds live-like dynamic order book.
Stars: ✭ 113 (+564.71%)
Mutual labels:  order-book
redis-matching-engine-server
Implement exchange matching engine by lua script, run in redis
Stars: ✭ 39 (+129.41%)
Mutual labels:  matching-engine

clob

A central limit order book designed to support several market models (uncrossing schemes). Emphasis is on high throughput.

Red tape

  • licensed under BSD3c
  • dependencies: POSIX system, C11 compiler with DFP754 decimal support

Features

  • b+tree based central limit order book
  • pluggable uncrossing schemes
  • market models: auction, continuous trading
  • IEEE-754 decimals
  • handles ~360 auctions with 10000 orders each per second
  • handles ~6M orders per second in continuous trading mode
  • thrice the performance when double is used instead of _Decimal64

Motivation

In academia, we want to study crossed books and the orders that caused them, or gain insight on the effects of walls of stop orders on liquidity, or simply study new order types or schemes of uncrossing.

Off-the-shelf products are mostly unsuitable for academic studies.

Not only do they often lack support for a batch mode, they also tightly couple their order book implementation and uncrossing scheme, a bundle known as matching engine, that allows orders or trades to cut corners under the label of latency or high performance.

In many cases, it is impossible to extend the functionality of a matching engine, e.g. to implement the semantics of mid-point orders or stop orders, or dark liquidity, etc. Nearly all attempts end up in changing the existing implementation considerably, or, worse, putting a second implementation to the side of the existing one with no synergy between them.

This prompted us to write clob, a simple matching engine that's flexible enough to serve our studies.

Patterns

A book for continuous auctions:

while (1) {
        next = next_auction();

        do {
                clob_ord_t ord = read_order();
                clob_oid_t oid = clob_add(book, ord);
                send_confirmation(oid);
        } while (time(NULL) < next);

        mmod_auc_t A = mmod_auction(book);
        unxs_auction(book, A.prc, A.qty);
        send_executions(book);
}

Routines next_auction, read_order, send_confirmation and send_executions would have to be written.

A book for continuous trading:

while (1) {
        clob_ord_t ord = read_order();

        /* see if order crosses book */
        ord = unxs_order(book, ord);

        if (ord.qty.dis + ord.qty.hid > 0.dd) {
                /* put remainder of order into book */
                clob_oid_t oid = clob_add(book, ord);
                send_confirmation(oid);
        }

        send_executions(book);
        send_quotes(book);
}

where additionally send_quotes would have to be written to disseminate updated quotes. Continuous trading and continuous auction can freely be mixed as well.

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].