Skip to content

LevelOneMarketData

QuantConnect.Brokerages.LevelOneOrderBook.LevelOneMarketData

LevelOneMarketData(
    symbol: Union[Symbol, str, BaseContract],
)

Bases: Object

This class has no documentation.

Initializes a new instance of the LevelOneMarketData class for a given symbol.

Parameters:

Name Type Description Default
symbol Union[Symbol, str, BaseContract]

The trading symbol to monitor.

required

base_data_received

base_data_received: _EventContainer[
    Callable[[Object, BaseDataEventArgs], Any], Any
]

Occurs when a new tick is received, such as a last trade update or a change in bid/ask values.

symbol

symbol: Symbol

Gets the symbol this service is tracking.

symbol_date_time_zone

symbol_date_time_zone: Any

Gets the time zone associated with the symbol's exchange. Used for consistent time stamping.

last_trade_price

last_trade_price: float

Gets the price of the last executed trade.

last_trade_size

last_trade_size: float

Gets the size of the last executed trade.

best_bid_price

best_bid_price: float

Gets the best available bid price.

best_bid_size

best_bid_size: float

Gets the size of the best available bid.

best_ask_price

best_ask_price: float

Gets the best available ask price.

best_ask_size

best_ask_size: float

Gets the size of the best available ask.

open_interest

open_interest: float

Gets the latest reported open interest value.

ignore_zero_size_updates

ignore_zero_size_updates: bool

Gets or sets a value indicating whether quote updates with a size of zero should be ignored when updating Level 1 market data.

When set to true, incoming bid or ask updates with a size of zero are treated as missing or incomplete and will not overwrite the existing known price or size. This is typically used for real-time (non-delayed) feeds where a zero size may indicate a temporary data gap rather than an actionable market change.

When set to false (default), zero-sized updates are applied normally, which is appropriate for delayed feeds or sources where a size of zero has semantic meaning (e.g., clearing out a book level).

update_last_trade

update_last_trade(
    trade_date_time_utc: Optional[datetime],
    last_quantity: Optional[float],
    last_price: Optional[float],
    sale_condition: str = ...,
    exchange: str = ...,
) -> None

Updates the last trade price and size. Constructs and publishes a trade Tick to the Data.IDataAggregator.

Parameters:

Name Type Description Default
trade_date_time_utc Optional[datetime]

The UTC timestamp when the trade occurred.

required
last_quantity Optional[float]

The quantity of the last trade.

required
last_price Optional[float]

The price at which the last trade occurred.

required
sale_condition str

Optional sale condition string.

...
exchange str

Optional exchange identifier.

...

update_open_interest

update_open_interest(
    open_interest_date_time_utc: Optional[datetime],
    open_interest: Optional[float],
) -> None

Updates the open interest value and publishes a corresponding Tick.

Parameters:

Name Type Description Default
open_interest_date_time_utc Optional[datetime]

The UTC timestamp of the open interest update.

required
open_interest Optional[float]

The reported open interest value.

required

update_quote

update_quote(
    quote_date_time_utc: Optional[datetime],
    bid_price: Optional[float],
    bid_size: Optional[float],
    ask_price: Optional[float],
    ask_size: Optional[float],
) -> None

Updates the best bid and ask prices and sizes. Constructs and publishes a quote Tick to the IDataAggregator.

Parameters:

Name Type Description Default
quote_date_time_utc Optional[datetime]

The UTC timestamp when the quote was received.

required
bid_price Optional[float]

The best bid price.

required
bid_size Optional[float]

The size available at the best bid.

required
ask_price Optional[float]

The best ask price.

required
ask_size Optional[float]

The size available at the best ask.

required