A sophisticated, interactive financial tool for backtesting, optimizing, and comparing multiple investment portfolios. Built with Python and Streamlit, this application provides professional-grade analytics for both individual and institutional investors.
- Compare up to 5 portfolios simultaneously against a chosen benchmark (e.g., SPY, QQQ).
- Flexible asset selection including US Stocks, ETFs, and Korean Stocks (KOSPI).
- Max Sharpe Ratio Optimization: Automatically calculates the optimal asset weights to maximize risk-adjusted returns using the SLSQP algorithm.
- Manual Weighting: Precision control over asset allocation.
- Rebalancing: Choose between Yearly Rebalancing or a Buy & Hold strategy.
- Performance Metrics: CAGR, Annualized Volatility, Sharpe Ratio, Sortino Ratio, Alpha, Beta, and Max Drawdown.
- Currency Conversion: Real-time conversion between USD ($) and KRW (₩), including automatic FX rate historical data integration.
- Risk Analysis: Detailed drawdown charts and correlation analysis against the benchmark.
- Portfolio Growth: Interactive time-series charts of cumulative returns.
- Efficient Frontier: Monte Carlo simulation (2,000+ iterations) to visualize the risk-return spectrum and find the optimal investable universe.
- Asset Allocation: Dynamic donut charts representing the weight of each portfolio component.
- Frontend/App Framework: Streamlit
- Data Source: yfinance (Yahoo Finance API)
- Data Processing: Pandas, NumPy
- Scientific Computing: SciPy (Optimization)
- Visualization: Plotly (Interactive Charts)
To run the project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/your-username/Python_PPA.git cd Python_PPA -
Create and activate a virtual environment (optional but recommended):
python -m venv .venv # Windows .venv\Scripts\activate # Mac/Linux source .venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
streamlit run app.py
- Stock Symbols: Enter US tickers directly (e.g.,
AAPL,VOO). For Korean stocks, enter the 6-digit code (the app automatically appends.KSor.KQbased on the internal mapping). - Benchmark: Default is
SPY, but can be changed to any valid ticker. - Ticker Shortcuts: The app includes a pre-defined mapping for popular Korean stocks and ETFs (e.g., typing
Samsunginstead of005930). - Analysis Period: Supports historical data back to 1980 (depending on asset availability).
This tool is for educational and informational purposes only. It does not constitute financial advice. Past performance is not indicative of future results. Always consult with a professional financial advisor before making investment decisions.
This project is licensed under the MIT License - see the LICENSE file for details.
