Trading system for Binance (spot and futures)
Project Description:
A highly reliable trading bot has been developed with full automation of operations on the Binance cryptocurrency exchange. The system supports both spot trading and futures trading, with a primary focus on working with futures (default mode - isolated margin, 1x leverage).
Main components of the system:
1. API Integration
Classes BinanceAPI and BinanceFuturesAPI for working with the Binance REST API.
Limit and delay control system (ApiRateLimiter).
Request signing, price collection, and historical data gathering.
Protection against exceeding limits through request frequency management.
2. Trading Bot
The TradingBot class manages the entire trading process.
Support for working with multiple trading pairs simultaneously.
Position management, operation history, logging.
Integration with Telegram for real-time notifications.
3. Configuration Module
Strategy parameters (TP_PERCENT, MOVE_PERCENT, etc.).
API limit settings, paths to logs and databases.
Flexible management of position averaging and parallel processing.
Functional features:
Risk management:
Risk limit per position (default 1%).
Maximum number of simultaneously open positions - 100.
Automatic averaging mechanism during drawdowns.
Working with Binance API:
Intelligent request frequency management.
Time synchronization with exchange servers.
Error handling and automatic retries on failures.
Parallel trading:
Multithreading for simultaneous work with assets.
Load control and operation queues.
Integration with database (MySQL):
Storage of all trading operations and position states.
Notifications via Telegram:
Alerts about trades, errors, and important events.
Additionally:
Support for working with a predefined list of trading pairs specified in assets.json. The bot is fully autonomous and designed for round-the-clock trading with minimal user involvement.
The project is developed with a focus on scalability, fault tolerance, and extensibility - ready for the implementation of complex strategies and integration with analytics systems.
Web Management Interface:
A full-fledged web interface is implemented based on HTML templates and provides intuitive system management through a browser.
Main pages:
Main control panel for the bot.
Displays active positions, current trades, key metrics, and visualizations (charts, diagrams).
Contains elements for real-time strategy parameter settings.
Home page of the interface.
Introductory information about the system and navigation through main sections.
Detailed built-in documentation.
Instructions for setup, management, trading strategies, and configuration.
One of the most comprehensive and informative components of the interface.
Toolkit for planning trading strategies.
Ability to customize, test, and save individual trading plans.
Administrative panel with access to advanced settings.
Provides user and access management functions.
Error display template with detailed diagnostics and recommendations.
Binance API key management interface.
Adding, editing, and deleting keys, validation, and connection testing.
Unified components and templates for reuse in different sections of the interface.
Advantages of the web interface:
Full control over the trading process through a browser.
Support for real-time monitoring.
Interactive strategy and parameter configuration.
API key management without manual file editing.
Built-in documentation for convenience and offline use.
A highly reliable trading bot has been developed with full automation of operations on the Binance cryptocurrency exchange. The system supports both spot trading and futures trading, with a primary focus on working with futures (default mode - isolated margin, 1x leverage).
Main components of the system:
1. API Integration
Classes BinanceAPI and BinanceFuturesAPI for working with the Binance REST API.
Limit and delay control system (ApiRateLimiter).
Request signing, price collection, and historical data gathering.
Protection against exceeding limits through request frequency management.
2. Trading Bot
The TradingBot class manages the entire trading process.
Support for working with multiple trading pairs simultaneously.
Position management, operation history, logging.
Integration with Telegram for real-time notifications.
3. Configuration Module
Strategy parameters (TP_PERCENT, MOVE_PERCENT, etc.).
API limit settings, paths to logs and databases.
Flexible management of position averaging and parallel processing.
Functional features:
Risk management:
Risk limit per position (default 1%).
Maximum number of simultaneously open positions - 100.
Automatic averaging mechanism during drawdowns.
Working with Binance API:
Intelligent request frequency management.
Time synchronization with exchange servers.
Error handling and automatic retries on failures.
Parallel trading:
Multithreading for simultaneous work with assets.
Load control and operation queues.
Integration with database (MySQL):
Storage of all trading operations and position states.
Notifications via Telegram:
Alerts about trades, errors, and important events.
Additionally:
Support for working with a predefined list of trading pairs specified in assets.json. The bot is fully autonomous and designed for round-the-clock trading with minimal user involvement.
The project is developed with a focus on scalability, fault tolerance, and extensibility - ready for the implementation of complex strategies and integration with analytics systems.
Web Management Interface:
A full-fledged web interface is implemented based on HTML templates and provides intuitive system management through a browser.
Main pages:
Main control panel for the bot.
Displays active positions, current trades, key metrics, and visualizations (charts, diagrams).
Contains elements for real-time strategy parameter settings.
Home page of the interface.
Introductory information about the system and navigation through main sections.
Detailed built-in documentation.
Instructions for setup, management, trading strategies, and configuration.
One of the most comprehensive and informative components of the interface.
Toolkit for planning trading strategies.
Ability to customize, test, and save individual trading plans.
Administrative panel with access to advanced settings.
Provides user and access management functions.
Error display template with detailed diagnostics and recommendations.
Binance API key management interface.
Adding, editing, and deleting keys, validation, and connection testing.
Unified components and templates for reuse in different sections of the interface.
Advantages of the web interface:
Full control over the trading process through a browser.
Support for real-time monitoring.
Interactive strategy and parameter configuration.
API key management without manual file editing.
Built-in documentation for convenience and offline use.