Phase 4: Advanced Extensions

Module 13: Adapters & ExtensionsIntegrating with new venues, data sources, and extending system capabilities

1. Adapter Architecture

Adapters serve as the bridge between the system core and external venues. Adhering to the Hexagonal Architecture (Module 03), the core engine remains agnostic to any specific exchange or market data source.

flowchart LR
                        subgraph core["🔷 NautilusTrader Core"]
                        direction TB
                        de["DataEngine"]
                        ee["ExecutionEngine"]
                        end

                        subgraph ports["📌 Ports & Adapters"]
                        direction LR
                        binance["Binance"]
                        ib["Interactive Brokers"]
                        custom["Custom Adapter"]
                        end

                        core ==> ports

                        style core fill:#0f1419,stroke:#4fc3f7,stroke-width:2px
                        style ports fill:#0f1419,stroke:#ab47bc,stroke-width:1px
Figure 1: Ports and Adapters architecture — The core is decoupled from specific adapters.

2. Supported Integrations in the 2026-03-25 Snapshot (15 total)

AdapterAsset ClassSupported FeaturesNotes
BinanceCrypto Exchange (CEX)Market data + executionStable integration with broad spot and derivatives coverage.
BitMEXCrypto Exchange (CEX)Market data + executionFocused on perpetuals and futures.
BybitCrypto Exchange (CEX)Market data + executionSupports spot, derivatives, and Unified Trading Accounts.
DeribitCrypto Exchange (CEX)Market data + executionBest known for crypto options and derivatives.
KrakenCrypto Exchange (CEX)Market data + executionStable venue coverage across spot and futures workflows.
OKXCrypto Exchange (CEX)Market data + executionCovers spot, derivatives, and options workflows.
AX ExchangePerpetuals ExchangeMarket data + executionBeta integration in the 2026-03-25 snapshot.
ArchitectBrokerage (multi-venue)Planned multi-venue brokerage supportListed as planned in the official integrations index.
dYdXCrypto Exchange (DEX)Market data + executionDecentralized derivatives venue.
HyperliquidCrypto Exchange (DEX)Market data + executionHigh-performance on-chain perpetuals venue.
PolymarketPrediction Market (DEX)Market data + executionEvent-contract venue with a specialized market model.
Interactive BrokersBrokerage (multi-venue)Market data + executionBroad coverage across equities, futures, options, and FX.
DatabentoData ProviderHistorical + live market dataProfessional-grade data adapter with no execution layer.
TardisCrypto Data ProviderHistorical market dataSpecialized crypto data provider with broad exchange coverage.
BetfairSports Betting ExchangeMarket data + executionIncludes the domain-specific BettingInstrument.
💡 How to read this list

This table follows the official integrations index in the 2026-03-25 NautilusTrader snapshot. Sandbox is not a native integration; it is an execution environment. AX Exchange and Architect are separate entries, with AX Exchange listed as a beta perpetuals venue and Architect listed as a planned multi-venue brokerage integration.

3. Internal Adapter Architecture

Each adapter typically consists of the following components:

flowchart LR
                        subgraph clients["🔌 Client Implementations"]
                        direction TB
                        dc["DataClient<br />(WebSocket)"]
                        ec["ExecutionClient<br />(REST API)"]
                        end

                        subgraph internal["🧩 Internal Mechanisms"]
                        direction TB
                        config["Configuration Mapping"]
                        parsers["Data Parsers"]
                        end

                        clients ==> internal

                        style clients fill:#0f1419,stroke:#4fc3f7,stroke-width:1px
                        style internal fill:#0f1419,stroke:#ab47bc,stroke-width:1px
Figure 2: Internal components of a production adapter

4. Custom Actor & System Extensions

In addition to trading strategies, you can use Actors to extend system functionality:

📊

Data Ingestors

Build custom Actors to collect data from third-party APIs (e.g., news, social media) and publish it to the MessageBus.

📧

Notification Services

Create an Actor to listen to trading events and dispatch Telegram/Email notifications when orders fill or stop-loss logic triggers.

📈

Performance Monitoring

Create an Actor to subscribe to all order events, calculating and displaying strategy performance metrics in real time.

🔧

Custom Indicators

When built-in indicators are insufficient, inherit from the Indicator base class to implement custom technical indicators.

from nautilus_trader.common.actor import Actor
from nautilus_trader.config import ActorConfig


class AlertActorConfig(ActorConfig, frozen=True):
    """Configuration for the alert Actor"""
    instrument_id: InstrumentId
    price_threshold: float  # Price threshold to trigger the alert


