An AI-driven Ethereum trading bot that integrates machine learning price prediction,
Capital.com trading API (demo/live), and a Telegram bot interface with inline controls.
- ML Model (LSTM): Predicts ETH price direction using Binance OHLC data.
- Live/Demo Trading: Supports both Capital.com live and demo modes.
- Telegram Bot UI: Inline buttons for opening/closing trades with confirmation.
- Position Tracking: Keeps track of open/closed trades in SQLite.
- AED Conversion: All trade values shown in AED with real-time conversion.
- Custom Investment: Choose preset or custom AED investment amounts.
- Safe Execution: Bot only trades on explicit Telegram confirmation.
- Language: Python 3
- ML Framework: PyTorch
- Data Feed: Binance API
- Broker: Capital.com API
- Messaging: Telegram Bot API
- Database: SQLite
- Libraries:
torch
,numpy
,pandas
python-telegram-bot
binance
python-dotenv
requests
CryptoTradingBot/
├── main.py # Main trading bot logic
├── trades.db # SQLite DB (auto-created)
├── price_predictor.pt # Trained LSTM model (optional)
├── requirements.txt # Python dependencies
├── .env # Secrets/config (ignored in Git)
├── .gitignore
└── README.md
git clone https://github.com/EbrahimAR/CryptoTradingBot.git
cd CryptoTradingBot
pip install -r requirements.txt
# Capital.com
CAPITAL_API_KEY=your_capital_api_key
CAPITAL_EMAIL=your_email
CAPITAL_PASSWORD=your_password
CAPITAL_EPIC=ETHUSD
# Telegram
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
TELEGRAM_CHAT_ID=your_telegram_chat_id
# Trading Settings
# Default fallback values (used only if no AED input is provided in Telegram).
# Actual trade size is chosen interactively in AED via Telegram buttons.
TRADE_AMOUNT_ETH=0.05
TRADE_SYMBOL=ETH/USD
python main.py
/show
→ Run AI prediction, get trading recommendation, choose BUY/SELL./status
→ Show current open trade details and PnL./close
→ Close the last open trade./capital
→ Show Capital.com connection status./symbols
→ Suggest valid ETH epic formats.
Even though .env
has a fallback like TRADE_AMOUNT_ETH=0.05
,
the real trade size comes from your AED amount selected in Telegram.
This ensures you always trade in your preferred local currency.
- Add Stop Loss / Take Profit directly from Telegram UI.
- Multi-asset support (BTC, SOL, etc.).
- Web dashboard for trade monitoring.
- Strategy backtesting and optimization.
Ebrahim Abdul Raoof
This project is licensed under the MIT License. See LICENSE for details.