Back to Nautilus Trader

MarkPriceUpdate

docs/concepts/data/mark_price_update.md

1.231.02.1 KB
Original Source

MarkPriceUpdate

MarkPriceUpdate represents an instrument's mark price. Derivatives venues commonly use mark prices for margining, liquidation checks, and unrealized PnL calculations.

Fields

FieldRust typePython typeRequired/defaultNotes
instrument_idInstrumentIdInstrumentIdRequiredInstrument for the mark price.
valuePricePriceRequiredCurrent mark price.
ts_eventUnixNanosintRequiredEvent timestamp in nanoseconds.
ts_initUnixNanosintRequiredInitialization timestamp in nanoseconds.

Behavior

  • Mark prices are cached by instrument when received.
  • Backtests can feed mark prices to align margin and PnL behavior with venues that publish reference prices separately from trades.
  • The catalog stores mark prices with instrument ID and price precision metadata.

Example

rust
use nautilus_core::UnixNanos;
use nautilus_model::{
    data::MarkPriceUpdate,
    identifiers::InstrumentId,
    types::Price,
};

let mark = MarkPriceUpdate::new(
    InstrumentId::from("BTCUSDT-PERP.BINANCE"),
    Price::from("65000.10"),
    UnixNanos::from(1_000_000_000),
    UnixNanos::from(1_000_000_100),
);
python
from nautilus_trader.model import InstrumentId
from nautilus_trader.model import MarkPriceUpdate
from nautilus_trader.model import Price

mark = MarkPriceUpdate(
    instrument_id=InstrumentId.from_str("BTCUSDT-PERP.BINANCE"),
    value=Price.from_str("65000.10"),
    ts_event=1_000_000_000,
    ts_init=1_000_000_100,
)