Skip to content

Repository files navigation

AI Crypto Trading Bot

End-to-end implementation from the guide — Python + Binance Testnet + Claude AI filter.


Architecture

Signal Layer    strategy.py      EMA50 trend + RSI momentum + ATR volatility
Filter Layer    ai_filter.py     Claude validates each signal before execution
Execution Layer executor.py      Binance API — market buy + OCO sell
Risk Layer      risk_manager.py  Position sizing, drawdown limits, loss streaks
Analytics       backtester.py    Candle-by-candle simulation + charts
                dashboard.py     Live Streamlit monitoring dashboard
Config          config.py        All tunable parameters in one place
Entry Point     bot.py           CLI: --download | --backtest | --live

Quick Start

1. Install dependencies

pip install -r requirements.txt

2. Set environment variables

# Windows
set BINANCE_API_KEY=your_testnet_key
set BINANCE_API_SECRET=your_testnet_secret
set ANTHROPIC_API_KEY=your_anthropic_key

# macOS/Linux
export BINANCE_API_KEY=your_testnet_key
export BINANCE_API_SECRET=your_testnet_secret
export ANTHROPIC_API_KEY=your_anthropic_key

3. Download historical data

python bot.py --download

4. Run backtest

python bot.py --backtest

5. Launch dashboard

streamlit run dashboard.py

6. Start live bot (testnet)

python bot.py --live

File Structure

trading_bot/
├── config.py          All parameters — edit here first
├── strategy.py        EMA, RSI, ATR indicators + signal logic
├── ai_filter.py       Claude API validation layer
├── risk_manager.py    Position sizing + safety guards
├── executor.py        Binance API calls
├── backtester.py      Historical simulation + charts
├── dashboard.py       Streamlit live dashboard
├── bot.py             Main entry point (CLI)
├── requirements.txt
└── data/              Created automatically
    ├── historical_data.csv
    ├── trades.csv
    ├── bot.log
    └── backtest_results.png

Risk Rules

Rule Default
Risk per trade 2%
Max daily drawdown 5%
Max consecutive losses 3
Min Risk:Reward 1:2

Safety Notes

  • Always start on Testnet — USE_TESTNET = True in config.py
  • Never commit API keys — use environment variables
  • Disable withdrawals on your Binance API key
  • Paper trade for at least 30 days before going live

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages