Skip to main content

Chapter 1 · Quantitative Finance

The Art of Losing Slowly: Risk, Variance, and Decision-Making

Learn why a positive expected value can still ruin you. Risk, variance and the risk of ruin, explained in Python with an interactive model.

By Updated 11 min Beginner

Banner for The Art of Losing Slowly
On this page

Almost everyone who thinks about money thinks about winning. Far fewer people spend any time on the other side of it, which is how to lose well. I don’t mean making reckless bets and shrugging when they fail. I mean being deliberate about it, deciding in advance how much you are willing to lose, how often, and under what circumstances. Managing risk is not about avoiding loss altogether, because you can’t. It is about controlling the size and the timing of your losses so that none of them are ever big enough to take you out of the game. The people who last are rarely the ones who never fall. They are the ones who have learned to fall in a way they can recover from.

That is what I mean by losing slowly. It is accepting that uncertainty is permanent and refusing to panic about it, holding your convictions loosely enough that you can change your mind, and knowing when to push and when to sit still. It is playing the long game even when the short term feels like chaos. Get this right and you can start to tell the difference between real, sustainable progress and a run of good luck that was always going to end.

Where this series is going

This is the first chapter of a series that starts with a coin flip and ends with a working exchange. Think for a second about where the prices you plot actually come from. Every one of them came out of a matching engine, where two orders met under some rule about who got there first, a trade printed, and a number showed up on a chart. Almost nobody who models markets has ever looked inside that box. By the end of this series, you will have built one yourself.

We get there in six phases:

  • Phase 1: The Price of Risk (Chapters 1–4). Expected value and variance, loans and default, tranching, and yield curves. You finish able to put a defensible number on a stream of future cash flows.
  • Phase 2: Markets and Portfolios (Chapters 5–8). Real price series, Markowitz allocation, options, and Value at Risk. You finish able to build a portfolio and say how much of it you could lose.
  • Phase 3: The Stochastic Core (Chapters 9–11). Random walks, Itô’s Lemma, and a Black-Scholes pricer we derive rather than quote. This is the hardest maths in the series, and the last stop before we start building.
  • Phase 4: Building the Venue (Chapters 12–17). The order book, the matching engine, deterministic replay, the market data feed, and a Rust hot path.
  • Phase 5: Trading Against It (Chapters 18–21). Book reconstruction, microstructure signals, execution, and a market maker.
  • Phase 6: The Risk Engine (Chapters 22–24). Everything from Phases 1 through 3 turns into enforcement code that governs the running system.

This chapter is the foundation the whole thing rests on. It is about what risk actually is, and why the obvious way to measure a bet is not good enough.

Understanding Risk

Risk sits behind almost every decision we make. We take it on when we cross the street, when we start a new job, and when we decide to trust someone’s word. Most of the time we handle it without really thinking, weighing the outcomes, reading the situation, and adjusting as we go. Everyday life is decent training for this, but it comes with a catch. Because we get away with so many small risks, we grow comfortable with risk in general, and that comfort quietly leads us to underestimate the ones that actually matter.

Financial decisions are where that comfort tends to fall apart. Even very smart people with strong opinions about markets turn out to be bad at judging financial risk, and the 2008 to 2009 crisis is the obvious example of an entire industry underestimating it at once. So it is worth building a deep enough understanding of risk that we can actually manage the amount of it we choose to live with.

Let’s work through an example, and since gambling makes the mechanics obvious, we’ll start there. Imagine you pay €1 to draw a single card from a standard deck. If you pull the ace of spades you win €50, and otherwise you get nothing. Would you take that bet?

Most people would, because it feels like a small risk for a big reward. Now let’s flip it around and put you on the other side of the table as the banker. This time you collect €1 whenever the ace of spades is not drawn, but you pay out €49 on the times it is.

We can make the same game feel completely different just by scaling the stakes up by a factor of 100. Now you are risking €4900 for the chance to make €100, and almost everyone hesitates at that, even though the odds have not changed at all from the smaller version. It simply feels like a bad deal. We can check that instinct by calculating the expected value of the bet:

