$ show 51bitquant/binance_grid_trader
Binance Grid Trader is a cryptocurrency trading bot that implements grid trading strategies for Binance Spot and Futures markets. The application features a modular architecture with separate layers for exchange gateways, event processing, strategy management, and user interface. It provides both a graphical interface built with PyQt5 and script-based execution modes for running trading strategies without UI. The system connects to Binance via REST and WebSocket APIs to receive market data and execute trades based on configurable grid strategies.
The LLM identified 4 files worth highlighting for reuse:
Contains essential utility functions for JSON handling and precise decimal arithmetic operations critical for financial applications. The round_to and floor_to functions properly handle floating-point precision issues in trading calculations, demonstrating non-obvious skill in financial computing.
Defines core trading data structures (TickData, OrderData, TradeData, etc.) and includes a sophisticated GridPositionCalculator class that accurately computes average position prices during complex trading scenarios including long/short position transitions. These objects are well-encapsulated and could be reused in other trading systems.
Implements a clean, thread-safe event-driven architecture with proper event queuing, handler registration, and timer event generation. The EventEngine class demonstrates strong engineering practices in concurrent programming and could be extracted for use in any application requiring event-based communication.
Provides the CtaTemplate abstract base class that defines a clean interface for trading strategies. It encapsulates common strategy functionality like order placement methods and lifecycle callbacks, demonstrating good separation of concerns between strategy logic and engine mechanics.