Skip to content

charton API


charton API / @chart-on/core / index / depthCurve

Function: depthCurve() ​

depthCurve(bids, asks): DepthCurve

Defined in: packages/core/src/numeric/depth.ts:37

Turn order-book levels into the two cumulative step series of a depth curve, for line series with lineType: 'step' on a NumericChart.

At a bid price p the bid curve shows the size of every bid at p or above (what a market sell down to p would fill); at an ask price, the ask curve shows every ask at p or below. Both curves drop to zero at their best price, so the spread shows as the gap between them.

Levels may come in any order. Levels with a non-finite price, or a size that is not a positive finite number, are skipped; levels at the same price are added together. A crossed book (best bid at or above the best ask) is not corrected: crossed reports it.

Parameters ​

bids ​

readonly BookLevel[]

asks ​

readonly BookLevel[]

Returns ​

DepthCurve