Top-N Market Cap — selection & rebalancing
How the top stocks are selected
At each rebalance, the engine scores every company in the S&P 500 by market capitalization:
market cap = shares outstanding × that month's closing price
It sorts all ~500 companies by that score from largest to smallest and keeps the top N you chose (3, 5, or 10). Those N are held in equal weight — e.g. for N=5, each name is 20% of the portfolio. Because the biggest companies stay big, the basket changes slowly and is usually dominated by mega-caps (Apple, Microsoft, Nvidia, Alphabet, Amazon…).
When it buys and sells (the rebalance)
All prices are month-end closes — the closing price on the last trading day of each month. The trade is modeled at that close. For Market Cap, the ranking and the trade happen on the same day (the engine ranks by that day's close and trades at that day's close — there is no look-ahead, since only that day's prices are used).
Worked example — N = 5, quarterly rebalance
Say you start in January 2021 with $10,000 plus $1,000/month, N = 5, rebalancing every 3 months.
- Tue, 31 Mar 2021 — at the closing bell. Rank all ~500 S&P 500 companies by market cap using the 31 Mar closing prices. Suppose the top 5 are AAPL, MSFT, AMZN, GOOGL, NVDA. Buy each at 20%, executed at the 31 Mar close.
- Apr & May 2021 — no trading. The five holdings drift with prices. Your $1,000 monthly contribution is added pro-rata across the current holdings (it does not reset the weights).
- Wed, 30 Jun 2021 — at the closing bell. Re-rank by 30 Jun closes. If, say, NVDA is still top-5 but TSLA has overtaken GOOGL, the engine sells GOOGL, buys TSLA, and resets all five back to 20% — all at the 30 Jun close.
- Thereafter the same thing repeats every quarter (30 Sep, 31 Dec, …).
So a "March rebalance" means: decide and trade at the last trading day of March, at the close — not the first day of April, and not intraday. Between rebalances nothing is bought or sold except the monthly top-up.
Why month-end close? Monthly closing prices keep the dataset auditable and reproducible. The simulator does not model a specific clock time, the next day's open, or intraday execution — every trade is assumed to fill at the month-end closing price.
The Rebalance style controls what happens to the weights at each rebalance — a full equal-weight reset, a reset only when the line-up changes, or trading just the additions and removals.