Functions

Orderbook Functions

Order-flow analytics functions for measuring bid and ask depth at configurable depth percentages.

Orderbook functions work with orderbook data to analyze market depth, liquidity distribution, and order-flow patterns. They help identify support/resistance levels and market sentiment through bid/ask analysis.

CategoryDescription
Volume AnalysisSum bid and ask volumes within specified depth percentages to gauge buying and selling pressure.
Order Size AnalysisIdentify maximum and minimum order sizes to spot large participants and market microstructure patterns.
Market DepthAnalyze liquidity distribution to understand support/resistance levels and potential price impact.
FunctionDescription
sumBidsTotal bid volume within the depth window
sumAsksTotal ask volume within the depth window
maxBidAmountLargest single bid order within the depth window
maxAskAmountLargest single ask order within the depth window
minBidAmountSmallest bid order within the depth window
minAskAmountSmallest ask order within the depth window

sumBids

sumBids(source: TimeSeries, depthPct?: number = 10): number — total bid volume within depthPct of the mid-price.

ParameterTypeDescription
sourceTimeSeriesSource orderbook data series
depthPctnumberDepth percentage (default: 10)

Returns: number — total bid volume within depth.

var bidVolume = sumBids((source = orderbookData), (depthPct = 10));

sumAsks

sumAsks(source: TimeSeries, depthPct?: number = 10): number — total ask volume within depthPct of the mid-price.

ParameterTypeDescription
sourceTimeSeriesSource orderbook data series
depthPctnumberDepth percentage (default: 10)

Returns: number — total ask volume within depth.

var askVolume = sumAsks((source = orderbookData), (depthPct = 10));

maxBidAmount

maxBidAmount(source: TimeSeries, depthPct?: number = 10): number — largest single bid order within depthPct of the mid-price.

ParameterTypeDescription
sourceTimeSeriesSource orderbook data series
depthPctnumberDepth percentage (default: 10)

Returns: number — largest bid order size within depth.

var maxBid = maxBidAmount((source = orderbookData), (depthPct = 10));

maxAskAmount

maxAskAmount(source: TimeSeries, depthPct?: number = 10): number — largest single ask order within depthPct of the mid-price.

ParameterTypeDescription
sourceTimeSeriesSource orderbook data series
depthPctnumberDepth percentage (default: 10)

Returns: number — largest ask order size within depth.

var maxAsk = maxAskAmount((source = orderbookData), (depthPct = 10));

minBidAmount

minBidAmount(source: TimeSeries, depthPct?: number = 10): number — smallest bid order within depthPct of the mid-price.

ParameterTypeDescription
sourceTimeSeriesSource orderbook data series
depthPctnumberDepth percentage (default: 10)

Returns: number — smallest bid order size within depth.

var minBid = minBidAmount((source = orderbookData), (depthPct = 10));

minAskAmount

minAskAmount(source: TimeSeries, depthPct?: number = 10): number — smallest ask order within depthPct of the mid-price.

ParameterTypeDescription
sourceTimeSeriesSource orderbook data series
depthPctnumberDepth percentage (default: 10)

Returns: number — smallest ask order size within depth.

var minAsk = minAskAmount((source = orderbookData), (depthPct = 10));

Best Practices

Depth Analysis
Use smaller depth percentages (1-5) to focus on top-of-book activity, and larger percentages (10-20) for overall market depth analysis.
Volume Imbalance
Significant bid/ask volume imbalances often precede price movements. High bid volume suggests upward pressure; high ask volume suggests downward pressure.
Large Order Impact
Monitor maximum order sizes for signs of institutional activity. Sudden appearance of large orders can indicate significant market events.