QuantaMatch is a C++20 cryptocurrency matching engine with a small REST API for order entry and a WebSocket feed for market data and trades.
It implements strict price-time priority (FIFO at each price level) and supports limit, market, ioc, and fok orders.
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build buildThe app takes the config file path as the first argument:
./build/src/matching_engine_app config.yamlBy default (see config.yaml) the server starts on:
- REST:
http://localhost:8180 - WebSocket:
ws://localhost:8181
Fastest way to run tests locally:
./build/tests/matching_engine_testsIf you prefer ctest, use a generous timeout:
ctest --test-dir build --output-on-failure --timeout 600GET /healthGET /symbolsPOST /ordersGET /orders/{id}DELETE /orders/{id}GET /orders?limit=&offset=&symbol=&status=GET /bbo/{symbol}GET /book/{symbol}?depth=10GET /trades?limit=&offset=&symbol=GET /stats/{symbol}
Example order:
curl -X POST http://localhost:8180/orders \
-H "Content-Type: application/json" \
-d '{
"symbol": "BTC-USDT",
"side": "buy",
"order_type": "limit",
"price": "50000",
"quantity": "1.5"
}'Connect to ws://localhost:8181 and subscribe:
{"action":"subscribe","channel":"bbo","symbol":"BTC-USDT"}
{"action":"subscribe","channel":"depth","symbol":"BTC-USDT"}
{"action":"subscribe","channel":"trades","symbol":"BTC-USDT"}The default config is config.yaml. Ports, symbols, tick/lot sizes, logging, persistence, and fee rates are configured there.
See docs/CONFIGURATION.md for the schema and examples.
apps/ - main executable entrypoint
bench/ - benchmarks
include/ - public headers (mirrors src/)
src/ - implementation
tests/ - unit + integration tests
docs/ - architecture + API + dev/deploy guides
example/ - runnable example scripts