Software developer · systems · graphics · markets

DanielCollison

I build software that has to be right: trading systems that can prove their own decisions, and image pipelines that run on the GPU in your hand.

Scroll
40,136
lines of code across the four projects
514
automated tests
1,939,565
video frames read by OCR
33,973
premarket setups replayed per sweep
35
live sessions recorded, event by event
0
bytes of your photo uploaded

Three systems, one pipeline

From pixels to positions.

A computer-vision harvester reads four years of livestreamed stock alerts. A tick-accurate backtester replays every one of them with no hindsight at all. A live bot then trades the one strategy that survived, and it has to make exactly the decisions its backtest would, or it doesn't trade.

  1. Livestream
    4 years of video
  2. 01Tape Reader
  3. 55,085
    ticker-days
  4. 02Hindsight
  5. signal_core
    shared decision code
  6. 03Parity
  7. Orders
    IBKR, premarket

01

Tape Reader

Computer vision that read four years of a livestream so I didn't have to.

  • Built withPython · yt-dlp · ffmpeg · RapidOCR / ONNX Runtime · multiprocessing

Every trading morning a YouTube stream scrolls an alert feed of the day's premarket movers. Nobody publishes that list. So I built a pipeline that watches the whole archive for me.

For each day it finds the feed in the video, reads the stream's on-screen clock to work out the premarket window, downloads just those two and a half hours in parallel chunks, and OCRs a thin band of the feed across a 12-process pool. Every read is checked against the listed-symbol universe and kept only on evidence.

  • No timezone maths anywhere. Each day's window comes from the clock printed on the stream itself, which handles a start time that drifts from 06:05 to 07:37 ET and a panel that moved 35 pixels between eras.
  • It knows where its data ends. An 8-second probe gates each 2.5-hour download. Three consecutive misses mark the archive's layout boundary, which it found on its own: April 2022.
  • Precision over recall. Scroll-clipped partials (NOW from NOWL) die to prefix dominance, one-off reads need 0.65 confidence (calibrated on audited crops), and delisted symbols need stronger evidence still.
  • Throughput. YouTube throttles each connection to about 1.7× realtime, so each day downloads in parallel chunks. Static frames are dropped before OCR. One day takes about 75 seconds.
FIG. 1.1 The OCR band reading the real 4 Aug 2026 feed: names, order, frame counts and confidences all from that day's result file. Accept/reject uses the pipeline's own filter rules.
FIG. 1.2 Every trading day the pipeline read, coloured by the number of distinct tickers it extracted. Hover a day.
Trading days read
1,073
Frames OCR'd
1,939,565
Ticker-days catalogued
55,085
Distinct symbols
4,542
OCR compute
47 h

02

Hindsight

A tick-accurate backtester, engineered to have none.

  • Built withPython 3.13 · pandas · NumPy · IBKR API · SQLite · pytest · GitHub Actions

Most backtests lie in small ways. They fill at prices that never traded, or let a 08:15 decision peek at 08:20's volume. Hindsight is built so it can't.

It replays each premarket on IBKR 10-second bars and resolves every candle that crosses a trigger, stop or target from the real trades inside it, then adds order latency. Every entry gate reads only data through the prior completed minute. The result is a backtest you can actually port to live trading, and a live bot that later did.

  • Tick-resolved fills. The fill is the first real print after the crossing, plus 100 ms. Targets fill at the crossing print, because a resting limit doesn't wait. That distinction once turned real wins into phantom break-evens. The microscope below re-derives this trade's fills from the raw ticks, in your browser, and checks them against the backtest.
  • Causal by construction. Volume, MACD, EMA and VWAP gates all read the prior completed minute. A volume surge that hasn't happened yet can't qualify a trade.
  • A cache that heals itself. 14.5 GB of bars and ticks. An empty tick response is never cached as truth: a gap memo retries across runs, then retires windows IBKR will never serve.
  • Research-grade output. Interactive HTML reports, per-trade charts, SQLite, Monte Carlo, t-statistics, confidence intervals, and concentration checks: what if the best three trades never happened?
