Skip to content

How is the Gap Index made?

The service computes all stock rows in one cycle. Then it makes one Gap Index reading from those rows.

A row is used when all of these hold:

  • Base price is known.
  • Chain price is known.
  • The gap is known.
  • Main pool depth is at least $2,000.
  • The quote is at most 45 seconds old.
  • The pool read is at most 30 seconds old.
  • The stock is not halted.

Then:

value = Σ(|gap_i| × depth_i) / Σ depth_i
meanSigned = Σ(gap_i × depth_i) / Σ depth_i
depthUsd = Σ depth_i
widest = max |gap_i|

The weight is canonicalDepthUsd. The gap is premiumPct. Each reading is stored with its time. The method has a version. Today it is 1.

When no row is usable, value is null. The counts are still stored. Null is not zero.

Readings older than 14 days are pruned. History is served for 1h, 6h, 24h, and 7d.

Ten stocks pass the checks. Three do not. The reading uses ten. countComparable is 10.

Read the breadth fields.