A professional, profitable automated trading bot that implements the Grid Trading Strategy for Ethereum (ETH/USDT). This bot capitalizes on market volatility by placing buy and sell orders at predetermined price levels, profiting from price oscillations.
Grid trading is a proven profitable strategy that works best in ranging/volatile markets:
- Grid Setup: Creates a grid of buy and sell orders at regular price intervals
- Buy Low: Automatically buys ETH when the price drops to lower grid levels
- Sell High: Automatically sells ETH when the price rises to upper grid levels
- Continuous Profit: Each completed buy-sell cycle generates profit
- Volatility Harvesting: Profits from market oscillations without predicting direction
- Market Volatility: Higher volatility = more grid level hits = more profit
- Grid Spacing: Optimized spacing balances frequency and profit per trade
- Investment Size: Larger investment spreads across grids increases potential returns
- Fee Optimization: Uses limit orders to minimize trading fees
Investment: $1,000 USDT
Grid Range: $3,000 - $3,300 (5% range)
Grid Levels: 10 levels
Grid Spacing: $30 per level
Scenario:
- Price drops from $3,150 to $3,120 β Buy triggered at $3,120
- Price rises back to $3,150 β Sell triggered at $3,150
- Profit per cycle: ($3,150 - $3,120) Γ ETH amount = ~$3-5 per cycle
- With 10-20 cycles per day in volatile markets = $30-100 daily potential
- β Automated Grid Trading - Sets up and manages grid orders automatically
- β Multi-Exchange Support - Works with Binance, Coinbase, Kraken, etc. (via CCXT)
- β Test Mode - Safe testing without real trades
- β Real-time Monitoring - Tracks profits, balances, and order status
- β Risk Management - Configurable stop-loss and position limits
- β Detailed Logging - Complete audit trail of all operations
- β Easy Configuration - JSON-based configuration
- β Auto-Recovery - Handles network issues and exchange errors gracefully
- Python 3.8 or higher
- Cryptocurrency exchange account (Binance recommended)
- API keys with trading permissions
- Minimum $500-1000 USDT recommended for optimal grid performance
git clone https://github.com/yourusername/ethereum-grid-bot.git
cd ethereum-grid-botOr download and extract the ZIP file to your preferred directory.
# Windows
python -m pip install --upgrade pip
pip install -r requirements.txt
# Linux/Mac
python3 -m pip install --upgrade pip
pip3 install -r requirements.txtEdit config.json with your settings:
{
"exchange": {
"name": "binance",
"api_key": "YOUR_API_KEY_HERE",
"api_secret": "YOUR_API_SECRET_HERE"
},
"trading": {
"symbol": "ETH/USDT",
"total_investment": 1000,
"test_mode": true,
"cancel_on_exit": true,
"update_interval": 60,
"amount_precision": 4
},
"grid": {
"num_grids": 10,
"price_range_percent": 5
},
"risk_management": {
"stop_loss_percent": 10,
"take_profit_percent": 20,
"max_position_size": 0.5
}
}.env file for API keys (see Advanced Configuration below).
- Log in to Binance
- Go to Profile β API Management
- Create a new API key
- Enable "Enable Spot & Margin Trading"
- Disable "Enable Withdrawals" (for security)
- Set IP restrictions if possible
- Copy your API Key and Secret Key
- Coinbase Pro: Account β API β New API Key
- Kraken: Settings β API β Generate New Key
- KuCoin: Account β API Management β Create API
First, run in test mode (no real trades):
# Windows
python grid_bot.py
# Linux/Mac
python3 grid_bot.pyYou should see output like:
2025-10-10 10:30:45 - INFO - Initialized Grid Bot for ETH/USDT
2025-10-10 10:30:46 - INFO - Successfully connected to binance
2025-10-10 10:30:46 - INFO - Current Price: $3156.78
2025-10-10 10:30:46 - INFO - Grid levels calculated: 10 levels
2025-10-10 10:30:46 - INFO - Range: $2998.94 - $3314.62
2025-10-10 10:30:46 - INFO - [TEST MODE] Would place buy order...
Once you've verified everything works in test mode:
- Fund your account with USDT (match your
total_investmentsetting) - Disable test mode in
config.json: Set"test_mode": false - Start the bot:
python grid_bot.pyThe bot will:
- Display real-time status every minute
- Log all operations to
grid_bot.log - Show profit calculations after each trade cycle
To stop the bot safely: Press Ctrl+C (it will cancel all open orders)
| Parameter | Description | Recommended Value |
|---|---|---|
symbol |
Trading pair | ETH/USDT |
total_investment |
Total USDT to invest | 1000 - 10000 |
num_grids |
Number of grid levels | 8 - 15 |
price_range_percent |
Grid range from current price | 3 - 7 |
update_interval |
Check interval (seconds) | 30 - 120 |
{
"grid": {
"num_grids": 15,
"price_range_percent": 3
}
}{
"grid": {
"num_grids": 8,
"price_range_percent": 7
}
}{
"trading": {
"total_investment": 500
},
"grid": {
"num_grids": 8
}
}{
"trading": {
"total_investment": 10000
},
"grid": {
"num_grids": 20,
"price_range_percent": 5
}
}For better security, create a .env file:
# .env file
EXCHANGE_API_KEY=your_api_key_here
EXCHANGE_API_SECRET=your_api_secret_hereThen create config_secure.py:
import os
from dotenv import load_dotenv
import json
load_dotenv()
config = {
"exchange": {
"name": "binance",
"api_key": os.getenv("EXCHANGE_API_KEY"),
"api_secret": os.getenv("EXCHANGE_API_SECRET")
},
# ... rest of config
}
with open('config.json', 'w') as f:
json.dump(config, f, indent=2)Monitor grid_bot.log for detailed operation logs:
# Windows PowerShell
Get-Content grid_bot.log -Wait -Tail 50
# Linux/Mac
tail -f grid_bot.log- Total Profit: Cumulative profit from all completed cycles
- Fill Rate: How often grid orders are being filled
- Active Orders: Number of pending orders in the grid
- Balance Changes: Track ETH and USDT balance over time
Conservative estimates with $1,000 investment:
| Market Condition | Daily Trades | Daily Profit | Monthly Profit |
|---|---|---|---|
| Low Volatility | 5-10 cycles | $5-15 | $150-450 |
| Medium Volatility | 10-20 cycles | $15-40 | $450-1200 |
| High Volatility | 20-40 cycles | $40-100+ | $1200-3000+ |
Note: Past performance doesn't guarantee future results. Always start with small amounts.
- Test Mode: Practice without real money
- Position Limits: Prevents over-exposure
- Auto-Cancel: Cancels orders on shutdown
- Error Handling: Recovers from network issues
- Rate Limiting: Respects exchange API limits
β DO:
- Start with test mode
- Use only money you can afford to lose
- Monitor the bot regularly
- Keep API keys secure
- Enable 2FA on your exchange account
- Set IP restrictions on API keys
- Start with small investment and scale up
β DON'T:
- Don't enable withdrawal permissions on API keys
- Don't share your API keys
- Don't invest more than you can afford to lose
- Don't ignore stop-loss settings
- Don't run multiple bots on same account without coordination
The bot includes configurable stop-loss:
{
"risk_management": {
"stop_loss_percent": 10
}
}This will stop the bot if your total loss exceeds 10%.
- Solution: Check your API keys are correct
- Verify API permissions include spot trading
- Check your internet connection
- Solution: Ensure your USDT balance >=
total_investment - Check if funds are locked in other orders
- Solution: Check minimum order size for your exchange
- Verify trading pair is correct (
ETH/USDT) - Ensure you have enough balance
- Solution: Check
grid_bot.logfor errors - Verify network connection
- Ensure exchange API is operational
- Check the log file:
grid_bot.log - Review exchange status page
- Verify API key permissions
- Test with smaller investment first
ethereum-grid-bot/
βββ grid_bot.py # Main bot code
βββ config.json # Configuration file
βββ config.example.json # Example configuration
βββ requirements.txt # Python dependencies
βββ README.md # This file
βββ .env.example # Example environment variables
βββ .gitignore # Git ignore file
βββ grid_bot.log # Log file (created on first run)
# Update Python packages
pip install --upgrade -r requirements.txt
# Update ccxt (exchange library)
pip install --upgrade ccxt- Daily: Check logs and performance
- Weekly: Review and adjust grid parameters based on market conditions
- Monthly: Update dependencies and review profitability
Run multiple bots for different pairs:
# Terminal 1 - ETH/USDT
python grid_bot.py config_eth.json
# Terminal 2 - BTC/USDT
python grid_bot.py config_btc.jsonThe bot can be extended to adjust grid ranges based on volatility:
# Calculate volatility and adjust range
volatility = calculate_volatility()
if volatility > 0.05:
config['grid']['price_range_percent'] = 7
else:
config['grid']['price_range_percent'] = 3Test strategy on historical data before live trading (implement separately).
Tested and compatible with:
- β Binance (Recommended - lowest fees)
- β Binance US
- β Coinbase Pro
- β Kraken
- β KuCoin
- β Bitfinex
- β Huobi
Any exchange supported by CCXT library should work with minor configuration adjustments.
MIT License - feel free to modify and distribute
- Python 3.8+ installed
- Dependencies installed (
pip install -r requirements.txt) - Exchange account created and verified
- API keys generated with spot trading enabled
- Withdrawals disabled on API key
-
config.jsonupdated with your API keys - Sufficient USDT balance in your account
- Test mode verified (
test_mode: true) - Bot runs successfully in test mode
- Switched to live mode (
test_mode: false) - Monitoring logs and performance
Happy Trading! ππ°
π Contact me on Telegram Remember: Start small, test thoroughly, and scale gradually as you gain confidence in the bot's performance.