---
name: aperiodic-preflight
description: Test a trading agent or strategy on a recorded crash or rally of real order books (Binance, OKX, Hyperliquid perps) before it trades real money, and open its flight report in the Pre-flight app on aperiodic.io. Use when someone wants to check what their agent would have filled, paid and lost in a crash or a rally.
---

# Aperiodic Pre-flight

Pre-flight replays recorded order books and fills a trading agent against the depth that was really there, with fees, funding, leverage caps and liquidation on the mark price. You run the user's agent over the event and produce its order log; the app at https://aperiodic.io/preflight fills it against the recorded book and writes the report.

## 1. Pick an event and a perp

- `2026-10-29`, 29 Oct 2026 (crash): The Binance hack: BNB moved 92 seconds after the sweep. binance-futures (Binance): BTC, ETH, BNB, SOL, XRP, AAVE, ENA, TRX; okx-perps (OKX): BTC, ETH, BNB, SOL, XRP, AAVE, ENA, TRX; hyperliquid-perps (Hyperliquid): BTC, ETH, BNB, SOL, XRP, AAVE, ENA, TRX
- `2025-10-10`, 10 Oct 2025 (crash): The liquidation cascade: half the book gone in six minutes. binance-futures (Binance): BTC, ETH, SOL, XRP, DOGE, HYPE, SUI, ENA, ATOM; okx-perps (OKX): BTC, ETH, SOL, XRP, DOGE, HYPE, SUI, ATOM; hyperliquid-perps (Hyperliquid): BTC, ETH, SOL, XRP, DOGE, HYPE, SUI, ENA, ATOM
- `2025-03-12`, 12 Mar 2025 (crash): A 50× ETH long liquidated into Hyperliquid’s vault. binance-futures (Binance): BTC, ETH, SOL; okx-perps (OKX): BTC, ETH, SOL, HYPE; hyperliquid-perps (Hyperliquid): BTC, ETH, SOL, HYPE
- `2025-02-03`, 2–3 Feb 2025 (crash): Tariffs priced on a Sunday night: everything bottomed at 02:08. binance-futures (Binance): BTC, ETH, SOL, XRP, DOGE, ADA, EIGEN; hyperliquid-perps (Hyperliquid): BTC, ETH, SOL, XRP, DOGE, ADA, EIGEN
- `2022-11-08`, 8–9 Nov 2022 (crash): FTX stops paying out; SOL’s book empties. binance-futures (Binance): BTC, ETH, SOL, BNB; okx-perps (OKX): BTC, ETH, SOL

Default to `2025-10-10` on `hyperliquid-perps` unless the user names one.

## 2. Get prices to decide on

If the agent has its own price feed for the event, use it. Otherwise read one-minute candles for the perp (OHLCV, no key needed):

```
https://aperiodic.io/api/preflight/ohlcv?day={day}&venue={venue}&coin={COIN}
```

It returns `start` (ISO time of the first candle, UTC), `step` (seconds per candle) and the arrays `o`, `h`, `l`, `c`, `v` (prices, and volume in USD), one value per candle, `null` where nothing traded. The order book Pre-flight fills against is not published; the app reads it on the server.

## 3. Run the agent without look-ahead

Step through the candles in order. At candle `i` the agent may only read values up to `i`. When it decides to trade, record an order. An order at time t fills at the close of the replay bar containing t, so give the time of the bar after the one your agent decided on. Keep the agent's own logic as it is; do not tune it on this day.

## 4. Write the order log

One line per order: an ISO UTC time, then the signed USD notional; positive buys, negative sells. Close the position before the end if the agent would.

```
time,usd
2025-10-10T21:05:00Z,150000
2025-10-10T22:30:00Z,-150000
```

## 5. Hand the user the report

Build this link, URL-encoding the log as the `orders` value in the hash, and give it to the user with one line on what the agent did:

```
https://aperiodic.io/preflight?day={day}&venue={venue}&coin={COIN}&agent=orders&equity={starting equity in USD}#orders={url-encoded log}
```

The log is sent to Aperiodic's server to be filled against the recorded book; it is used in memory for the run and not stored. The app opens on the run: its verdict, the run against a naive backtest and the real market, every limit it broke, what safety limits would have blocked, and where the backtest's money went. The user can export the report there as Markdown or JSON. If the log is long (over about 300 orders), tell the user to paste it into the "Your agent's orders" box in the app instead.

Fills are walked through the recorded depth bands of each bar, so they catch oversized orders, thin books and liquidations, not queue position or anything faster than a bar. It is a simulation on past data, not investment advice.
