Skip to content
Velo

.depth

Fetches historical orderbook depth and yields one snapshot at a time. Requests wider than the endpoint's per-request limit are split automatically.

Example

end = client.timestamp()
 
params = {
    'exchange': 'binance-futures',
    'product': 'BTCUSDT',
    'begin': end - 60 * 60 * 1000,
    'end': end,
    'resolution': '5m',
}
 
for snapshot in client.depth(params):
    print(snapshot['timestamp'], snapshot['midprice'])

Parameters

params

  • Type: dict

See Depth parameters for the accepted fields.

Yields

dict

Each snapshot contains:

KeyTypeDescription
timestampfloatSnapshot timestamp in milliseconds.
midpricefloatMid-market price.
Price keysfloatEach remaining numeric key is a price whose value is the size at that price.

A batch with no matching depth data yields an empty dictionary.