Binance Spot Trader
Verified@srikanthbellary
npx machina-cli add skill @srikanthbellary/binance-spot-trader --openclawBinance Spot Trader
Autonomous spot trading bot for Binance. Combines technical indicators with LLM-powered market sentiment analysis to execute trades on any Binance spot pair.
Prerequisites
- Binance account with API keys (spot trading enabled, withdrawal DISABLED)
- Anthropic API key (uses Haiku ~$0.001/eval)
- Python 3.10+
Setup
1. Install
bash {baseDir}/scripts/setup.sh
2. Configure
Create .env:
BINANCE_API_KEY=<your-api-key>
BINANCE_SECRET_KEY=<your-secret-key>
LLM_API_KEY=<anthropic-api-key>
PAIRS=BTCUSDT,ETHUSDT,SOLUSDT
STRATEGY=momentum
TRADE_SIZE_PCT=5
MAX_POSITIONS=5
3. Run
python3 {baseDir}/scripts/trader.py
Or via cron:
*/5 * * * * cd /opt/trader && python3 trader.py >> trader.log 2>&1
Strategies
Momentum (default)
- Buys when price crosses above 20-EMA with volume spike
- Sells when price crosses below 20-EMA or hits TP/SL
- Best for trending markets (BTC, ETH, SOL)
Mean Reversion
- Buys when RSI < 30 (oversold) and price near Bollinger Band lower
- Sells when RSI > 70 (overbought) or price near upper band
- Best for range-bound markets
DCA (Dollar Cost Average)
- Buys fixed amount at regular intervals regardless of price
- Configurable interval (hourly, daily, weekly)
- Lowest risk strategy for long-term accumulation
LLM-Enhanced (all strategies)
- Before each trade, asks Claude Haiku for market sentiment
- Evaluates: recent news, price action, volume patterns, market structure
- Can veto a trade signal if sentiment is strongly against
Trading Parameters
| Parameter | Default | Description |
|---|---|---|
PAIRS | BTCUSDT | Comma-separated trading pairs |
STRATEGY | momentum | momentum, mean_reversion, or dca |
TRADE_SIZE_PCT | 5 | % of portfolio per trade |
MAX_POSITIONS | 5 | Max concurrent open positions |
TAKE_PROFIT_PCT | 5 | Take profit % |
STOP_LOSS_PCT | 3 | Stop loss % |
DCA_INTERVAL | daily | For DCA: hourly, daily, weekly |
DCA_AMOUNT_USDT | 50 | USDT per DCA buy |
USE_LLM | true | Enable LLM sentiment filter |
Monitoring
# Check portfolio
python3 {baseDir}/scripts/portfolio.py
# View trade history
tail -50 trades.jsonl
# Check logs
tail -f trader.log
⚠️ Security Considerations
- NEVER enable withdrawal on API keys — trading only
- IP-restrict your API keys on Binance
- Use a sub-account with limited funds for bot trading
- Start with tiny amounts ($50-100) and paper trade first
- Monitor actively during first 24 hours
- Set up Binance email alerts for all trades
- API keys on disk — secure your server (SSH keys only, firewall, chmod 600)
References
- See
references/binance-api.mdfor REST API docs - See
references/indicators.mdfor technical analysis details
Overview
Autonomous Binance spot trading bot that combines technical indicators with LLM-powered market sentiment analysis to execute momentum, mean reversion, and DCA strategies on any spot pair. It supports position sizing and portfolio tracking, enabling automated crypto trading with built-in risk controls.
How This Skill Works
The bot authenticates with Binance via API keys and runs a Python trader that pulls live market data, applies indicators (e.g., 20-EMA, RSI, Bollinger Bands), and consults Anthropic Haiku for sentiment before trading. It enforces risk settings like TAKE_PROFIT_PCT and STOP_LOSS_PCT, sizes positions using TRADE_SIZE_PCT, and tracks active positions across configured PAIRS for automated execution.
When to Use It
- You want to automate crypto trading on Binance spot without manual intervention
- You want to deploy momentum, mean reversion, or DCA strategies on spot pairs
- You want LLM-enhanced sentiment evaluation to vet signals before trading
- You manage multiple pairs and need controlled risk with MAX_POSITIONS
- You want built-in monitoring of portfolio and trade history
Quick Start
- Step 1: Install the bot by running the setup script: bash {baseDir}/scripts/setup.sh
- Step 2: Configure: create .env and set BINANCE_API_KEY, BINANCE_SECRET_KEY, LLM_API_KEY, PAIRS, STRATEGY, TRADE_SIZE_PCT, MAX_POSITIONS, etc.
- Step 3: Run: python3 {baseDir}/scripts/trader.py or set up a cron job to run it periodically
Best Practices
- Start with a small allocation (e.g., $50-100) and use paper trading first
- Never enable withdrawals on API keys; IP-restrict keys and use a sub-account
- Keep a dedicated environment for the bot and rotate keys regularly
- Backtest where possible and monitor performance; review logs daily
- Regularly tune STRATEGY, PAIRS, and risk parameters (TRADE_SIZE_PCT, TAKE_PROFIT_PCT, STOP_LOSS_PCT)
Example Use Cases
- BTCUSDT momentum trading that uses 5% of the portfolio per trade to capture trends
- ETHUSDT and SOLUSDT mean reversion during range-bound periods
- DCA purchases on BTCUSDT occurring at a daily interval for long-term accumulation
- LLM sentiment veto prevents trades during negative news or unfavorable sentiment
- Portfolio-wide monitoring and trade history via built-in portfolio.py and logs