agentleFS
voyager67voyager67/JaneStreet-Agentic-Skills/skills/hft-market-replay/SKILL.md

hft-market-replay

Skill13 starsChanged 6 days agoApache-2.0View on GitHub

Build or audit tick-by-tick historical market replay and HFT backtests with explicit feed/order latency, exchange event ordering, queue-aware fills, fees, and market-impact assumptions. Use for high-frequency or passive-order strategy evaluation; not for daily-bar backtests.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Treat a replay as a model of what the strategy could have observed and what the venue could have executed.

    line 7
  2. Distinctive:

    Choose fill models: Use MBO reconstruction where valid.

    line 15
  3. Distinctive:

    Do not describe bar-based fill assumptions as HFT-grade execution simulation.

    line 33
  4. Distinctive:

    Do not count a fill before exchange arrival or use unreceived market data.

    line 34
  5. Distinctive:

    Do not let the same historical displayed quantity fill multiple simulated orders unless the model explicitly controls consumption.

    line 35

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

HFT Historical Replay and Backtesting

Treat a replay as a model of what the strategy could have observed and what the venue could have executed. Historical book data is not an execution oracle: simulated orders do not automatically alter the historical market.

Workflow

  1. Define replay fidelity. Record feed granularity (trades, L1, L2, MBO), venue/session coverage, timestamp semantics, packet sequence availability, and whether the replay is deterministic.
  2. Separate clocks. Preserve exchange event time, packet receive time, strategy decision time, order-send time, exchange-arrival/ack time, fill time, and local response time wherever available. Document synchronization error and timestamp precision.
  3. Model latency paths. Represent feed latency, strategy compute delay, outbound order-entry latency, exchange processing/ack delay, and cancel latency separately. Use empirical distributions or conservative envelopes, not a single constant unless justified.
  4. Specify event ordering. Define what happens when a feed event, strategy timer, order arrival, acknowledgement, trade, and cancel cross. Test same-timestamp ties and out-of-order observations.
  5. Choose fill models. Use MBO reconstruction where valid. For L2, disclose queue uncertainty and compare conservative/probabilistic models. State whether fills consume displayed liquidity, whether multiple simulated orders can consume the same historical liquidity, and how partial fills work.
  6. Model fees and economics. Include maker/taker fees, rebates, funding/borrow/carry, tick/lot rounding, hedge costs, and contract multiplier. Report gross and net separately.
  7. Handle market impact honestly. Historical replay generally assumes the strategy is small enough not to change the historical path unless an impact/agent model is added. State this assumption and test capacity limits separately.
  8. Avoid future information. Strategy decisions at time t may only use messages received by t; a feed event's exchange timestamp does not mean the strategy had already received it. Use actual availability times in feature construction.
  9. Run scenarios. Baseline, conservative latency, stressed latency, conservative queue, alternate fill model, higher fees, and reduced liquidity. Keep parameter selection outside the final evaluation window.
  10. Produce an audit trail. Save config, data identifiers/hashes, code revision, random seeds, and per-order decision/fill/cancel traces.

Deliverable

  • Net P&L decomposition and returns, not only Sharpe.
  • Fill ratio, maker/taker mix, partial fills, rejected/cancelled orders.
  • Queue and latency assumptions, with sensitivity.
  • Turnover, fees/rebates, slippage, impact assumption, and capacity caveats.
  • Inventory/exposure distribution and maximum drawdown/tail loss.
  • Reproducibility metadata and known simulator limitations.

Guardrails

  • Do not describe bar-based fill assumptions as HFT-grade execution simulation.
  • Do not count a fill before exchange arrival or use unreceived market data.
  • Do not let the same historical displayed quantity fill multiple simulated orders unless the model explicitly controls consumption.
  • Backtest success is not evidence of live profitability; do not connect the research run to live trading.

Further reading

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.