Minimalist real-time order book interactions with Binance and Kraken.
- Platforms: Linux or MacOS
- Python: 3.11+
- Rust: 1.81+
# Rust development
cargo install justThis repository contains multiple implementations of a real-time order book interactions:
- Binance with Python → Web-based version (Binance Python README)
- Binance with Rust → Terminal-based version (Binance Rust README)
- Kraken with Python → Kraken testnet (Kraken Python README)
The Binance implementations display:
- OHLC market data, 24h volumes and spread
- Order book with bids (green) and asks (red)
- Recent trades with timestamps
To explore the project, follow this sequence:
Before using the applications, you can fetch Binance and Kraken data manually:
# REST API (requires curl and jq)
curl -s "https://api.binance.com/api/v3/depth?symbol=BTCUSDT&limit=10" | jq
# WebSocket (live data)
cargo install websocat
websocat "wss://stream.binance.com:9443/ws/btcusdt@trade"# REST API (requires curl and jq)
curl -X GET "https://demo-futures.kraken.com/derivatives/api/v3/tickers" | jq
# WebSocket (live data)
websocat -E wss://demo-futures.kraken.com/ws/v1
# Send a subscription message:
echo '{ "event":"subscribe", "feed":"ticker", "product_ids":["PI_XRPUSD"] }' | websocat -E wss://demo-futures.kraken.com/ws/v1The Python project has multiple branches with increasing functionality:
mainbranch → Displays a non-interactive order book with real-time data.market-orderbranch → Adds support for placing market orders with an initial balance.limit-orderbranch → Further extendsmarket-order, allowing limit orders as well.
Start by checking out the main branch and progress through the others.
For a terminal-based experience, explore the Rust project, which provides real-time order book visualization in a CLI environment.
Aside from the Binance implementations, this repository also explores the Kraken testnet integration, allowing users to:
- Fetch market data and subscribe to live WebSocket updates.
- Place orders programmatically using Kraken's demo environment.
- Experiment with trading strategies using a simulated balance.
Refer to the Kraken Python README for more details on interacting with Kraken's testnet.