-
Navigate to the Backtesting directory:
cd Backtesting -
Install dependencies (if not already installed):
pip install -r requirements.txt
-
Launch the web interface:
streamlit run app.py
-
Open your browser and go to
http://localhost:8501 -
Start backtesting:
- Choose a strategy from the sidebar
- Select an asset (stock/ETF)
- Configure parameters
- Click "Run Backtest"
-
List available strategies:
python3 cli.py --list-strategies
-
Run a backtest:
python3 cli.py --strategy rsi --symbol ^GSPC --start 2020-01-01 --end 2023-01-01
-
Get help:
python3 cli.py --help
Run the example script to see the system in action:
python3 -m Backtesting.example- Best for: Value investing, contrarian approaches
- Logic: Invests when RSI is oversold (below threshold)
- Parameters: RSI period, RSI threshold
- Best for: Trend following, momentum strategies
- Logic: Invests when fast MA crosses above slow MA
- Parameters: Fast period, slow period
- Best for: Mean reversion, volatility-based strategies
- Logic: Invests when price touches lower band
- Parameters: BB period, standard deviation
- Best for: Baseline comparison, conservative investing
- Logic: Invests fixed amounts at regular intervals
- Parameters: None (uses investment settings)
The system includes pre-configured popular assets:
- ^GSPC: S&P 500 Index
- SPY: SPDR S&P 500 ETF
- QQQ: Invesco QQQ Trust
- AAPL: Apple Inc.
- MSFT: Microsoft Corporation
- And many more...
- Start with DCA: Use Dollar Cost Averaging as a baseline
- Use longer periods: 5+ years for more reliable results
- Compare strategies: Test different approaches on the same asset
- Focus on metrics: Pay attention to Sharpe ratio and maximum drawdown
- Experiment: Try different parameters to see their impact
- Import errors: Make sure you're in the Backtesting directory
- Missing dependencies: Run
pip install -r requirements.txt - Data errors: Some tickers may have limited historical data
- Rate limits: Yahoo Finance may limit requests during high traffic
- Check the main README.md for detailed documentation
- Look at example.py for usage examples
- Use the CLI help:
python3 cli.py --help
Once you see the web interface running, you can:
- ✅ Choose from 4 different investment strategies
- ✅ Test on 20+ popular stocks and ETFs
- ✅ Compare strategy performance
- ✅ Analyze comprehensive metrics
- ✅ Learn about different investment approaches
Happy backtesting! 📈