Market LabDocs

Orderbook

Normalized orderbook dictionaries available to Python V2.

An orderbook record contains:

KeyTypeMeaning
exchangestringNormalized exchange.
symbolstringNormalized symbol.
timestamp_msintegerSnapshot time in Unix milliseconds.
bidslistBid levels, best price first.
askslistAsk levels, best price first.

Each level contains price and quantity.

book = history.source("btc@orderbook@bulkf", 0)
if book is not None:
    best_bid = book["bids"][0]["price"]
    spread = ctx.study.spread(book)

The number of levels is limited by the source's configured depth. See Orderbook Source.