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 Instrument Registration

From Leeroopedia


Field Value
sources https://github.com/nautechsystems/nautilus_trader , https://nautilustrader.io/docs/
domains backtesting, instrument management, market definition
last_updated 2026-02-10 12:00 GMT

Overview

Instrument Registration is the principle of explicitly declaring and validating financial instrument definitions within a simulation environment before any market data or trading activity references them.

Description

Every financial instrument (equity, future, option, currency pair, cryptocurrency) carries metadata that is essential for correct simulation: price precision, size precision, tick size, lot size, margin requirements, multiplier, and settlement currency. In a live trading system this metadata is fetched from the exchange; in a backtest it must be provided upfront.

Instrument registration addresses the following concerns:

  • Type safety -- By requiring an explicit Instrument object, the engine guarantees that every downstream component (matching engine, position tracker, PnL calculator) has access to correctly typed instrument specifications.
  • Venue-instrument consistency -- An instrument must belong to a venue that has already been registered. A CurrencyPair cannot be added to a single-currency CASH account venue because the account cannot hold the base currency. These invariants are enforced at registration time.
  • Cache population -- The instrument is pushed into the engine's data cache and the simulated exchange's internal instrument registry, ensuring it is discoverable by strategies and by the matching engine.
  • Data client wiring -- Registration ensures a market data client exists for the instrument's venue, so that subsequent data additions can be routed correctly.

Usage

Apply this principle whenever you need to:

  • Define the tradable universe for a backtest.
  • Ensure that instruments are valid for their target venue's account type.
  • Populate the cache so that strategies can look up instrument metadata at runtime.
  • Prepare the matching engine to accept orders and data for a specific instrument.

Theoretical Basis

Instrument registration is a form of schema declaration for the simulation. It defines the contract between data producers (historical data wranglers) and data consumers (matching engine, strategy, portfolio).

Key theoretical elements:

  • Instrument as specification -- An instrument object is an immutable specification that defines the rules of a market: how prices are quoted, how sizes are measured, and what fees apply. It is analogous to a database schema -- you must define the table before inserting rows.
  • Venue affinity -- Each instrument has a venue field (instrument.id.venue). The registration logic validates that this venue exists in the engine, creating a directed dependency: venue must precede instrument, which must precede data.
  • Account-type validation -- Certain instrument types (e.g., CurrencyPair) require multi-currency accounts or margin accounts. The registration step enforces these constraints, preventing subtle PnL errors later.
  • Dual registration -- The instrument is registered in two places: the kernel's data engine cache (for strategy lookups) and the simulated exchange (for matching engine use). This mirrors the production architecture where instrument data flows through the data engine and the exchange independently.

Pseudocode:

FUNCTION register_instrument(engine, instrument):
    VALIDATE instrument is not None
    VALIDATE instrument.venue exists in engine.venues

    IF instrument is CurrencyPair AND venue is single-currency CASH:
        RAISE InvalidConfiguration

    ENSURE market data client exists for instrument.venue

    engine.kernel.data_engine.process(instrument)      -- adds to cache
    engine.venues[instrument.venue].add_instrument(instrument)  -- adds to exchange

    LOG "Added {instrument.id} Instrument"

Related Pages

Page Connections

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