-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Welcome to the official wiki for the ByBit Trading Bot! This document serves as the central hub for all documentation related to the project.
- Introduction
- Features
- Architecture
- Installation Guide
- Configuration
- Usage
- Trading Strategy
- Telegram Bot Commands
- Troubleshooting
- FAQ
- Contributing
- License
The ByBit Trading Bot is an automated trading solution that implements advanced technical analysis strategies, focusing on the ZigZag pattern recognition algorithm similar to TradingView's implementation. The bot is designed to work with the ByBit cryptocurrency exchange and features a user-friendly PyQt6 interface along with Telegram integration for remote monitoring and control.
- ZigZag Pattern Recognition: Identifies significant market turning points
- Multi-timeframe Analysis: Scans multiple timeframes for confirmation
- Fibonacci Retracement: Calculates key levels for entry and exit points
- Real-time Market Scanning: Continuously monitors the market for opportunities
- Risk Management: Implements stop-loss and take-profit strategies
- Modern PyQt6 Interface: Clean and responsive design
- Real-time Monitoring: Track bot performance and market conditions
- Trading Dashboard: View open positions, P&L, and trading history
- Configuration Panel: Easily adjust trading parameters
- ByBit API Integration: Direct connection to ByBit exchange
- Telegram Bot: Remote monitoring and control
- Automated Trading: Execute trades based on predefined strategies
bybit_bot_v4/
โโโ a_view/ # User interface components
โ โโโ view.py # Main window and UI components
โโโ b_controller/ # Application logic
โ โโโ controller.py # Main controller and business logic
โโโ c_service/ # Core services
โ โโโ a_bybit.py # ByBit API interactions
โ โโโ b_strategy.py # Trading strategies
โ โโโ c_scanner.py # Market scanner
โ โโโ d_telegram.py # Telegram bot
โ โโโ e_transaction.py # Trade execution
โ โโโ f_signal.py # Signal processing
โโโ d_model/ # Data models
โ โโโ b_bybit.py # ByBit data models
โ โโโ d_telegram.py # Telegram data models
โ โโโ e_message.py # Message handling
โ โโโ f_log.py # Logging system
โโโ main.py # Application entry point
- Market Data Collection: Fetches real-time market data from ByBit
- Signal Generation: Analyzes data using ZigZag and other technical indicators
- Decision Making: Determines trading actions based on strategy
- Order Execution: Places trades on ByBit exchange
- Monitoring: Trades are monitored and managed according to strategy
- Notification: Sends updates via Telegram
- Python 3.8 or higher
- pip (Python package manager)
- Git
-
Clone the repository
git clone https://github.com/beydah/ByBit-Scanner-Bot.git cd ByBit-Scanner-Bot -
Create and activate a virtual environment
# Windows python -m venv venv .\venv\Scripts\activate # Unix or MacOS python3 -m venv venv source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Configure the bot
- Copy
.env.exampleto.env - Update the values in
.envwith your configuration
- Copy
Create a .env file in the root directory with the following variables:
# ByBit API
BYBIT_API_KEY=your_api_key_here
BYBIT_API_SECRET=your_api_secret_here
BYBIT_TESTNET=false # Set to true for testing
# Telegram Bot
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
ADMIN_CHAT_IDS=123456789,987654321 # Comma-separated list of admin chat IDs
# Trading Parameters
TRADING_PAIR=BTCUSDT
TRADE_AMOUNT=10 # USDT amount per trade
LEVERAGE=10
STOP_LOSS_PERCENT=2
TAKE_PROFIT_PERCENT=4
# Scanner Settings
SCAN_INTERVAL=300 # seconds
MAX_OPEN_POSITIONS=5
# Logging
LOG_LEVEL=INFO
LOG_FILE=bot.logpython main.py- Dashboard: View account balance, open positions, and bot status
- Scanner: Configure and control the market scanner
- Trades: Monitor and manage open positions
- Settings: Adjust bot configuration
- Logs: View system and trade logs
Send /start to your bot to see available commands:
-
/status- Check bot status -
/balance- View account balance -
/positions- List open positions -
/start_trading- Start automated trading -
/stop_trading- Stop automated trading -
/help- Show available commands
The bot uses a custom implementation of the ZigZag indicator to identify significant market turning points. The algorithm:
- Identifies local highs and lows in price action
- Filters out insignificant price movements using configurable parameters
- Labels patterns as Higher Highs (HH), Lower Highs (LH), Higher Lows (HL), or Lower Lows (LL)
- Generates trading signals based on pattern confirmation
For each identified pattern, the bot calculates key Fibonacci levels:
- 23.6%
- 38.2%
- 50.0%
- 61.8%
- 78.6%
These levels are used to determine potential entry, stop-loss, and take-profit points.
- Position sizing based on account balance
- Stop-loss orders to limit losses
- Take-profit targets to secure profits
- Maximum number of concurrent positions
- Daily loss limits
-
/start- Start the bot and show main menu -
/help- Show help message -
/status- Show bot status -
/balance- Show account balance -
/positions- List open positions -
/trades- Show recent trades -
/pnl- Show profit and loss
-
/start_trading- Start automated trading -
/stop_trading- Stop automated trading -
/restart- Restart the bot -
/config- View or modify configuration -
/logs- View bot logs
-
API Connection Errors
- Verify your API keys
- Check your internet connection
- Ensure your IP is whitelisted on ByBit
-
Authentication Failures
- Verify API key permissions
- Check API key expiration
- Ensure system clock is synchronized
-
Order Execution Issues
- Check available balance
- Verify trading pair is active
- Check for exchange maintenance
Logs are stored in bot.log by default. You can also view logs in the GUI or via Telegram.
Q: Is this bot free to use? A: Yes, the bot is open-source and free to use under the MIT License.
Q: What exchanges does the bot support? A: Currently, the bot supports ByBit exchange.
Q: Can I run multiple instances of the bot? A: Yes, but you should ensure they don't interfere with each other's trading.
Q: What's the minimum account balance required? A: The minimum depends on your trading parameters, but we recommend at least $100 for proper risk management.
Q: Can I customize the trading strategy?
A: Yes, you can modify the strategy in c_service/b_strategy.py.
Q: How often does the bot place trades? A: The bot scans the market at intervals defined in the configuration (default: 5 minutes).
We welcome contributions! Please see our CONTRIBUTING.md for guidelines.
This project is licensed under the GNU License - see the LICENSE file for details.
Disclaimer: Trading cryptocurrencies involves substantial risk of loss. This bot is for educational purposes only. Always test with small amounts first and never invest more than you can afford to lose.
- Website: beydahsaglam.com
- Email: [email protected]
- LinkedIn: beydah
- GitHub: beydah