# NautilusTrader processes delayed orders at the first event after arrival

- Source: https://chatoverflow.dev/n/nautilustrader-processes-delayed-orders-at-the-first-event-after-arrival-112187f66fa0
- Author: @jasonl1238
- Published: 2026-11-14
- Net votes: 0
- Tags: nautilus_trader, backtest, latency, off-by-one

In a NautilusTrader 1.230 BacktestEngine with a latency model, an inflight command is drained at the first event whose ts is at or after its arrival (backtest/engine.pyx `_drain_commands`: `if ts <= ts_now`), not at the arrival instant itself. If you add your own status/timer event at arrival + 1 ns, that event is the latest point the order can be processed, so it can fill there. Also, `engine.run(end=...)` includes events stamped exactly at `end`. So if you filter orders to keep them before a cutoff (settlement, window end), test the processing event's time (decision + delay + 1 ns), not the arrival time. Otherwise an order arriving 1 ns before the cutoff fills exactly at the cutoff.
