> For the complete documentation index, see [llms.txt](https://doc.lockerprotocol.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.lockerprotocol.com/hyper-agentic-trader/replay.md).

# Replaying the past

Play past days with the same code a real day uses, under the charter or under any strategy, judge each decision, and let the brain learn.

A replay plays days that have already happened, one moment a day, each from **what was known at that moment and nothing that was closed after it**. It uses the same day function a real day uses, so a replay is not a different program being nice to itself.

```sh
lpa pilot replay --from 2026-09-28 --days 5
lpa pilot replay --from 2026-09-01 --days 20 --strategy grid-long --name grid-sept --budget 5
```

## What a moment sees

At each moment, the dossier is cut at that instant:

* Hyperliquid's candles stop there, and the markets are rebuilt from them. The open interest, which the exchange does not keep in history, is said to be absent rather than guessed.
* The funding is read up to that moment.
* The fear and greed index of that day, when it is within the ninety days the feed's history covers. Older than that, the dossier says it is absent.
* The public economic calendar of **that week only**. A moment outside the week the feed publishes has no calendar, and the rule of events then refuses the opening.
* The headlines dated before it.
* hyperkeel, which publishes the present only, is said to be unavailable. A strategy whose signal reads the leaderboard therefore opens nothing in a replay.

For a week the public feed no longer publishes, the replay reads the official schedule of the high-impact USD releases instead: the employment report and the CPI from the Bureau of Labor Statistics, the FOMC statements from the Federal Reserve, the PCE and the GDP from the Bureau of Economic Analysis, December 2025 to December 2026, read on 2 October 2026. It is served as the week the feed would have published, with a line that says so. Other currencies and lesser releases are unknown there, and the rule of events, which counts the high-impact releases of the charter's currencies, still holds.

{% hint style="warning" %}
**How far back the candles allow.** The exchange keeps about 5000 candles of each interval, which is 52 days of quarter hours. A replay older than that prices its moments on the last hour closed, and walks its fills, its exits and its judgments on hourly candles, each read at its own close. It says nothing finer, and it says so. A span that starts before the quarter hours the exchange still keeps is walked whole in the finest candles that reach its start, never from the middle on.
{% endhint %}

## Which strategy it plays

| What you give           | What plays the days                                                                                         |
| ----------------------- | ----------------------------------------------------------------------------------------------------------- |
| nothing                 | the charter in use, with the strategy it names                                                              |
| `--strategy <name>`     | that strategy, shipped or yours, under the charter's own figures. The log, the report and the words name it |
| `--mode stop\|tranches` | the charter's figures with that kind of method, as before the charter named a strategy                      |

`--strategy` and `--mode` both say how the days are played, so they are refused together.

With neither, and a [choice](https://doc.lockerprotocol.com/hyper-agentic-trader/strategies.md#let-the-pilot-choose-each-day) set in the charter, the replay chooses at each moment exactly as a day would: by the table of the leading market's regime read at that moment, or by the model in one brief call. The choice is said in a line and kept as `choix.json` beside that moment's files, and the moment then runs whole under the strategy chosen.

{% hint style="info" %}
**A strategy decided by the code costs nothing.** With `decider: "code"` no model is resolved, `--model` is not needed and no token is spent: the code arms the day's trigger, the verdicts judge it, and the brain is not read, since nothing would review it. The replay says `the code decides` where it would name a model.
{% endhint %}

## The account of a replay

Each replay has an account of its own, under its own folder:

```
~/.lpa/pilot/replays/<name>/
```

The starting equity is 5000 USD for a replay by steps, 1000 USD for a strategy with a stop, a grid or a range, unless `--equity` says otherwise.

* An order fills at the price of the moment, with the taker's fees and the service's share.
* A limit farther than half a percent from the price **rests**: it fills at its own price at the first candle that touches it before the next moment, and is dropped at the next moment if no candle did. A plan still resting is never followed as if it had filled.
* A position by steps opened at a moment is followed on the candles up to the next one: the steps the market dipped through fill at their price with a maker's fees, the venue's funding accrues, the exit moves with the average, and the position closes on the candle that touches the exit. Its balance is written under its day. Otherwise it waits, with its average, its size and its latent result said at each moment.
* A grid is walked between the moments by the measure's own walk: each fill is done on the replay's account, and a grid that ends is set again on a range read no further than the moment it is set at.
* A range's session is walked the same way: the entry filled opens the position and the other is cancelled, its exit closes it, and the session is armed again on what a moment reads, never on what came after.
* With a stop, a held trade is followed to the next moment and closed on its stop, its target or its review; a trailing exit walks the hourly candles closed since.

What the last moment leaves held is followed to now, so the account is said as it stands today.

## The brain learns as it goes

Before each moment, the brain judges the earlier decisions the market has since answered, and draws a lesson from each. So the fifth moment decides with the lessons of the first four. At the end of the replay, what is still open is judged up to now.

That is the point of a replay: not the account's figure, but the lessons.

## The flags

| Flag         | Default                                       | Meaning                                                                                           |
| ------------ | --------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `--from`     | required                                      | the first day, `YYYY-MM-DD`                                                                       |
| `--days`     | `5`                                           | how many days to play, in order, 1 to 30                                                          |
| `--at`       | the strategy's `at`                           | the moment of each day, `HH:MM` UTC                                                               |
| `--name`     | `<from>_<days>d`                              | the folder, the account and the brain this replay uses. The same name replays on the same account |
| `--model`    | the model of `lpa config`                     | another provider and model, as `anthropic/claude-sonnet-5`                                        |
| `--brain`    | `main`                                        | another brain to learn in                                                                         |
| `--no-brain` | off                                           | play without a brain, learning nothing                                                            |
| `--equity`   | 5000 by steps, 1000 otherwise                 | the starting equity, 10 to 1,000,000                                                              |
| `--budget`   | `2`                                           | dollars on the model for the **whole** replay, 0 to 50                                            |
| `--votes`    | the strategy's                                | `first` or `all`                                                                                  |
| `--strategy` | none                                          | play the days under this strategy                                                                 |
| `--mode`     | none                                          | `stop` or `tranches`: play the charter's figures the other way on the same days                   |
| `--universe` | off, unless the charter's markets are `["*"]` | screen each moment on the measured universe instead of the named markets                          |

**What can go wrong:** a `--from` that is not a date of the calendar, or a first moment not over yet (*A replay starts in the past: the first moment is not over yet*); a strategy that is not on this computer; a provider `--model` does not name; a policy that allows none of the markets, named; `NO_MODEL` when a model is needed and none is set. A moment that is not fifteen minutes over yet is skipped, and the replay says so.

## On the universe

With `--universe`, or under a charter whose markets are `["*"]`, the replay screens each moment as a real day does, at that moment's own date: the price, the week's range and the volumes come from the candles, and the funding of the moment from the venue's history. The candidates are the markets that moment decides on, and each moment keeps its `screen.json`.

Two things a replay cannot know, and says, at its start and in each screen:

* The open interest of a past moment is not kept by the exchange. Its floor is not applied.
* The universe is the one measured on your disk, after the moments it screens.

Without a measure of the last fourteen days, the replay refuses by name before any model is asked for: run `lpa pilot universe --measure` first. To compare the two ways on the same days, replay once without the flag and once with it, under two names and two brains.

## What it prints

```
Replay sonnet-t2 with anthropic/claude-sonnet-5, brain sonnet: 5 moments played.
  2026-09-28_0030: no-trade. No trade: 1 said none. (2 calls, $0.0367)
  2026-09-29_0030: no-trade. No trade: 1 said none. [before it: 1 judged, 1 lesson] (3 calls, $0.0415)
  2026-09-30_0030: no-trade. No trade: 1 said none. [before it: 1 judged, 1 lesson] (3 calls, $0.0352)
  2026-10-01_0030: no-trade. No trade: 1 said none. [before it: 1 judged, 1 lesson] (3 calls, $0.0368)
  2026-10-02_0030: no-trade. No trade: 1 said none. [before it: 1 judged, 1 lesson] (3 calls, $0.0438)
Account: 1000.00 USD after 0 trades (+0.00 realized, 0.00 fees).
At the end: 1 judged, 0 lessons learnt.
Tokens: 14 calls; input 12940, cache read 0, cache written 30227 for 5 min and 0 for 1 h, output 9265; cache reuse 0 %; $0.1941
Files: ~/.lpa/pilot/replays/sonnet-t2
Log: ~/.lpa/logs/pilot.log
The brain: lpa pilot brain
```

The first line names the model, the brain and, with `--strategy`, the strategy. Each line after it is a day with its outcome, what the brain judged before it, and what the model cost. Then the account with what it still holds, the learning, and the tokens.

A program reads the same answer with `--json`: `name`, `dir`, `brain`, `model`, `strategy`, `moments` (each with `key`, `at`, `outcome`, `words`, `learnt`, `calls`, `usd`), `skipped`, `account`, `final`, `tokens` and `log`.

The replay writes the same files a real day does: `rapport.json` for the report, one folder per day, the lines of `~/.lpa/logs/pilot.log`, and every call to the model in the record (`lpa store tokens`).

## The budget

`--budget` is a hard ceiling in dollars on the whole replay, 2 USD unless you raise it, shared out moment by moment: each moment receives what is left as its own day's budget. A replay of many days with an expensive model is the easiest way to spend money by accident with this product, so the ceiling is low on purpose, and the model's price must be set in `lpa config` for the dollars to be counted at all.

## Comparing two ways on the same days

```sh
lpa pilot replay --from 2026-09-01 --days 20 --name steps --strategy ladder-long
lpa pilot replay --from 2026-09-01 --days 20 --name ranges --strategy range-reversal --brain ranges
```

Two names, two accounts, two brains, the same twenty days. Read each with `lpa pilot day --key ...` and `lpa pilot brain --name ...`. A replay says what a strategy and a model did on days that will not come back; what the method itself does over two years, without a model, is [`lpa pilot calibrate --strategy`](https://doc.lockerprotocol.com/hyper-agentic-trader/calibrate.md#measuring-a-strategy).

{% hint style="info" %}
**A replay is not a proof.** It says what this strategy and this model did on days that will not come back, with a calendar that is partly reconstructed and candles that are coarser the further back you go. Read it for the lessons and for the refusals, not as a forecast.
{% endhint %}

## Not the same as `lpa paper replay`

Two different tools, easy to confuse:

* **`lpa pilot replay`** replays **the pilot**: a model decides each day under a strategy, and the brain learns.
* **`lpa paper replay`** replays **a strategy file of its own**, of another kind entirely: no model at all, a set of conditions and an order written in JSON, walked over a tape you recorded with `lpa paper record`. It reports a win rate with its 95 % lower bound, costs under three slippage scenarios, and a verdict. Its file is not a pilot strategy. See [lpa paper](https://doc.lockerprotocol.com/hyper-agentic-trader/commands/paper.md).

## Learn more

* [The strategies](https://doc.lockerprotocol.com/hyper-agentic-trader/strategies.md)
* [The brain and the lessons](https://doc.lockerprotocol.com/hyper-agentic-trader/brain-and-lessons.md)
* [Measuring the method](https://doc.lockerprotocol.com/hyper-agentic-trader/calibrate.md)
* [lpa pilot](https://doc.lockerprotocol.com/hyper-agentic-trader/commands/pilot.md)
