← Notes

You can't learn only from the trades you took

Your own trades were chosen by your own model, so any statistic on them describes your selection as much as the market. Why we record everything, including what we skip.

Banks have a well-known problem with credit models. They only ever see whether approved loans were repaid. Rejected applicants never got a loan, so there is no outcome to learn from. A model retrained on that data learns about the people the old model liked, and gradually becomes blind to everyone else. Statisticians call the workaround reject inference; the underlying problem is selection bias.

A trading system has exactly the same problem, and it is easy to miss because the data looks so complete.

Your trades are a sample your model chose

Every trade a system takes passed through its own filters. Any statistic computed on those trades (the average outcome, how often things go badly, the typical market conditions at entry) is a mixture of two things: what the market did, and what the model picked. Change the model and the statistics change, even if the market didn’t move at all.

We learned this by misreading our own dashboard. A market-health indicator computed over the trades we had entered dropped sharply over a couple of days. It looked like a change in who was trading the market, and we started building an explanation around it. It was a step, not a trend, and it lined up to the day with a change to our own strategy. The market hadn’t changed; our selection had.

The test that settles it is simple: find a measure your own change cannot move. A statistic over everything that happened in the market, traded or not, is immune to your strategy. In that case the market-wide version was flat across the same days. One line of the dashboard was measuring the market and the other was measuring us.

Record everything, not just what you trade

The structural fix is to keep the data your model rejected. Our systems record every event for every asset they watch, whether or not we trade it, and keep it. That archive is the only place where the answer to “what would have happened if we had done something else?” exists.

It is used for more than avoiding mistakes:

  • Counterfactuals. To test a different entry or exit rule, replay it over everything, not over the trades the current rule happened to select.
  • Rebuilding features. When a new input is added to a model, it can be computed for past data from the raw events, exactly as the live system would have computed it at the time.
  • Checking the skipped side. Looking at what the model turned down is the only way to know what its caution costs.

The archive has its own traps

Having all the data doesn’t make every measurement correct. Two rules we follow:

  • Replay both arms. Never compare a replayed strategy against live results. Live has real costs and real fills; a replay has neither. Replay the old rule and the new one over the same data with the same assumptions, and read the difference.
  • Distrust short histories. An asset with only a handful of events over a few seconds can show an absurd peak that no one could have traded. Require enough history before trusting any statistic about extremes.

The general habit is to ask, for every number, which population is this computed over, and who chose it? If the answer is “us”, the number is partly about us.