Market LabDocs

Trades

Consume live normalized trades in Python V2.

The trades source sends each accepted WebSocket trade to on_data:

history.source("btc@trades@bulkf")
history.source("btc@trades@hyperliquidf")
history.source("btc@trades@binancef@mmt")
SOURCE = "btc@trades@bulkf"


def on_data(ctx, history):
    if ctx.source != SOURCE:
        return

    trades = history.source(SOURCE)
    latest = history.source(SOURCE, 0)

Each record contains only price and size. The selector already identifies the symbol, exchange, and provider. Timestamps and aggressor side remain internal.

Trades are live-only. Backtests must use historical candles because Market Lab does not claim to reconstruct tick ordering from candle data.

When a script requests both MMT trades and trade-derived candles for the same market, Market Lab reuses one underlying trade subscription.

See Trade Data.