A Robotic Playground for Algorithmic Trading Strategies ๐คโก๏ธ๐โก๏ธ๐ฐ
๐ Hackathon-ready project for quantitative finance strategy development and testing
-
Three Trading Robots
- SMA Crossover Robot: Buys when fast SMA crosses above slow SMA
- RSI Mean Reversion Robot: Buys when oversold, sells when overbought
- Market Mood Robot: Pairs trading using z-score between two assets
-
Professional Tools
- Interactive web dashboard (Streamlit)
- Real-time performance metrics (Sharpe Ratio, Drawdown, Returns)
- Customizable parameters for each strategy
- Multi-asset support (Stocks, ETFs, Crypto)
- Clear visualizations and comparison charts
# Clone the repository
git clone https://github.com/uniquepratham/quant-trading-gym.git
cd quant-trading-gym
# Install dependencies
pip install -r requirements.txtstreamlit run app.pyOpen http://localhost:8501 in your browser.
python main.py| Strategy | Total Return | Sharpe Ratio | Max Drawdown |
|---|---|---|---|
| SMA Crossover | -17.4% | -0.85 | -19.8% |
| RSI Mean Reversion | +5.3% | +0.89 | -1.6% |
| Market Mood | Customizable | Customizable | Customizable |
-
Open the Web App:
streamlit run app.py -
Choose Your Robots: Select strategies to test
-
Set the Rules: Adjust parameters such as:
- SMA periods (e.g., 20 vs 50 days)
- RSI thresholds (e.g., 30 oversold, 70 overbought)
- Z-score entry/exit levels (e.g., 2.0 entry, 0.5 exit)
-
Pick Your Assets: Backtest on QQQ, SPY, BTC-USD, etc.
-
Launch Backtest: Watch your robots trade.
-
Analyze Results: Compare performance metrics and identify the best strategy.
quant-trading-gym/
โโโ app.py # ๐ช Streamlit dashboard
โโโ main.py # โก CLI testing version
โโโ backtester.py # ๐ค Trading simulation engine
โโโ utils.py # ๐ฆ Data handling & utilities
โโโ strategies/ # ๐ฏ Trading robots
โ โโโ sma_crossover.py # ๐ SMA crossover strategy
โ โโโ rsi_meanrev.py # ๐ RSI mean reversion
โ โโโ market_mood.py # ๐ Pairs trading strategy
โโโ outputs/ # ๐ธ Charts & results
โโโ requirements.txt # ๐ Dependencies
| Requirement | Status |
|---|---|
| Quantitative Strategies | โ 3+ Implemented |
| Backtesting Framework | โ Metrics & engine |
| Multiple Timeframes | โ Daily + customizable |
| Transaction Cost Modeling | โ Commission parameter |
| Risk Management | โ Position sizing |
| Performance Metrics | โ Sharpe, Drawdown |
| Parameter Optimization | โ Interactive tuning |
| Python Implementation | โ Complete |
| Documentation | โ README + comments |
- Data Source: Yahoo Finance API (real market data)
- Assets: Stocks (QQQ, SPY), Crypto (BTC-USD)
- Algorithms: SMA Crossover, RSI Mean Reversion, Z-Score Pairs Trading
- Metrics: Total Return, Annualized Return, Sharpe Ratio, Volatility, Max Drawdown, Calmar Ratio
- Live trading integration (Alpaca API, Binance API)
- Machine learning strategies (LSTM, Reinforcement Learning)
- Advanced risk management (Stop-loss, position sizing)
- Multi-asset portfolio optimization
- Real-time WebSocket market data
This project is licensed under the MIT License. See the LICENSE file for details.
Open an issue or reach out at gargpratham71@gmail.com
โญ Star this repo if you found it useful for your hackathon!
โThe only way to win at trading is to have a better strategy โ and this helps you find it.โ
