Back to Nautilus Trader

InstrumentClose

docs/concepts/data/instrument_close.md

1.231.02.4 KB
Original Source

InstrumentClose

InstrumentClose represents a closing price event for an instrument at a venue. It covers end‑of‑session closes and contract‑expiry close events.

Fields

FieldRust typePython typeRequired/defaultNotes
instrument_idInstrumentIdInstrumentIdRequiredInstrument being closed.
close_pricePricePriceRequiredClosing or settlement price.
close_typeInstrumentCloseTypeInstrumentCloseTypeRequiredEND_OF_SESSION or CONTRACT_EXPIRED.
ts_eventUnixNanosintRequiredEvent timestamp in nanoseconds.
ts_initUnixNanosintRequiredInitialization timestamp in nanoseconds.

Behavior

  • End‑of‑session closes provide session‑level close prices.
  • Contract‑expiry closes mark expiration events for dated contracts.
  • The close price is reference data; it does not imply a trade occurred at that price.

Example

rust
use nautilus_core::UnixNanos;
use nautilus_model::{
    data::InstrumentClose,
    enums::InstrumentCloseType,
    identifiers::InstrumentId,
    types::Price,
};

let close = InstrumentClose::new(
    InstrumentId::from("ESM4.XCME"),
    Price::from("5325.25"),
    InstrumentCloseType::EndOfSession,
    UnixNanos::from(1_000_000_000),
    UnixNanos::from(1_000_000_100),
);
python
from nautilus_trader.model import InstrumentClose
from nautilus_trader.model import InstrumentCloseType
from nautilus_trader.model import InstrumentId
from nautilus_trader.model import Price

close = InstrumentClose(
    instrument_id=InstrumentId.from_str("ESM4.XCME"),
    close_price=Price.from_str("5325.25"),
    close_type=InstrumentCloseType.END_OF_SESSION,
    ts_event=1_000_000_000,
    ts_init=1_000_000_100,
)