FIG. 2.1 One real trade, replayed bar by bar: FLYX, 8 Jan 2026, on IBKR 10-second bars. The strategy's state machine runs alongside.
  1. Watching
  2. Rip
  3. Pullback
  4. Armed
  5. Filled
  6. ½ banked
  7. Trailing
  8. Exited
08:00:00 ET
FIG. 2.3 Where 33,973 setups went. Every bucket comes from the run's own results file and sums back to the total.
FIG. 2.4 612 times, price touched a trigger. Gates blocked 558 of them, and every one is accounted for.

91 of those trades only looked valid with hindsight: the volume that qualified them hadn't happened yet as of that bar.

Profitable isn't the same as real.

The backtester ran two strategies, and both made money in backtest. Only one held up: the wedge's 95% confidence interval straddles zero (t = 0.51) and its live paper results came in below expectation, so it was switched off despite a profitable backtest. The dip's interval clears zero, and its mean stays positive with its five best trades deleted.

Backtest research figures in R (multiples of risk per trade), not live returns.

FIG. 2.5 Mean R per trade with 95% confidence intervals.
FIG. 2.6 1,000 bootstrap resamples of the 54 real dip trades, computed in your browser just now.
Lines of Python
10,125
Tests
339
Backtest sweeps run
283
Ticker-day bar files cached
30,896
Tick windows cached
5,765

03

Parity

A live trading bot that must make the same decisions as its backtest, or it refuses to run.

  • Built withPython 3.13 · ib_async · asyncio · JSONL event sourcing · Windows Server · IB Gateway

The live bot doesn't re-implement the strategy. It imports the backtester's own decision code, pinned to an exact git SHA that it verifies at startup and stamps into every recording.

Every session is recorded as an append-only event log. The recording is replayed through the backtester and diffed decision by decision. A different gate verdict, trigger, stop or share count is a Class-0 divergence, and that's a bug by definition, not a tolerance. It ran first as a read-only observer, recording every decision and placing nothing; order code came after.

  • Budgeted attention. IBKR allows about 100 market-data lines and only three tick-by-tick streams. A tiered watchlist maps onto those limits exactly: every scanner mover monitored, confirmed movers on 5-second bars, and the three tick slots reserved for open positions and armed setups.
  • The bot is the stop. IBKR honours no stop orders premarket, so stops are synthetic: watched on every tick and fired as marketable limits. While a position is open, the process being up is the stop. So it adopts positions back after a crash.
  • Refuses rather than guesses. It won't arm on anything but a paper account, won't start on a SHA or strategy mismatch, and a kill file flattens everything on the next loop.
FIG. 3.1 Mission control: the real event log of the paper session on 14 Aug 2026, replayed. Account identifiers removed; nothing else is. It was the wedge's last day live: it was switched off the next morning.
SESSION 2026-08-14 PAPER signal_core@bd954e1 04:00:00

Tier A tick-by-tick · 3 slots

Tier B tracked · 5-second bars

Tier C scanner · snapshot only

seen 0tracked 0tick slots 0/3open 0realized $0.00

The parity loop

signal_corethe backtester's own decision code
pinned by git SHA · stamped @ bd954e1 in the recording
Hindsightbacktest engine
Paritylive bot
session_2026-08-14.jsonlevery bar, gate, decision and order
Replay + diffsame SHA, same recorded feed
  1. Class 0Decisions: qualification, arming, triggers, every gate, stops, share counts.Must be zero. Blocks the roadmap.
  2. Class 1Fills and latency: real vs simulated prices, signal-to-fill time.Measured. It is the slippage calibration.
  3. Class 2Environment: scanner universe, feed gaps, halts.Logged and trended, never failed.
Incident · 14 Aug 2026 · paper · resolved

The 88-second phantom

