Looking for a Free Bitcoin Trading Bot in Python that's easy to setup? Want your bot to run 24/7 and automatically trade Bitcoin on Hyperliquid? You're in the right place!
This is a completely free, open-source Bitcoin Trading Bot built in Python. It features:
- ✅ Automated 24/7 Bitcoin Trading on Hyperliquid
- ✅ Easy Setup - Get started in minutes
- ✅ Self-Optimizing - Automatically finds the best trading parameters
- ✅ Real-Time Monitoring - Track your trades and profits live
- ✅ Built-in Backtesting - Test strategies before going live
- ✅ Risk Management - Automatic stop-loss and take-profit protection
The bot uses the proven RSI 1MIN Double Confirm strategy with integrated backtesting to maximize your trading performance.
Sign up using our referral link to get a 4% fee discount bonus: 👉 Join Hyperliquid with BONUS500
After signing up, get your API keys from: Hyperliquid API Settings
The bot features a clean, four-tab interface for monitoring, controlling, and backtesting your trading operations:
Real-time account overview with balance, current position, and RSI indicator
Start/stop the bot, view activity logs, and monitor current trading signals
Track your last 20 Bitcoin trades with detailed information
Test your strategy with historical data and view comprehensive performance metrics
Key Features:
- ✨ Integrated Backtesting: Test your strategy directly from the panel
- 🤖 Self-Optimizing System: Automatically runs backtests every 24 hours to find best parameters
- 📊 4-Tab Interface: Main dashboard, bot control, trade history, and backtesting
- 📁 Organized Structure: Clean codebase with modular design
- 🎯 Focused Strategy: Optimized for RSI 1MIN Double Confirm only
- 🔄 Dynamic Parameters: Bot automatically uses best-performing parameters from backtest results
This bot implements a SHORT-based trading strategy using RSI (Relative Strength Index) with a double confirmation mechanism:
- SHORT Signal: RSI tops above 65, then dips below 50 while price breaks support
- COVER Signal: RSI reaches oversold levels (< 20)
- Risk Management: Automatic take profit (1.5%) and stop loss (-0.7%)
- 🎯 Real-time Monitoring: Live account balance, positions, and RSI tracking
- 🤖 Automated Trading: Set-and-forget bot with configurable parameters
- 🔄 Self-Optimizing: Automatically backtests every 24 hours and uses best parameters
- 📊 4-Tab Interface: Main dashboard, bot control, trade history, and backtesting
- 🔬 Integrated Backtesting: Test strategy performance with historical data
- 🏆 Performance-Based: Bot uses parameters from best-performing backtest results
- 🔒 Risk Management: Built-in take profit and stop loss protection
- 🌐 Testnet Support: Test strategies safely before going live
- Python 3.8 or higher
- Linux/Mac (for curses terminal UI)
- Hyperliquid account with API access
- Clone the repository:
git clone https://github.com/aiwebarchitects/bitcoin_trading_bot_python.git
cd bitcoin_trading_bot_python- Install dependencies:
pip install -r requirements.txt- Configure API credentials:
Open
executer/config.jsonand replace the placeholder values with your Hyperliquid API credentials:
{
"account_address": "your_wallet_address",
"secret_key": "your_private_key"
}For Mainnet: Get your API credentials from Hyperliquid API Settings
For Testnet:
- First, claim 1000 USDC test funds: Testnet Faucet
- Then create your testnet API key: Testnet API Settings
- Remember to set
BOT_USE_TESTNET = Trueinsettings.py
- Configure bot settings:
Edit
settings.pyto customize:
BOT_USE_TESTNET: Set toTruefor testnet,Falsefor mainnetBOT_POSITION_VALUE_USD: Position size per tradeBOT_MAX_TOTAL_POSITION_USD: Maximum total position valueBOT_BUY_COOLDOWN_MINUTES: Cooldown between trades
python3 bitcoin_panel.py- TAB or ←/→: Switch between tabs (Main, Bot, History, Backtest)
- S: Start the automated trading bot
- X: Stop the automated trading bot
- B: Run backtest (when on BACKTEST tab)
- R: Refresh data manually
- Q: Quit the application
- MAIN: Account overview, current position, and RSI indicator
- BOT: Bot control, activity logs, and current signals
- HISTORY: Last 20 Bitcoin trades
- BACKTEST: Strategy backtesting with performance metrics
The bot features an intelligent self-optimization system that automatically improves its performance:
- On Startup: Checks if backtest results are older than 24 hours
- Auto-Backtest: If needed, runs comprehensive parameter optimization
- Parameter Testing: Tests 1000+ combinations of RSI settings, take profit, and stop loss
- Best Selection: Automatically selects parameters with highest win rate
- Live Trading: Bot uses these optimized parameters for actual trading
Result: Your bot is always trading with the most recently optimized parameters based on real market data!
You can also run backtests manually from the panel:
- Navigate to the BACKTEST tab
- Review current settings (RSI period, thresholds, take profit, stop loss)
- Press B to run backtest
- View results including:
- Win rate and total profit
- Profit factor and max drawdown
- Average profit per trade
- Recent trades with entry/exit details
- Real Market Data: Fetches 1-minute Bitcoin data from Binance
- Comprehensive Testing: Tests up to 1000 candles (approximately 16 hours)
- Parameter Optimization: Tests multiple combinations to find best settings
- Detailed Results: Trade-by-trade breakdown with entry/exit analysis
- Performance Metrics: Win rate, profit factor, max drawdown, and more
- 24-Hour Cache: Results cached for 24 hours to avoid unnecessary re-testing
- Automatic Updates: Bot parameters automatically update from backtest results
The optimization system tests these parameter ranges:
- RSI Period: 7, 10, 14
- Oversold Threshold: 10, 15, 20, 25, 30
- Overbought Threshold: 60, 65, 70, 75, 80, 85
- Take Profit: 1.0%, 1.5%, 2.0%, 2.5%, 3.0%
- Stop Loss: -0.5%, -0.7%, -1.0%, -1.5%, -2.0%
The system ranks all combinations by:
- Primary: Win rate (higher is better)
- Secondary: Total profit (higher is better)
The top-performing combination is automatically loaded into settings.py and used by the bot.
The bot uses a sophisticated double confirmation mechanism:
-
Setup Phase: RSI must first "top" by either:
- Reaching overbought (> 65), OR
- Making a local peak above 60
-
SHORT Signal (all conditions must be met):
- RSI has topped (from step 1)
- RSI crosses below 50
- Price breaks below support level (lowest low in last 10 candles)
-
COVER Signal:
- RSI crosses into oversold territory (< 20)
-
Risk Management (checked every cycle):
- Take Profit: Close at +1.5% profit
- Stop Loss: Close at -0.7% loss
The bot automatically loads optimized parameters from backtest results:
How It Works:
- System runs backtest optimization (every 24 hours or on first run)
- Best parameters saved to
backtest_results/results.json settings.pyautomatically loads these optimized values- Bot uses these parameters for live trading
Current Default Fallbacks (used only if backtest fails):
- RSI Period: 10
- Oversold Threshold: 20
- Overbought Threshold: 65
- Take Profit: 1.5%
- Stop Loss: -0.7%
To see your current optimized parameters:
- Check
backtest_results/results.jsonfor the latest optimization results - Or view them in the BACKTEST tab of the panel
- Parameters are displayed on startup in the console
Note: The bot will use the best-performing parameters from the most recent backtest, not the fallback defaults!
The settings.py file automatically loads optimized parameters from backtest results:
# Network Configuration
BOT_USE_TESTNET = False # Set to True for testnet
# Trading Configuration
BOT_POSITION_VALUE_USD = 100.0 # Position size per trade
BOT_MAX_TOTAL_POSITION_USD = 500.0 # Maximum total position
BOT_BUY_COOLDOWN_MINUTES = 5 # Cooldown between trades
# RSI Parameters (AUTO-LOADED from backtest_results/results.json)
# These values are automatically optimized every 24 hours
BOT_RSI_PERIOD = _optimized_params.get('rsi_period', 10)
BOT_RSI_OVERSOLD = _optimized_params.get('oversold', 20)
BOT_RSI_OVERBOUGHT = _optimized_params.get('overbought', 65)
# Risk Management (AUTO-LOADED from backtest_results/results.json)
BOT_TAKE_PROFIT = _optimized_params.get('take_profit', 0.015)
BOT_STOP_LOSS = _optimized_params.get('stop_loss', -0.007)Important: The values shown above are fallback defaults. The actual values used by the bot come from backtest_results/results.json and are automatically optimized based on recent market performance.
If you want to use specific parameters instead of auto-optimized ones:
- Edit
settings.py - Replace the
_optimized_params.get()calls with hardcoded values - Example:
BOT_RSI_PERIOD = 14 # Use 14 instead of auto-optimized valueNote: This is not recommended as it disables the self-optimization feature.
- ✅ Testnet mode for safe testing
- ✅ Position size limits
- ✅ Trade cooldown periods
- ✅ Automatic stop loss
- ✅ Manual bot control (start/stop anytime)
- ✅ Backtesting before live trading
bitcoin_trading_bot_python/
├── bitcoin_panel.py # Main application
├── settings.py # Bot configuration
├── README.md # This file
├── requirements.txt # Python dependencies
├── system_files.txt # System documentation
├── bitcoin_trading_bot_python.png # Bot screenshot
├── algos/ # Trading algorithms
│ ├── __init__.py
│ ├── base_algorithm.py
│ ├── rsi_algorithm.py
│ └── rsi_1min_double_confirm_algorithm.py
├── helpers/ # Helper modules
│ ├── backtest_helper.py # Panel backtester
│ ├── backtest_manager.py # Auto-optimization system
│ └── start_backtesting.py # Standalone backtester
├── backtest_results/ # Optimization results
│ └── results.json # Best parameters (auto-generated)
├── executer/ # Exchange utilities
│ ├── example_utils.py
│ └── config.json # API credentials
└── screenshots/ # UI screenshots
├── Main.png
├── Bot.png
└── History.png
If you see "Terminal too small!", resize your terminal to at least 60x20 characters.
- Verify your API credentials in
executer/config.json - Check if you're using the correct network (testnet vs mainnet)
- Ensure you have internet connectivity
- The bot fetches data from Binance API for RSI calculation
- Check your internet connection
- Wait a few seconds for initial data load
- Ensure you have internet connectivity (fetches data from Binance)
- Check that pandas and requests are properly installed
- Try running backtest again if it times out
- Test thoroughly on testnet first
- Use backtesting to validate strategy
- Start with small position sizes
- Never invest more than you can afford to lose
- Monitor the bot regularly
- Understand the strategy before using it
This project is provided as-is without any warranty. Use at your own risk.
For issues or questions, please check the system_files.txt for technical details or review the code documentation.
This is an open-source project. Feel free to fork, modify, and improve!
