NautilusTrader
ConceptsInstruments

Synthetic Instrument

SyntheticInstrument represents a local instrument whose price comes from a formula over other instruments. It is useful for spreads, baskets, ratios, and other derived prices that should appear in the system as an instrument.

Examples include (BTC.BINANCE + LTC.BINANCE) / 2.0 and ratio-style pairs built from component instrument prices.

Fields

FieldRust typePython typeRequired/defaultNotes
symbolSymbolSymbolRequiredSynthetic symbol used with venue SYNTH.
idInstrumentIdInstrumentIdDerivedInstrument ID formed from symbol.SYNTH.
price_precisionu8intRequiredDecimal places allowed for synthetic price.
price_incrementPricePriceDerivedSmallest price step from precision.
componentsVec<InstrumentId>list[InstrumentId]RequiredComponent instruments used by the formula.
formulaStringstrRequiredNumeric expression over component IDs.
ts_eventUnixNanosintRequiredEvent timestamp in nanoseconds.
ts_initUnixNanosintRequiredInitialization timestamp in nanoseconds.

Note: Python constructs the instrument ID from symbol and the SYNTH venue. Rust stores the same value as id.

Behavior

  • SyntheticInstrument is local to Nautilus and does not represent a venue orderable market.
  • It always uses the synthetic venue SYNTH.
  • Python requires at least two component instrument IDs.
  • The formula must compile against the supplied component identifiers before the object is valid.
  • It has no venue limits, margins, fees, order book, or adapter-specific metadata.

Example

use nautilus_core::UnixNanos;
use nautilus_model::{
    identifiers::{InstrumentId, Symbol},
    instruments::SyntheticInstrument,
};

let synthetic = SyntheticInstrument::new(
    Symbol::from("BTC-LTC"),
    2,
    vec![
        InstrumentId::from("BTC.BINANCE"),
        InstrumentId::from("LTC.BINANCE"),
    ],
    "(BTC.BINANCE + LTC.BINANCE) / 2.0",
    UnixNanos::default(),
    UnixNanos::default(),
);

Adapters

SyntheticInstrument is local only. It derives prices from component instruments that may come from any adapter already loaded into the system.

  • Synthetics covers formula-derived instruments and synthetic bars.
  • Data explains market data that references instruments.

On this page