Skip to content

Accept 1-minute breadth buckets, and page order flow with a 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 breadth, open interest, funding, price and liquidation-volume history, on every venue. Order flow now honors its bucket parameter, with 1m (default), 5m, 15m and 1h, and reads a sent cursor.

Most methods here pass interval straight through, so they already work. HIP-3 breadth is the exception: it validates interval before sending and raised ValueError on 1m.

Order flow had no cursor parameter. A cursor keyword fell into **kwargs and was dropped.

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 adds cursor but does not document paging by next_cursor; the paging docs are in draft #14, held until the switch is on.

Changes

  • BreadthInterval and BREADTH_INTERVALS include "1m".
  • test_coverage_contract.py: the refused-interval example was 1m; it is now 2h, which the API still refuses. The accepted-interval parametrisation includes 1m.
  • Docstrings for funding and open interest, and the README interval lists, include 1m.
  • Order-flow docstring: it suggested 4h and 1d, which the API refuses. It now lists 1m (default), 5m, 15m, 1h, says buckets are labelled by open time in UTC with empty ones omitted, that a response holds the oldest limit buckets (default 1000, max 10000), that start is inclusive and end exclusive. The README order-flow example notes the same values.
  • orders.flow() and aflow() take cursor and send it (Hyperliquid, HIP-3 and HIP-4): a resume point in Unix milliseconds, and the response starts at the first bucket that opens after it. Requests without it are unchanged.
  • New tests: the cursor is sent on core, HIP-3 and HIP-4, sync and async, and a next_cursor in the response is surfaced. Both fail without the change.
  • CHANGELOG: an Unreleased entry, including that order-flow next_cursor arrives with an API switch. No version bump.

Test plan

  • pytest: 97 passed (95 plus the 2 order-flow cursor tests).
  • ruff check on the changed files: clean.
  • 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.
  • No other methods validate interval values, so nothing else changes behaviour.

The API now serves 1-minute buckets on breadth, open interest, funding,
price and liquidation-volume history. Breadth is the one method here that
checks interval before sending, so it refused 1m with a ValueError.

- BreadthInterval and BREADTH_INTERVALS include 1m. The test that used
  1m as its refused example now uses 2h, and the accepted list covers 1m.
- Funding and open interest docstrings, and the README interval lists,
  include 1m.
- The order-flow docstring suggested 4h and 1d, which the API refuses.
  It now lists 1m (the default), 5m, 15m and 1h.
The API now pages order flow on Hyperliquid, HIP-3 and HIP-4: a page
holds the oldest `limit` buckets of the window, and `next_cursor` is set
while more may follow. `orders.flow()` and `aflow()` had no `cursor`
parameter, and a `cursor` keyword fell into `**kwargs` and was dropped,
so every call returned the first page.

- `flow()` and `aflow()` take `cursor` and send it. Requests without it
  are unchanged.
- The docstring says how buckets are labelled and how to page, and that
  `limit` counts buckets (default 1000, max 10000).
- The README order-flow example pages a day at 1m until `next_cursor`
  is None.
- Tests: the cursor is sent on core, HIP-3 and HIP-4, sync and async,
  and `next_cursor` comes back. Both fail without the change.
@0xFantomMenace 0xFantomMenace changed the title Accept 1-minute breadth buckets and list order flow's real buckets Accept 1-minute breadth buckets, and page order flow with a 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.

- `flow()` keeps its `cursor` parameter. The docstring describes it as
  a resume point (a Unix millisecond timestamp) and no longer says how
  to follow next_cursor; `limit` is the maximum number of buckets.
- The README order-flow example is a single request again.
- CHANGELOG: order-flow next_cursor arrives with an API switch.
@0xFantomMenace
0xFantomMenace merged commit c8aef66 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 breadth buckets, and send a cursor on order flow
0xFantomMenace added a commit that referenced this pull request Sep 29, 2026
Accept 1-minute breadth buckets, and send a cursor on order flow
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