Skip to content

Accept 1-minute aggregation buckets, and type the order flow cursor - #13

Merged
0xFantomMenace merged 3 commits into
masterfrom
docs/cvd-cursor-1m
Sep 27, 2026
Merged

0xFantomMenace merged 3 commits into
masterfrom
docs/cvd-cursor-1m

Conversation

@0xFantomMenace

@0xFantomMenace 0xFantomMenace commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

The 0xArchive API now serves 1-minute buckets (interval=1m) on funding, open interest, price, liquidation-volume and breadth history, on every venue. Order flow now honors its bucket parameter, with 1m (default), 5m, 15m and 1h, and reads a sent cursor.

OiFundingInterval types interval on all of those params, so TypeScript callers could not pass '1m' without a cast. There is no runtime validation to change.

OrderFlowParams had no cursor, so sending one needed a cast. The methods already send the params they are given, so this is a type and docs change.

The API does not return next_cursor on order flow yet. That arrives with an API switch, after SDK releases that forward the cursor are published. So this PR types cursor but does not document paging by nextCursor; the paging docs are in draft #14, held until the switch is on.

Changes

  • OiFundingInterval adds '1m'. FundingHistoryParams, OpenInterestHistoryParams, LiquidationVolumeParams, PriceHistoryParams and the HIP-3 breadth history params pick it up.
  • LiquidationVolumeParams.interval comment and the README interval lists include 1m.
  • OrderFlowParams.interval is documented with the buckets the API serves; the README order-flow example says the same.
  • OrderFlowParams.cursor (number | string): a resume point in Unix milliseconds; the response starts at the first bucket that opens after it. limit is documented as the maximum number of buckets, oldest first (default 1000, max 10000). The flow() JSDoc says how buckets are labelled. This covers orders.flow() on core and HIP-3 and hip4.getOrderFlow().
  • New test: interval: '1m' typed as OiFundingInterval goes through funding, open interest, liquidation volume and HIP-3 breadth, and every request carries it.
  • New test: the cursor reaches the request on core, HIP-3 and HIP-4 order flow, and a nextCursor in the response is surfaced.
  • CHANGELOG: an Unreleased entry, including that order-flow nextCursor arrives with an API switch. No version bump.

Test plan

  • vitest run: 73 passed.
  • tsc --noEmit: clean. Both new tests also typecheck under the project config; the interval test fails to compile against the old union, and the order-flow test against the old OrderFlowParams.
  • eslint src/: 0 errors, 36 warnings. This change only edits a type union, a type field and comments in src/.
  • Checked against the live API: interval=1m and 15m on order flow return 1-minute and 15-minute buckets, a sent cursor starts the response after it, and the response carries no next_cursor.

The API now serves 1-minute buckets on funding, open interest, price,
liquidation-volume and breadth history. OiFundingInterval types the
interval on all of those params, so a TypeScript caller could not pass
'1m' without a cast.

- OiFundingInterval includes '1m'; the liquidation-volume comment and
  the README interval lists follow.
- OrderFlowParams.interval documents the buckets the API serves: '1m'
  (the default), '5m', '15m' and '1h'.
- A test sends interval '1m', typed as OiFundingInterval, through
  funding, open interest, liquidation volume and HIP-3 breadth, and
  checks each request carries it.
The API now pages order flow on Hyperliquid, HIP-3 and HIP-4: a page
holds the oldest `limit` buckets of the window, and `nextCursor` is set
while more may follow. `OrderFlowParams` had no `cursor`, so TypeScript
callers could not follow it without a cast. `orders.flow()` and
`hip4.getOrderFlow()` already send the params they are given, so there
is no runtime change.

- `OrderFlowParams.cursor` (`number | string`), with docs for it and
  for `limit` as buckets per page (default 1000, max 10000).
- `flow()` JSDoc says how buckets are labelled and how to page.
- The README order-flow example follows `nextCursor` with the same
  start, end and interval.
- New test: the cursor reaches the request on core, HIP-3 and HIP-4 and
  `nextCursor` comes back. The test does not typecheck against the old
  `OrderFlowParams`.
@0xFantomMenace 0xFantomMenace changed the title Accept 1-minute aggregation buckets in OiFundingInterval Accept 1-minute aggregation buckets, and type the order flow cursor Sep 27, 2026
The API reads a sent order-flow cursor, but it does not return
next_cursor on order flow yet. That arrives with an API switch. Until
then the docs must not tell callers to page by it.

- `OrderFlowParams.cursor` stays. Its JSDoc describes it as a resume
  point (a Unix millisecond timestamp); `limit` is the maximum number of
  buckets, oldest first.
- The `flow()` JSDoc no longer says how to follow nextCursor.
- The README order-flow example is a single request again.
- CHANGELOG: order-flow nextCursor arrives with an API switch.
@0xFantomMenace
0xFantomMenace merged commit 61b2a0f into master Sep 27, 2026
1 check passed
@0xFantomMenace
0xFantomMenace deleted the docs/cvd-cursor-1m branch September 29, 2026 00:06
0xFantomMenace added a commit that referenced this pull request Sep 29, 2026
Accept 1-minute aggregation buckets, and type the order flow cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant