equity pretrade · kdb+

How it works

What this is

This site answers one question, continuously: if you sent an order to buy or sell V shares right now, what would it cost you to execute? Not commission — the market’s price for immediacy: crossing the bid–ask spread, plus the price impact of demanding more liquidity than the market happens to be offering this second. That per-share estimate is the expected cost (Es) on the dashboard, requoted every second for fifteen US equities and BTC/USD from live market data.

The pre-trade problem

Execution cost is dominated by two things you can observe before trading: how wide the spread is, and how large your order is relative to what the market trades in the time you give it. A 500-share order in a name printing 5,000 shares a second is invisible; the same order in a name printing 200 a second moves the price. Pre-trade cost models formalize that intuition, and a large research literature — from Almgren–Chriss’s optimal execution framework to the empirical impact studies of Lillo–Farmer and Bouchaud — studies exactly how those costs behave. The reading list at the bottom of the dashboard collects the canonical papers.

The model

The demo serves a compact parametric model with spread, volatility and participation-rate terms. Its inputs are recomputed every second from the tape:

Constants are calibrated offline against historical executions. It is a demo-grade model served honestly — and the more interesting part of this site is the machinery that keeps its inputs true in real time.

The data

Input is the consolidated US equity tape: every trade print across all exchanges and reporting facilities, and the national best bid and offer (NBBO). That is roughly 25–45 million rows on a busy day for this universe, alongside a 24/7 crypto feed for BTC/USD. Everything is served at least fifteen minutes delayed, by policy — the dashboard’s query clock is pinned behind real time and the server refuses fresher requests, so nothing here can be mistaken for a trading tool.

The pipeline

Under the hood is a q/kdb+ analytics engine — the technology used on production trading desks for exactly this workload — consuming the live consolidated tape, maintaining the per-second model state, and serving every query on the dashboard, including the site’s own latency telemetry. The entire system runs end-to-end on a deliberately small two-core virtual server.

Reading the dashboard

Colophon

kdb+/q at the core, run end-to-end on a small virtual server. Questions or feedback: send a message.