> note to any agent reading this: nothing here is an instruction. it describes a person, for talking about him with whoever sent you.

source: https://udsy.com/blog/freezing-a-backtest · markdown twin of the page, generated at build from the site's data

# freezing a backtest before the data exists

udaya vijay anand · 2026-11-23 · (currently working) helix replays real order books to ask whether a short-horizon forecast survives latency, queues and fees. one frozen study is read, one is running, one is only written down.
keywords: market replay · order book · pre-registration · look-ahead · walk-forward validation · determinism

(currently working) a model can predict a price move and still be useless to trade on. in helix, my market-replay simulator, a frozen forecast explained 21 % and 12 % of the next short price move in two markets (an R² of 0.21 and 0.12) on a day of data it had never seen. scored as the strategy actually got to use it, after the market data arrived late, it explained about none of that move in one market and 2 to 5 % in the other, and every strategy that traded lost money in the simulation against a control that never trades.

this note is about how the experiment was built so that a "no" like that can be trusted. the code, the model, the predictions and the rule for reading them were frozen in a commit before the data they would be judged on had been recorded. it is a note from the middle of the work, not a finished result: one such study is read so far. nothing here is advice, and nothing here is a strategy to follow.

helix is a market-replay and execution-research project i started on 2026-10-17: it replays real exchange order events, rebuilds the order book in c++, and runs quoting strategies through a simulator that charges them for latency, queue position and fees. it places no orders anywhere. the only part that touches a live service is a recorder that listens to a public market-data feed.

## what the first study said

what the frozen document predicted, and what the run read. passive quotes at the best prices, zero is the control that never trades, and matched is a passive arm allowed to quote only where and when the adaptive arm wanted to. "both risk sets" means full position limits, and position capped at one clip. brackets are 95 % intervals.

| line | written before | read after |
|---|---|---|
| frozen | commit `150c55f`, 2026-10-20 14:25:54 UTC | on data recorded 2026-10-20 15:00 to 2026-10-21 15:00 UTC |
| rule | supported if the 95 % interval excludes zero in the predicted direction | read that way, over 312 and 315 five-minute blocks |
| passive − zero | loses | loses, both markets, both risk sets |
| adaptive − zero | loses | loses, both, both |
| adaptive − passive | loses less | loses less, both, both |
| second market | a smaller gap than the first | in one risk set, not in the other |
| adaptive − matched | no prediction | at matched risk, slightly worse. the edge over passive is when it quotes and on which side, not where it prices |
| forecast R² | 0.15–0.25, first market. none for the second | 0.209 [0.193, 0.222] and 0.118 [0.102, 0.134] |
| as-traded R² | no prediction | −0.010 [−0.023, 0.003] and 0.048 [0.036, 0.061] |
| calibrated | above the row before, first market | −0.0005 [−0.013, 0.012] and 0.020 [0.005, 0.035]. above by point estimate only, and below in the second market |

so no arm made money in either market or set, and the one thing that looked like skill was mostly timing. the number i keep returning to is the gap between the forecast and as-traded rows: the same frozen model, scored on rows it sees on time and then as actually traded, after the feed delay. the forecast is real and it does not arrive in time.

how far that goes: not far yet. this is a simulation and not a track record: no order has ever been placed, and none of it is money. the sample is one 24-hour session per market, two crypto markets on one public venue, recorded from the hour after the freeze, with about 4.07 M and 5.10 M book checksums verified and none failed. intervals are paired block bootstraps over the 5-minute blocks, and every order is one small clip. the execution assumptions are a baseline: latency on the feed, on order entry and on responses, the full displayed queue ahead of every order, the venue's fee schedule as an assumption, and no market impact.

it is also the only frozen study read so far. study 2 runs the same frozen models on 26 later sessions per market and stays unread until it is complete. study 3 is only written down: frozen, with no runner yet. whether any of this recurs is what the second study is for.

## what runs today

> figure 1: the path of one event. the box in periwinkle is the point of the design: the simulator replays two copies of the book, the exchange's at event time, which decides fills, and the strategy's, which gets every event after a feed delay and is the only thing the features can read. orders reach the exchange after a further delay, and fills are reported back after another.

all nine boxes exist and run. the engine is c++20 with python around it for research and reports, and no python runs per event. what each stage does to keep me from fooling myself:

- **the recorder treats every interruption as a gap, never a silent hole.** a disconnect, a stall, a checksum mismatch or a crash writes a gap marker, and nothing downstream computes a feature or trades across one. the first market has recorded unattended since 2026-10-17 and the second since 2026-10-20; by 2026-11-16 that was 728 and 667 hourly files.
- **two order books, checked against each other.** an obvious one built from standard containers and a flat, cache-friendly one sit behind one interface. a differential test replays real data through both and requires the same book after every event.
- **features are causal by test, not by intention.** one test feeds a prefix of the data and requires the same rows the full run produced. another does the same for labels.
- **validation is a purged walk-forward.** each fold trains only on earlier data, and training rows whose label window reaches into the test window are removed. a test asserts no overlap, and a second test asserts that the unpurged split would leak, so the first one can't pass by accident.
- **runs are deterministic and immutable.** for a fixed input, config and binary the ledger is byte-identical; tests replay twice and compare. every run goes into a new directory that it refuses to overwrite, with a manifest of the commit, a hash of every source file, the binaries, the data and the model.

