One engine for backtest and live
NautilusTrader was chosen so that a backtest and a live node run the same strategy class, unchanged. A strategy is not rewritten when it moves from research to paper to the demo account; only the venue under it changes.
A book, not a list of trades
The strategy publishes a book: the weight it wants in each of the 27 perpetual futures, long or short, times the capital. The router compares that book with what the venue holds and sends market orders for the difference. A coin missing from the book is wanted at zero. A leg the router cannot place is logged as drift and raises an alert; it is not chased with more orders.
Each leg warms up on its own. History for every symbol is requested from the venue and fed in before the book may trade, and the book closes a bar for all legs together only on live bars.
- Strategy
TargetBookPublishes the book it wants to hold. - Book router
BookRouterCompares the book with what the venue holds. - Safety gate
SafetyGovernorLimits, the prop-firm guard and the kill switch (sheet A-03). - Order queue
OrderPacerFirst in, first out, at a fixed pace. - Venue The paper venue, or the Bybit demo account.
- Event log
eventsEvery fill is recorded, and the log can only grow. - Ledger
apply_fillPositions and results folded from the fills.
FIG. 1 The path of an order, from the strategy's target to the ledger.
One queue, at a fixed pace
Every order passes the safety gate, then joins one first-in, first-out queue that releases 5 orders per second to Bybit. That is well below the exchange’s own limit, which leaves room for the queries the adapter sends after each order. The paper venue needs no pacing.
Orders checked against the exchange’s record
Every 10 s, any order that has not changed for 15 s is looked up in Bybit’s own record. Depending on what Bybit says, the engine marks it rejected, cancels it, or sends it again once. If Bybit filled more than the engine saw, the engine records that and raises an alert; it never invents a fill.
Funding is charged by our own code
NautilusTrader carries funding rates as data but does not charge them. In backtests our own module charges every settlement. Its test replays a month of real BTCUSDT settlements from the archive against totals worked out outside the codebase. On the Bybit demo, settlements are read from Bybit’s transaction log every 10 min; the paper engine detects each settlement from Binance’s mark-price stream.
- 00:00 UTCDaily closeBybit closes the daily bar of every perpetual future in the book.
- +1 sRebalanceAs soon as every leg has its closed bar, the book sets each leg's target. Measured on 19 October 2026.
- 5 per sOrdersEach order passes the risk gate, then leaves through one queue at a fixed pace, below Bybit's own limit.
- /10 sOrder auditAn order that has not changed for 15 s is checked against Bybit's own record.
- /10 minFundingFunding settlements are read from Bybit's transaction log and written to the ledger.
- /5 minEquity snapshotThe engine values the book, checks that market data is still arriving, and runs the alert rules.
- on restartReconciliationAfter a restart, positions are compared with the exchange before the book may trade again.
+ is time after the close; / is a repeating interval.
FIG. 2 A day of the engine, from the daily close.
Results are folded from fills
When a venue keeps one position per instrument, earlier round trips disappear from its records. So results are never read from the venue’s positions. Every fill is replayed through one function, the same one that folds the live event log, so backtest and live report results by one definition.
Separate processes, on purpose
NautilusTrader starts its logger once per process, so every backtest runs in a fresh child process, and the paper and demo engines run as separate services, each with its own profile. The event log is a Postgres table that can only be appended to, which the database itself enforces. The engine queues events in memory and writes them in batches, so it never waits on the database.