Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Nautechsystems Nautilus trader Strategy Registration

From Leeroopedia


Field Value
sources https://github.com/nautechsystems/nautilus_trader , https://nautilustrader.io/docs/
domains backtesting, strategy management, trading system architecture
last_updated 2026-02-10 12:00 GMT

Overview

Strategy Registration is the principle of attaching one or more trading strategy instances to an execution environment so that they receive market data events, can submit orders, and participate in the system lifecycle.

Description

A trading strategy encapsulates the decision-making logic that transforms market observations into trading actions. However, a strategy cannot operate in isolation -- it must be wired into a runtime environment that provides data subscriptions, order routing, portfolio access, risk checks, and lifecycle management. Strategy registration is the step that performs this wiring.

The principle addresses the following concerns:

  • Lifecycle integration -- A registered strategy is managed by the engine's Trader component, which starts, stops, resets, and disposes it in coordination with the rest of the system. Unregistered strategies would miss lifecycle events and could leak resources.
  • Message bus subscription -- Registration connects the strategy to the kernel's message bus, enabling it to subscribe to data topics (quotes, trades, bars) and receive execution reports (order fills, position updates).
  • Execution routing -- Registered strategies can submit orders through the execution engine, which routes them to the correct venue's execution client. Without registration, the strategy would have no path to the matching engine.
  • Portfolio and cache access -- Registration provides the strategy with references to the portfolio (for position and balance queries) and the cache (for instrument lookups), both of which are owned by the kernel.
  • Multi-strategy support -- Multiple strategies can be registered with the same engine. Each strategy has a unique StrategyId that tags its orders and positions, enabling per-strategy PnL attribution and risk management.

Usage

Apply this principle whenever you need to:

  • Run one or more trading strategies in a backtest.
  • Ensure strategies are properly wired to data feeds, execution, and portfolio services.
  • Test strategy lifecycle behavior (initialization, start, stop, dispose).
  • Compose a portfolio of strategies that trade different instruments or employ different signals.

Theoretical Basis

Strategy registration follows the Plugin/Component pattern, where the engine acts as a host container and each strategy is a pluggable component that conforms to a known interface.

Key theoretical elements:

  • Strategy as component -- A strategy extends a base Strategy class that defines lifecycle hooks (on_start, on_stop, on_data, on_event) and provides convenience methods for subscribing to data and submitting orders.
  • Trader as registry -- The Trader object (owned by the kernel) maintains a list of registered strategies. Registration is delegated from BacktestEngine.add_strategy() to Trader.add_strategy(), which performs identity validation and wiring.
  • Deferred initialization -- Strategies are registered before the backtest run begins. Their on_start hook is called only when engine.run() triggers the kernel start sequence. This ensures that all data, venues, and instruments are fully set up before any strategy logic executes.
  • Idempotent identity -- Each strategy carries a StrategyId (e.g., "MyStrategy-001"). The trader validates that no duplicate IDs are registered, preventing accidental double-registration.

Pseudocode:

FUNCTION register_strategy(engine, strategy):
    VALIDATE strategy is of type Strategy
    VALIDATE strategy.id is unique among registered strategies

    engine.kernel.trader.add_strategy(strategy)
        -- Wires strategy to msgbus, cache, portfolio, clock
        -- Registers strategy ID for order/position tagging

    LOG "Added strategy {strategy.id}"

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment