Back to Nautilus Trader

Index Instrument

docs/concepts/instruments/index_instrument.md

1.230.05.0 KB
Original Source

Index Instrument

IndexInstrument represents a reference index such as an equity index, volatility index, or benchmark price series. It carries precision and increment metadata so Nautilus can store and route prices consistently, but it is not a directly tradable contract.

Examples include SPX.XCBO, VIX.XCBO, and venue-specific reference indexes.

Fields

<Tabs items={["Rust", "Python"]}> <Tab value="Rust">

FieldTypeRequired/defaultNotes
instrument_idInstrumentIdRequiredStored as id in Rust.
raw_symbolSymbolRequiredNative venue symbol.
currencyCurrencyRequiredReference currency for quoted values.
price_precisionu8RequiredDecimal places allowed for prices.
size_precisionu8RequiredDecimal places allowed for quantities.
price_incrementPriceRequiredSmallest valid price step.
size_incrementQuantityRequiredSmallest valid size step.
ts_eventUnixNanosRequiredEvent timestamp in nanoseconds.
ts_initUnixNanosRequiredInitialization timestamp in nanoseconds.
tick_schemeOption<Ustr>NoneRegistered variable tick scheme name.
infoOption<Params>NoneAdapter metadata.
</Tab> <Tab value="Python">
FieldTypeRequired/defaultNotes
instrument_idInstrumentIdRequired
raw_symbolSymbolRequiredNative venue symbol.
currencyCurrencyRequiredReference currency for quoted values.
price_precisionintRequiredDecimal places allowed for prices.
size_precisionintRequiredDecimal places allowed for quantities.
price_incrementPriceRequiredSmallest valid price step.
size_incrementQuantityRequiredSmallest valid size step.
ts_eventintRequiredEvent timestamp in nanoseconds.
ts_initintRequiredInitialization timestamp in nanoseconds.
tick_schemestr | NoneNoneRegistered variable tick scheme name.
infodict | NoneNoneAdapter metadata.
</Tab> </Tabs>

Note: Python constructors use instrument_id; Rust stores the same value as id.

Behavior

  • IndexInstrument has asset class Index and instrument class Spot.
  • It is a reference instrument and should not be used for order submission.
  • It has no limits, margins, fees, contract multiplier, expiry, or settlement currency.
  • Use option or futures types for tradable derivatives whose underlyings are indexes.

Example

rust
use nautilus_core::UnixNanos;
use nautilus_model::{
    identifiers::{InstrumentId, Symbol},
    instruments::IndexInstrument,
    types::{Currency, Price, Quantity},
};

let spx = IndexInstrument::builder()
    .instrument_id(InstrumentId::from("SPX.XCBO"))
    .raw_symbol(Symbol::from("SPX"))
    .currency(Currency::from("USD"))
    .price_precision(2)
    .size_precision(0)
    .price_increment(Price::from("0.01"))
    .size_increment(Quantity::from("1"))
    .ts_event(UnixNanos::default())
    .ts_init(UnixNanos::default())
    .build()
    .unwrap();
python
from nautilus_trader.model import Currency
from nautilus_trader.model import IndexInstrument
from nautilus_trader.model import InstrumentId
from nautilus_trader.model import Price
from nautilus_trader.model import Quantity
from nautilus_trader.model import Symbol

spx = IndexInstrument(
    instrument_id=InstrumentId.from_str("SPX.XCBO"),
    raw_symbol=Symbol("SPX"),
    currency=Currency.from_str("USD"),
    price_precision=2,
    size_precision=0,
    price_increment=Price.from_str("0.01"),
    size_increment=Quantity.from_str("1"),
    ts_event=0,
    ts_init=0,
)

Adapters

Representative adapters that create or consume IndexInstrument instruments include: