A modular event-driven trading bot in Python that uses a simple SMA crossover strategy to simulate trades in real-time. This bot fetches live data, makes decisions, executes simulated orders, logs trades, evaluates performance, and visualizes buy/sell signals.
- ✅ Event-driven execution using live streamed OHLC data
- ✅ SMA-based signal generator (Simple Moving Average)
- ✅ Custom paper broker for simulating orders and cash
- ✅ Trade history logging to CSV
- ✅ Performance summary (total return, win rate, average PnL)
- ✅ Clean chart with price, SMA, and buy/sell signal markers
The bot places simulated BUY (🟢) and SELL (🔴) signals on the price chart based on SMA crossover logic.
The strategy checks the live price stream and compares it with a rolling Simple Moving Average (SMA):
- 🟢 BUY when price crosses above the SMA
- 🔴 SELL when price crosses below the SMA
This can be modified in strategy/simple_strategy.py to implement RSI, MACD, or other indicators.
git clone https://github.com/chanchalkapri/event_driven_bot.git
cd event_driven_bot
pip install -r requirements.txt
python main.py