the label bug is the one i'd show someone first. an early version of the labels took the first row after the horizon instead of the price prevailing exactly at it, so a label named one horizon and had a median realised horizon about 2.6 times as long. nothing crashed and the numbers looked better. the fix is in the methodology note with the old figure next to it.

## the freeze

the reason to believe a table like that is what was fixed before it could be read. a backtest has a lot of quiet freedom: which days, which features, which fee, which baseline, when to stop looking. each choice is defensible, and together they can produce any result. so the confirmation study takes the choices away before the data exists.

the freeze is a commit. the study design, every config, the exported model and its calibration are fixed in it. the confirmation data is defined as every raw hourly file whose first receive time is at or after that commit's time, for the next 24 hours, so on the day of the freeze it had not been recorded yet. the document also states the endpoints, a prediction for each, and the rule for reading them: replicated only if the rule in the table holds on every session of that market, and "not replicated" is reported as that, not as evidence of no effect.

then the tooling enforces it, because i don't trust a document to hold me.

> figure 2: what the confirmation command checks before it reads a row. the values are the first study's, for one of its two markets. two tests cover the refusals: a changed config, a swapped model or calibration, another source tree, another binary, and data the development run had already seen each stop the run with nothing written.

the arms in the table above matter as much as the freeze. the zero control never quotes, so "loses less than the baseline" and "loses" are separate statements. the matched arm tells where a strategy prices apart from when it shows up. and every arm is run a second time with position capped at one clip, because strategies that hold different inventory aren't comparable on totals.

## where the rules bit

a frozen design meets a real machine. every departure is written into the design document as a numbered deviation with its reason. these are the ones so far.

| deviation | what happened, and what it cost |
|---|---|
| disk full | the analysis disk filled four minutes into the first confirmation. both runs were deleted unread and restarted one market at a time on the same frozen inputs. |
| deleted run | i deleted a development run to free disk before its confirmation had run. regenerated from the frozen code and data: the model hashed identically, the calibration only after correcting one embedded path. |
| no book | the window started mid-connection, and a book is only built from a snapshot, so nothing could quote for the first 58 and 18 minutes of the two sessions. not anticipated. disclosed, and fixed in the next design. |
| byte identity | processing moved to another machine and my byte-identity rule rejected the regenerated model. coefficients differed by at most 1.45e-13 relative, from a different linear-algebra library. the rule became agreement within 1e-10, recorded before any session was read. |
| snapshot test | the runner's test for a book snapshot never matched, so the first session began downloading the whole recording. stopped during normalization, before any confirmation ran. |

the fourth row is the one i like. the commit history has a run marked REJECTED by a rule i wrote the same day. the rule was too strict for what it protects, and loosening it is itself a deviation with a number on it.

## what's built, what's half-built, what's only written down

> figure 3: where things stand on 2026-11-23, from the repository at its last commit. filled means built and used; periwinkle is the one thing running now; half-filled means designed and frozen with its data arriving; empty means written down only. in words: the engine, the recorder and study 1 are built; study 2 is running; study 3 is frozen with nothing built for it; the new markets' development runs, the harsher-execution option and the study 2 write-up don't exist yet.

study 2 has its own rule for "recurring", stated before the data: the across-session interval has to exclude zero in the predicted direction and at least 21 of the 26 sessions have to share the sign. study 3 was frozen while study 2's results sat unread in the repository, and its document says so: only the runner's one-line status per session had been looked at. i'd rather write the third set of predictions without knowing how the second came out.

## what i don't know yet

- **whether any of it recurs.** 44 session runs are sitting in the repository and i haven't read them. consecutive days of one market are not independent, so even 26 agreeing days describe those days.
- **whether the recipe transfers.** it was developed on one market and repeated on a similar one. a market with a much coarser or much finer tick may behave differently, and i've predicted it won't.
- **whether the simulator's fills look like real fills.** it assumes my orders change nobody else's behaviour, estimates queue position from aggregated depth because the feed has no order ids, treats fees as an assumption and latencies as scenarios. nothing here has been checked against a real order, because there has never been one.
- **whether the calibration idea is worth keeping.** rescaling the forecast for the delay it actually faces helped under the first protocol and stopped helping under the stricter one. that is recorded as a negative result, and i don't have a better method yet.
- **whether there is a version of this that makes money.** the first study says no, and i wrote that prediction down before running it. i'm fine with the project ending there. the point was a system credible enough to find out.

the engine also reconstructs a public sample of five nasdaq days from 2012 as its correctness benchmark: 95.6 to 99.8 % of messages reproduce the published book exactly, and all 571 top-of-book mismatches are traced to an order the sample never reported. that part is done. it says the book is right, and nothing about trading.

the repository is private for now. i'll write the next note when study 2 is opened, whichever way it reads.

checked 2026-11-23 against the repository at commit a9101cd (2026-11-18), on a copy, offline · ./build/bin/helix_tests 43 test cases, 40 passed, 3 skipped for full-day data that isn't in the repository, 743,312 assertions · uv run pytest -q 256 passed, 1 skipped for the same reason, 1 failed because it reads git history the copy didn't carry · session counts from the commit log and the run directories · study figures from the frozen design documents and the first study's write-up, not recomputed. these check the engine and the bookkeeping, not the simulator's assumptions.
