This Python project provides a real-time visualization of the order book for the BTCUSDT trading pair on the Binance exchange using WebSocket technology. It allows traders to monitor live market dynamics and make informed trading decisions.
It’s a part of Trading Framework project which you can get at https://quantjourney.substack.com/
Event
: Represents a market event with timestamp, sequence number, trade indicator, buy/sell indicator, price, and size.Level
: Represents a price level in the order book with price and size.OrderBook
: Represents the order book and maintains the current state of bids and asks. Provides methods to update the order book and retrieve relevant information.WebSocketHandler
: Handles the WebSocket connection to the Binance server, subscribes to order book updates, and processes received messages.RealTimePlotter
: Visualizes the order book using Matplotlib, updating the plot in real-time based on the data received from the WebSocket connection.matplotlib
, websocket-client
, seaborn
, sortedcontainers
.run_unit_test
function with the desired unit test, e.g., run_unit_test(UnitTests.REALTIME_PLOT)
.This project serves as a mid-step towards integrating with the CCXT (CryptoCurrency eXchange Trading) library, enabling traders to access various cryptocurrency exchanges and perform advanced analysis and trading strategies.
Demo Video
For a full demonstration of the real-time order book visualization, watch the video below:
Watch the Real-Time Order Book Visualization
This project is open-source and available under the MIT License.