Saltar al contenido

100 · Investigación

105market-sim

Construir un mercado donde todos los operadores lanzan una moneda y aun así aparecen patrones en el gráfico, porque el libro de órdenes recuerda las órdenes en reposo.

Año
2026
Estado
Activo
  • Python
  • order book
  • simulation
  • Flask
  • pytest

Esta página solo está disponible en inglés.

The question

Technical analysts draw support, resistance and channels and say they mean something. If a market made only of coin-flipping traders draws the same picture, they don't need to.

What I did

A Python recreation of the core experiment from the YouTube video "I made a Market Simulation to see if Patterns are Real": a matching engine with a resting limit-order book (unit-tested so fills are exact), agents that buy or sell at random, candles built from the trade tape, and a depth heatmap of where resting orders sit. There is also a live version in the browser, a small Flask app with a depth ladder beside the candles.

What came out of it

The patterns show up every time, and the heatmap shows why: price stalls and bounces exactly where walls of old, unfilled orders sit. Compared with real Ford and Apple returns, the simulated market has fat tails like the real ones, but its volatility clustering fades much faster.

What I'd try next

A plain random-walk generator as a contrast, and a pattern detector that counts named patterns in noise versus real data instead of judging them by eye.

Un mercado de operadores aleatorios, semilla 42: el precio forma tendencias y se frena en niveles que coinciden con bandas de órdenes en reposo en el mapa de profundidad.
Un mercado de operadores aleatorios, semilla 42: el precio forma tendencias y se frena en niveles que coinciden con bandas de órdenes en reposo en el mapa de profundidad.
La simulación muestra colas gruesas como Ford y Apple, pero su agrupamiento de volatilidad se desvanece hacia cero más rápido que en las acciones reales.
La simulación muestra colas gruesas como Ford y Apple, pero su agrupamiento de volatilidad se desvanece hacia cero más rápido que en las acciones reales.