pip install portwine
The Base ETF and Broad ETF seems to offer steady returns above SPY with limited drawdown. You will have to rotate the 2 winner ETF each 1-4 months and get the chance to reap 10-30% alpha over the SPY (S&P500)
This example shows how the platform makes building and analyzing a basic equity rotation strategy simple.
Below, we use the EquityDrawdownAnalyzer to visualize the portfolio drawdowns for an "all_ETF" portfolio—a diversified portfolio including all selected ETFs. The output chart (examples/all_etf.png) gives a quick overview of how the portfolio performed during market stress periods and helps identify potential risk episodes.
EquityDrawdownAnalyzer().plot(results)The Monte Carlo Analysis module helps simulate alternative portfolio equity paths using resampled returns from your strategy. The resulting chart (examples/base_etf_chart.png) illustrates potential future equity curves, helping you visualize risk and uncertainty beyond just the historical experience. The "base_etf" here typically refers to a single core ETF (such as SPY or a similar benchmark) used as a reference or a baseline for comparison in simulations.
MonteCarloAnalyzer().plot(results)The Seasonality Analyzer can help reveal how your strategy or instrument tends to behave during certain months or quarters. In the example below, we use EquityDrawdownAnalyzer to look at historical drawdowns for the base ETF portfolio, as represented in (examples/base_etf.png), highlighting periods of seasonal weakness or strength.
EquityDrawdownAnalyzer().plot(results)With more analytical tools and visualizations on the way!
The following chart illustrates the performance of a "broad_etf" portfolio, which typically includes a diverse set of ETFs spanning multiple asset classes, sectors, or geographies, providing a view of risk and returns across a wide investment universe.
With more on the way!
Each month, the notebook reads sp500_constituents/sp500_constituents_YYYYMM.csv and allocates capital equally across the top-5 S&P 500 constituents by market-cap weight (20 % each). The portfolio is fully rebalanced on the first trading day of every month. Returns are computed month-end to month-end and benchmarked against SPY.
| Step | Notebook |
|---|---|
| 1 · Scrape current constituents | 2_SP500_Constituents.ipynb |
| 2 · Backfill history (2000 →) | 3_Backfill_SP500_Constituents.ipynb |
| 3 · Run strategy & chart | 4_Top5_Monthly_Strategy.ipynb |




