-
Notifications
You must be signed in to change notification settings - Fork 0
Home
TastyAlgo is an interactive algorithmic trading dashboard for backtesting stock strategies using market regime detection and advanced analytics. It enables users to experiment with multiple strategies, visualize results by market conditions, and analyze performance with downloadable reports.
- [Features](#features)
- [Quick Start](#quick-start)
- [Trading Strategies](#trading-strategies)
- [Market Regime Detection](#market-regime-detection)
- [Performance Metrics](#performance-metrics)
- [Exporting Reports](#exporting-reports)
- [FAQ](#faq)
- [Contributing](#contributing)
- Interactive dashboard built with Streamlit
- Backtest major trading strategies (Momentum, Moving Average, Volatility Breakout, Pairs Trading)
- Market regime identification using statistical methods or clustering (K-Means)
- Visualizes price, signals, portfolio value, drawdown, and regime heatmap
- User-adjustable strategy parameters
- CSV export for trades and results
- Modular, well-documented Python code
- Clone the repository:
git clone https://github.com/yourname/tastyalgo-backtesting-stock.git cd tastyalgo-backtesting-stock - Install requirements:
pip install -r requirements.txt - Launch dashboard:
streamlit run app.py - Select your stock ticker, dates, strategy, and parameters in the dashboard UI, then click Run Backtest.
- Momentum: Buys assets with strong recent returns; customizable n-day period and thresholds.
- Moving Average Crossover: Buys/sells when fast and slow moving averages cross.
- Volatility Breakout: Trades sudden large price moves.
- Pairs Trading: Trades relative changes between correlated stocks.
Each strategy includes parameter sliders and explanations for use and tuning.
TastyAlgo segments market history into regimes:
- Bull (rising markets)
- Bear (falling markets)
- Sideways/Neutral (range-bound, low volatility)
Detection Methods:
- Statistical: Uses rolling returns and volatility windows.
- K-Means Clustering: Groups periods with similar price behaviors.
Results/predictions are visualized and can be compared for performance by regime.
After each backtest, the dashboard shows:
- Total Return
- Sharpe Ratio
- Max Drawdown
- Win Rate
- Volatility
- Regime-wise results
- Interactive plots for portfolio value, drawdown, regime distribution
Users can download a CSV summary of the trade history and all main metrics with a click.
Q: What data source is used?
A: Yahoo Finance via yfinance API.
Q: Can I add my own strategies?
A: Yes. See strategies.py for examples on how to add custom logic.
Q: How can I save my parameters or reports?
A: Use the dashboard export buttons to download results, or save parameters manually.
Pull requests for new features, strategies, regime detectors, and documentation are welcome.
- Fork the repo and submit improvements/enhancements.
For detailed method descriptions, code explanations, change logs, and troubleshooting, see additional Wiki pages and the repo README.