C.W.K.
Stream
Lesson 01 of 04 · published

Rolling the Dice on Purpose

~11 min · monte-carlo, simulation, numpy, percentiles

Level 0Open Gate
0 XP0/36 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete
"You can't know the one future. But you can roll thousands of plausible ones and look at the shape they make."

What a Monte Carlo simulation is

The future of a portfolio is uncertain, which sounds like a dead end — how do you compute with something you can't know? A Monte Carlo simulation is the honest answer. Instead of predicting one path, you generate many — thousands of randomly-sampled possible futures, each consistent with stated assumptions about how prices move — and then look at the distribution they form. Keep runs these over the portfolio with numpy: many random trials, each a plausible trajectory, aggregated into a picture of possibility rather than a single guessed number.

From one line to a fan of paths

A naive projection draws one line — "if you earn 7% a year, here's your balance in ten years." That single line hides everything that matters: the good years, the bad years, the sequence risk, the tail where things go badly. Monte Carlo replaces the line with a fan: run the ten-year trajectory thousands of times, each with different random draws for how each period turns out, and you get a spread. Now you can read percentile paths — the median outcome, the pessimistic 10th percentile, the optimistic 90th — and see the range of what's plausible, not just one flattering midpoint.

A distribution is more honest than a point estimate. Any single projected number pretends to a certainty that doesn't exist. Showing the spread — where the good and bad tails land, how wide the uncertainty really is — respects the truth that the future is a range, not a value. The fan of paths tells you what the single line hides.

The assumptions are inputs, not truths

A simulation is only as meaningful as its assumptions, and Keep makes those assumptions explicit inputs to the run: the horizon, the number of iterations, the hurdles, a mean-reversion coefficient, and calibration derived from real data (volatility, beta, anchors). Change the assumptions and you get a different fan — which is exactly right, because you're exploring "what if things behave like this?" The simulation doesn't claim its assumptions are true; it makes them visible and lets you see their consequences. That transparency is what separates an honest scenario tool from a black-box oracle.

Mean reversion is one such assumption, made explicit. The mean-reversion coefficient encodes a belief that extreme moves tend to pull back toward a center over time. It's a knob, not a law — a stated assumption you can dial. Keep exposes it as an input precisely so the scenario's behavior is a consequence of visible choices, not hidden magic baked into the engine.

Code

Many random paths, read as percentiles (illustrative)·python
import numpy as np

def simulate(seed_price, horizon, iterations, vol, drift, rng):
    # Each iteration is one plausible future path.
    paths = np.empty((iterations, horizon))
    for i in range(iterations):
        price = seed_price
        for t in range(horizon):
            shock = rng.normal(drift, vol)     # a random step this period
            price = price * (1 + shock)
            paths[i, t] = price
    # The output is a distribution, not a single number:
    return {
        "p10": np.percentile(paths, 10, axis=0),   # pessimistic band
        "p50": np.percentile(paths, 50, axis=0),   # median path
        "p90": np.percentile(paths, 90, axis=0),   # optimistic band
    }
# The fan (p10..p90) is the honest answer; a single line would hide the tails.

External links

Exercise

Take any 'projection' you've seen that draws a single line into the future (savings growth, project timeline, headcount plan). Describe what that one line hides. Then sketch the Monte Carlo version: what would you randomly vary each period, and what percentile bands (p10/p50/p90) would you report? Explain what a decision-maker learns from the fan that the single line actively conceals.
Hint
The single line always implies a smoothness that reality doesn't have. The fan reveals the two things that matter most and the line erases: how wide the uncertainty is, and how bad the bad tail gets. A median that looks fine with a terrifying p10 is a very different situation than a median with a tight band.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.