@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / index / cadenceBandSec

Function: cadenceBandSec()

cadenceBandSec(cadenceSec): object

Defined in: packages/sdk/src/interval.ts:165

The inclusive window of raw intervalSec values that count as cadenceSeccadenceSec ± CADENCE_TOLERANCE_SEC. This is what turns a cadence filter into a range predicate server-side, so "15m" returns the 898s and 899s markets of the same series rather than only the exact-900s ones. Rungs are far enough apart that the bands never overlap.

THROWS on a non-finite or non-positive cadence rather than banding it. The other helpers here answer 0/null for junk because their callers render the result; this one's output becomes a Hasura predicate, where NaN would go on the wire as the string "NaN" and a <= 0 cadence would quietly select a 1–5s band that matches nothing. A filter that silently matches nothing is the worst of the three outcomes: it looks like an empty result set rather than the caller error it is.

Gotchas

  • Throws RangeError when cadenceSec is not a positive finite number.

Parameters

cadenceSec

number

Returns

object

minSec

minSec: number

maxSec

maxSec: number