Automated trading system with Zerodha Kite integration and Telegram notifications.
- 📊 Technical analysis (EMA, RSI, MACD, ATR)
- 🤖 Automated trade recommendations
- 📱 Telegram notifications and manual control
- 💾 Persistent state management
- 📈 Pyramid buying (configurable entries)
- 🎯 ATR-based stop loss and targets
trade-engine/
├── config.py # Configuration and credentials
├── trader.py # Main entry point
├── setup.sh # Automated setup script
├── src/
│ ├── state_manager.py # State persistence
│ ├── broker.py # Zerodha Kite integration
│ ├── telegram_client.py # Telegram bot
│ └── strategy.py # Technical analysis
├── tests/ # Unit tests (future)
├── requirements.txt # Python dependencies
└── README.md
./setup.shThis will:
- Set Python version to 3.13.1
- Create virtual environment
- Install all dependencies
uv venv --python 3.13
source .venv/bin/activate # On Windows: .venv\Scripts\activateuv pip install -r requirements.txtEdit config.py and add your credentials:
# Zerodha
API_KEY = "your_kite_api_key"
ACCESS_TOKEN = "your_access_token"
# Telegram
TELEGRAM_BOT_TOKEN = "your_bot_token"
TELEGRAM_CHAT_ID = "your_chat_id"Getting Zerodha Credentials:
- Sign up at https://kite.trade/
- Create an API app at https://developers.kite.trade/
- Generate access token using the API key
Getting Telegram Credentials:
- Create a bot via @BotFather
- Get your chat ID from @userinfobot
Edit config.py to customize:
- Trading parameters (max buys, product type)
- Strategy parameters (EMA, RSI, MACD settings)
- Timing (check intervals)
python trader.py RELIANCEReplace RELIANCE with any NSE stock symbol (e.g., TCS, INFY, HDFCBANK).
Send these commands via Telegram during trading:
BUY- Execute buy order manuallySELL- Execute sell order manuallySTATUS- Check current position
- Maximum pyramid buys limit
- ATR-based stop loss calculation
- State persistence across restarts
- Error handling and retry logic
- Manual override via Telegram
- Clone the repo
git clone <repo-url>
cd trade-engine- Run setup
./setup.sh-
Configure credentials in
config.py -
Start trading
python trader.py RELIANCE- Create a new branch
git checkout -b feature/your-feature-
Make changes and test
-
Commit and push
git add .
git commit -m "Add your feature"
git push origin feature/your-feature- Create Pull Request on GitHub
pytest tests/Virtual environment not activating?
source .venv/bin/activatePackages not found?
uv pip install -r requirements.txtPython version issues?
pyenv local 3.13.1This is for educational purposes only. Trading involves substantial risk. Always test with paper trading first. The authors are not responsible for any financial losses.
MIT License - See LICENSE file for details