What you need to start
- Claude Code is installed (see AI Agents 1.2).
- Binance account with API keys (Read + Trade permissions, WITHOUT Withdraw).
- $200-500 for a test deposit.
Step 1 Β· Getting API keys
2
Create API β name Β«grid-botΒ» β Save. Write down API Key + Secret. Enable permissions: Reading + Spot & Margin Trading. DO NOT enable Enable Withdrawals.
3
IP whitelist β add your VPS IP. This is critical for security.
Step 2 Β· Creating a grid bot with a prompt
π€ Prompt
Create a grid-bot folder. Inside, create a Python venv. Install python-binance and dotenv.
Files:
1. .env: BINANCE_API_KEY=xxx BINANCE_SECRET=yyy SYMBOL=ETHUSDT
2. config.json:
- capital_usd: 1000
- range_low: 3300
- range_high: 3700
- levels: 10 buy + 10 sell
- step_pct: 2.0
- position_size: capital / levels
3. grid_bot.py:
- Connect to Binance.
- On start: get the current price, calculate the grid (price levels), place orders.
- Loop every 30 seconds:
- Check filled orders
- If buy filled β auto-create sell at the next step
- If sell filled β auto-create buy at the previous step
- Log all trades in SQLite trades.db
4. status.py β shows the current state: placed orders, filled trades, total profit for today/week.
5. Security: DO NOT trade if grid bot.py is run for the first time (set a limit max_open_orders=20).
Run on Binance testnet for the first time. Show me the initial grid setup.
π€ Claude
β Created grid-bot/ structure
β Installed python-binance 1.0.x
β Connected to testnet OK
Initial grid (ETH/USDT @ $3500):
SELL: $3570 $3500 $3430...
BUY: $3430 $3360 $3290...
20 orders placed. Logs in trades.db.
Step 3 Β· Running on mainnet
After testnet works β switch to real Binance:
π€ Prompt
1. In .env, replace testnet API keys with mainnet.
2. Reduce capital to $200 (for the first week).
3. Run.
4. Monitor the first 24 hours every 2-3 hours: is placement correct, is refill correct after fills.
If something is wrong β say /halt in Telegram, the bot will stop.
What Claude will install
- python-binance β official SDK for Binance.
- asyncio + websockets β for real-time price updates.
- SQLite β for trade logs.
- python-telegram-bot β for alerts.
β οΈ ENABLE_WITHDRAWALS = NO
Even if you don't give away your private key β if the bot has withdrawal permission, a hacker can withdraw your money. ALWAYS disable withdrawal for trading bots.
π― Main point
One prompt β a working grid bot. Testnet first, then mainnet with small capital. ENABLE_WITHDRAWALS = NEVER. In the next lesson β backtesting the strategy on history.