The bot booked a winning exit that the broker hadn't filled yet.

  1. Trigger fires on WETO. Long entry submitted.
  2. Filled: 242 shares at 8.7731. Stop 8.34, target 9.45 resting.
  3. A print at 9.47 crosses the target. The bot books +$168.66 and drops the position from its book.
  4. reconcile_alarm: "broker holds 242 WETO with NO position in the book". Thirteen times.
  5. The resting target finally fills. For 88 seconds a live position sat outside the book: no synthetic stop, no crash adoption, and a resting order nobody would have cancelled.

The fix: decide on the touch, settle on the broker.

The exit decision still happens on the first touch, so parity with the backtest is unchanged. Only the bookkeeping now waits for the broker's fill. Fill quantities are read, never assumed, and every session ends with an audit of IBKR's own execution records against the bot's ledger.

def _arm_target_confirm(self, pos: Position, price: float) -> None:
    """The price touched the target. Record the decision -- but do NOT book
    the exit, because the resting limit is a real order at the exchange and
    only IT can say whether we are flat."""
    self._confirming[pos.key()] = (price, systime.monotonic())
    self.rec.event("target_touched", ticker=pos.ticker, touch=price,
                   target=pos.target_price, shares=pos.remaining)

From live_bot/order_manager.py.

Lines of Python
3,844
Tests
175
Sessions recorded
35
Event log on disk
171 MB
To IBKR from the NY VPS
~1–3 ms

04

Lumina

A makeup and retouching app that runs entirely on your phone. Your photo never leaves it.

  • Built withWebGL2 · GLSL · MediaPipe (WebAssembly) · vanilla JavaScript · no framework, no build step

Makeup, skin, sculpt, hair, relight, background and 85 film filters: 28 tools, built from scratch on WebGL2 and on-device models.

Lumina finds a face as 478 landmarks with depth, turns them into soft region masks through the canonical face mesh, and runs every effect as a GPU shader. Nothing is generated and nothing is uploaded. It's feature-matched against the leading commercial beauty apps, and only the tools that would need a server are left out.

FIG. 4.1 What Lumina sees: its real cached landmarks for the sample photo, its canonical mesh, and its own region definitions. Hover the photo to magnify.
Sample portrait: a smiling woman in a pink top (CC0, Joshua McKnight via Wikimedia Commons).
Lumina's editor, open on the sample photo.

This is the real app, not a video.

The phone on the left runs Lumina itself, loaded from this site. It opens on the sample with cached face data, so nothing heavy downloads until you open a photo of your own. On a phone, it's better full screen.

Open Lumina full screen ↗

  • Hair, strand by strand. A matting pass estimates each edge pixel's share of hair from where its colour sits between hair and background, so recolouring never leaves a halo.
  • Sculpt that never tears. Fifty face controls defined once on the canonical mesh, applied through 468 detected points, and rasterised into an exactly invertible warp grid with a fold guard.
  • Background, rebuilt on the phone. To move the subject without dragging the background, it rebuilds what was behind them: a push-pull fill, PatchMatch with Wexler-style voting, then full-resolution detail.
  • Light in 3D. Relight builds normals from an inflated silhouette with the face mesh's depth matched in, and lights in linear space so shading stays natural.

28 tools · hover one

    Every tool reads the same masks and writes into the same four GPU passes.

    1. Retouch passskin, face and body: smoothing, healing, eyes, teeth, matte
    2. Hair passa matte strand by strand, then colour, care and grey on the hair's share of each pixel
    3. Composite passmakeup, background, people added from other photos
    4. Final passone warp for sculpt and body, crop and lens, relight, effects, grade, text
    Tools
    28
    Sculpt controls
    50
    Colour filters
    85
    On-device models
    4
    Lines of JS + GLSL
    13,703
    Bytes uploaded
    0

    Contact

    Let's build something that has to be right.

    I'm Daniel, a software developer drawn to problems where "roughly right" isn't good enough: money on the line, pixels under a magnifier, decisions that have to be explained afterwards.

    The four projects above cover computer vision, quantitative research, real-time systems and GPU graphics. If you're building something where correctness matters, I'd like to hear about it.