Back to Nautilus Trader

QuoteTick

docs/concepts/data/quote_tick.md

1.231.02.6 KB
Original Source

QuoteTick

QuoteTick represents the top‑of‑book bid and ask for one instrument. It carries the best available bid and ask prices and sizes at a specific event time.

Fields

FieldRust typePython typeRequired/defaultNotes
instrument_idInstrumentIdInstrumentIdRequiredInstrument for the quote.
bid_pricePricePriceRequiredBest bid price.
ask_pricePricePriceRequiredBest ask price.
bid_sizeQuantityQuantityRequiredQuantity available at the best bid.
ask_sizeQuantityQuantityRequiredQuantity available at the best ask.
ts_eventUnixNanosintRequiredEvent timestamp in nanoseconds.
ts_initUnixNanosintRequiredInitialization timestamp in nanoseconds.

Behavior

  • Bid and ask prices must use the same precision.
  • Bid and ask sizes must use the same precision.
  • extract_price(PriceType.BID | ASK | MID) returns the requested price basis.
  • Quote bars can use BID, ASK, or MID price types.

Example

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

let quote = QuoteTick::new(
    InstrumentId::from("AUD/USD.SIM"),
    Price::from("0.65000"),
    Price::from("0.65002"),
    Quantity::from("1000000"),
    Quantity::from("1200000"),
    UnixNanos::from(1_000_000_000),
    UnixNanos::from(1_000_000_100),
);
python
from nautilus_trader.model import InstrumentId
from nautilus_trader.model import Price
from nautilus_trader.model import Quantity
from nautilus_trader.model import QuoteTick

quote = QuoteTick(
    instrument_id=InstrumentId.from_str("AUD/USD.SIM"),
    bid_price=Price.from_str("0.65000"),
    ask_price=Price.from_str("0.65002"),
    bid_size=Quantity.from_int(1_000_000),
    ask_size=Quantity.from_int(1_200_000),
    ts_event=1_000_000_000,
    ts_init=1_000_000_100,
)