class AlertActor(Actor):
    """Dispatches notifications when the price exceeds the threshold"""

    def __init__(self, config: AlertActorConfig):
        super().__init__(config)
        self.instrument_id = config.instrument_id
        self.threshold = config.price_threshold

    def on_start(self):
        # Subscribe to quote updates
        self.subscribe_quote_ticks(self.instrument_id)

    def on_quote_tick(self, tick):
        if tick.ask_price.as_double() > self.threshold:
            self.log.warning(f"⚠️ THRESHOLD BREACH: Price exceeded {self.threshold}!")
            # Add Telegram/Email notification logic here

5. Extension Points Overview

Extension PointBase ClassPurpose
Trading StrategyStrategyImplements trading logic.
Generic ComponentsActorNon-order-routing generalized logic (monitoring, notifications, data ingestion).
Data ClientDataClientConnects to new market data sources.
Execution ClientExecutionClientConnects to new exchange execution APIs.
Technical IndicatorsIndicatorCustom technical indicator calculations.
Matching ModelFillModelCustom backtest matching and slippage logic.

6. Interactive Exercises

🧠 Exercise 1: Designing a Notification Actor

Design an Actor that logs a warning when a strategy’s open position PnL exceeds 5% of the account balance. What data must it subscribe to, and what cache states must it read?

Design Logic:

  1. on_start:
    • self.subscribe_quote_ticks(instrument_id) # Subscribe to quote updates
  2. on_quote_tick:
    • unrealized = self.portfolio.unrealized_pnl(instrument_id)
    • account = self.cache.account(account_id)
    • balance = account.balance_total(Currency.from_str("USDT"))
    • pnl_ratio = abs(unrealized / balance)
    • if pnl_ratio > 0.05:
          self.log.warning(f"⚠️ Position PnL exceeds 5%: {pnl_ratio:.1%}")

💡 Architectural Insights:

  • Actors cannot route orders; they are meant for monitoring, coordination, and notifications.
  • If automatic position liquidation is required, it should be implemented within a Strategy.
  • Implement a cooldown period to prevent redundant alerts during high volatility.
🧠 Exercise 2: Selecting an Adapter

Which adapter would you choose for the following scenarios?

  1. You want to trade US equities and futures.
  2. You want to trade BTC perpetuals with competitive fee tiers.
  3. You want to run backtests using historical crypto tick data.
  4. You want to trade BTC options.
  1. Interactive Brokers ← Broadest coverage of traditional markets.
  2. Bybit or Binance ← Both support perpetuals with competitive fee tiers.
  3. Tardis ← Dedicated historical crypto data provider covering 30+ exchanges.
  4. Deribit ← The largest crypto options exchange.

💡 Modular Composition:

Tardis (Data) + Deribit (Execution) = Backtesting with historical data + live trading execution.

🧠 Exercise 3: Custom Indicator Design

You want to create a “VWAP Deviation” indicator that calculates the percentage deviation of the current price from the VWAP. Which base class should you inherit from, and what methods must be implemented?

Design:

  1. Inherit from the Indicator base class.
  2. Implement the handle_bar(bar) method.
  3. Internal State Management:
    • cumulative_volume += bar.volume
    • cumulative_value += bar.close * bar.volume
    • vwap = cumulative_value / cumulative_volume
    • self.value = (bar.close - vwap) / vwap * 100
  4. Reset Method: reset() to clear cumulative values.

💡 Custom indicators are highly versatile:
You can build custom indicators and use them in strategies the same way you use the built-in indicators.

7. Module Key Takeaways

📋 Key Points
  1. Hexagonal Architecture ensures that integrating new adapters requires no modifications to the core code.
  2. 16 Officially Supported Adapters cover cryptocurrencies, traditional finance, DeFi, sports betting, prediction markets, and market data providers.
  3. Actors: Generic components for logic that does not involve order routing.
  4. 6 Extension Points: Strategy, Actor, DataClient, ExecutionClient, Indicator, and FillModel.
  5. Each adapter encapsulates configurations, data clients, execution clients, and data parsers.
🎉 Congratulations! You have completed the adapter module

You now have a comprehensive understanding of NautilusTrader’s architecture, core components, strategy development, and deployment workflows.
Recommended Next Steps:

  1. Start hands-on practice with the ema_cross.py example.
  2. Run your first strategy through the backtest engine.
  3. Join the NautilusTrader community and explore advanced topics in the official documentation.