E(Bet)=152(−€4900)+5152(€100)=10026 or about €4E(\text{Bet}) = \frac{1}{52}(-€4900) + \frac{51}{52}(€100) = \frac{100}{26} \text{ or about €4}

So the bet is still positive on average. Now watch what happens if we split it into 50 much smaller bets played one after another. In each round we risk €98 for a chance to gain €2. Our total possible loss is still €4900 and our total possible gain is still €100, so nothing about the extremes has moved. What has moved is everything in between. The chance of losing everything has collapsed to almost nothing, around 10^-86, while the chance of walking away with the full gain is (51/52)^50 = 37.87%.

So what actually changed? Not the expected value, which stayed exactly where it was. What changed was the variance. Variance measures how spread out the possible outcomes are, and it turns out to be one of the most useful tools we have for telling a good bet apart from a bad one.

You don’t have to take that on faith. The model below is this exact bet, and you can drive it yourself. The slider controls how many rounds you split the bet into, while the total exposure stays pinned at €4,900 no matter what you choose. Move it and watch the expected value stay almost perfectly still while the red catastrophic outcome quietly disappears.

RiskCurveLab · same bet, more piecesexposure fixed at €4,900
Expected value
+€4
barely moves
Chance of a loss
17.6%
Chance of losing ≥ €1,000
0.08%
the ruin
Worst case
−€4,900
p = <0.01%

Drag the slider. The expected value hardly changes — but the red catastrophic bar shrinks toward nothing as the bet is divided. That gap, between an unchanged average and a collapsing worst case, is variance.

One €4,900 bet carries a 1-in-52 chance of a total wipeout; splitting the same bet into ten rounds keeps the expected value near +€4 but removes the catastrophic outcome.
Same bet, more pieces: the expected value holds while the risk of ruin collapses.

The whole idea here is that you can take a single large, risky bet and break it into many smaller ones that don’t all fail together. In finance we call this diversification, and it is what turns raw uncertainty into something you can actually manage. It is the reason an investor would often rather hold a 1% stake in 100 mortgages than a 100% stake in one. The total exposure is identical, but the way the risk behaves is completely different. Keep that mortgage example in mind, because in Chapter 3 we build exactly that structure, a pool of loans sliced into layers of risk, and then watch the layer everyone calls “safe” fail anyway.

Making decisions under uncertainty

Every decision that matters lives somewhere between what we know and what we can only guess at. Whether we are allocating capital or deciding when to close a trade, uncertainty is always sitting in the background, and yet the decision still has to be made. Making good decisions under uncertainty is not only about how likely an event is, but also about what happens to us if it actually occurs. A rare event with a huge impact can matter far more than a common one with a tiny effect. In practice this gets hard fast, because many events have effectively infinite possible outcomes. To keep things simple, let’s take an event with only a handful of outcomes. Say we run a company that places online ads, and we have to decide whether to run a particular ad. From historical data we know the probability and payoff of each choice:

DecisionProbabilityOutcome
Place the ads20%Customer buys → €5 profit
30%Customer does not buy → €1 loss
Do not place the ads50%Customer shows interest but doesn’t buy → €0 profit

There are several ways to weigh this up and decide what to do. I want to walk through two simple ones, because between them they capture most of the intuition. The first is the expected value decision, where we just calculate the expected value of each choice using this formula:

EV(decision)=∑(Probability of outcome×Value of outcome)\text{EV(decision)} = \sum (\text{Probability of outcome} \times \text{Value of outcome})

This is easy to automate in Python. We define the possible outcomes and their probabilities for each decision, then let the script compute the expected value of each option and compare them for us.

def expected_value(outcomes):
    """
    outcomes: list of (probability, payoff) pairs.
    """
    return sum(p * v for p, v in outcomes)

def evaluate_decisions(decisions):
    """
    decisions: dict where key = decision name,
               value = list of (probability, payoff) pairs.
    """
    results = {}
    for name, outcomes in decisions.items():
        results[name] = expected_value(outcomes)
    return results

if __name__ == "__main__":
    # All the options and their possible outcomes
    decisions = {
        "Place the ad": [(0.2, 5), (0.3, -1)],
        "Do not place the ad": [(1, 0)],
    }

    ev_results = evaluate_decisions(decisions)
    # Identify the best decision
    best_decision = max(ev_results, key=ev_results.get)
    print(f"Best decision under the Expected Value criterion: {best_decision}")

On the expected value criterion, we should run the ad. In general, expected value is the right thing to optimise when a decision gets made often enough for the law of large numbers to kick in. This is exactly that kind of decision, since we are making it for every single person who interacts with the ad, so across enough of them, running the ad should make us the most money.

Not everyone will be happy with that approach, though. A risk-averse decision maker cares more about limiting how bad things can get, and reaches for the worst-case method instead. That method makes sense when the decision is a one-off and the worst outcome would be catastrophic, because in that situation you want to be covered against the worst case no matter how unlikely it is. Notice that this calculation ignores probability entirely. We simply ask what the worst possible outcome is and plan around it.

Take a holiday as an example. The trip costs you €5000, and you are offered travel insurance on top for €200. Here is what can happen:

DecisionOutcome
Buy InsuranceTrip is fine → €200 loss
Trip is canceled → €200 loss
Do NOT buy InsuranceTrip is fine → €0 loss
Trip is canceled → €5000 loss

The worst thing that can happen is losing the full €5000, which is what you get when you skip the insurance and the trip gets cancelled. A risk-averse decision maker looks at that outcome, decides it is unacceptable, and buys the insurance.

Why Losing Slowly Beats Losing Fast

Learning to lose slowly is not about avoiding failure. It is about respecting uncertainty, and accepting that progress almost never arrives in a straight line. Sometimes the price of staying in the game is a series of small, deliberate losses along the way.

We don’t get to control outcomes, but we do control our exposure, meaning how much we risk, how often we risk it, and under what conditions. By diversifying, by sizing our decisions to what we can actually tolerate, and by holding a long-term view even when the short term feels chaotic, we can build a path where setbacks stay manageable instead of turning catastrophic.

In the end, winning is not about making the right decision every time. It is about building a system in which even your wrong decisions don’t break you. That phrase, a system in which even the wrong decisions don’t break you, is quite literally what Phase 6 of this series builds in code. It is a risk engine that sits in front of a live exchange and refuses the orders that could end the game. Everything between here and there is us earning the pieces we need to build it.

Next up is Chapter 2: Loans and Bonds. We take the most common financial contract on earth, which is borrowing money and paying it back over time, and turn it into the first thing in this series that we can actually put a price on. Variance was the idea. A bond is the first real instrument we build on top of it.

⚠️ Financial Education Disclaimer

The concepts and Python simulations discussed in this post (including Expected Value and Variance management) are for educational and philosophical purposes only.

  • Probabilistic Nature: Statistical models like “Expected Value” describe long-term averages; they do not predict the outcome of any single event. You can make the “right” decision and still experience a “wrong” outcome.
  • Model Limitations: Real-world risks are rarely as clean as a deck of cards or an insurance table. “Black Swan” events, meaning outliers that fall outside standard probability distributions, can occur and cause losses exceeding what a model predicts.
  • Personal Tolerance: Every individual has a different “Risk of Ruin.” A positive Expected Value (+EV) bet may still be inappropriate if the potential loss jeopardizes your financial survival.
  • Not Financial Advice: Decisions under uncertainty involve significant peril. Always consult a qualified professional before making high-stakes financial or insurance commitments.
Subscribe / Stdin

Get the next part

New parts of Finding P values and false hope land in your inbox the day they publish. No spam, unsubscribe in one click.

We send your address to Kit, our email provider, and ask you to confirm by email before anything is sent. See our Privacy Statement.