Skip to content

Accept --interval 1m on aggregated history, and page order flow with --cursor - #5

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 buckets at 1m, 5m, 15m or 1h, and reads a sent cursor.

validateInterval only allowed 5m to 1d, so oxa funding history, oxa oi history and oxa prices (and their HIP-4 forms) exited with a validation error on --interval 1m before sending anything.

oxa orders flow and oxa hip4 orders flow had no --cursor.

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 nextCursor; the paging help and --out summary fields are in draft #6, held until the switch is on.

Changes

  • validateInterval accepts 1m; the --interval help on those commands, oxa liquidations volume, and the README tables list it.
  • oxa orders flow and oxa hip4 orders flow: the help and README now list 1m, 5m, 15m, 1h. They used to list 30m, 4h and 1d, which the API refuses. The CLI default stays 1h.
  • Published SDK releases type interval as OiFundingInterval, which does not include '1m' yet (a matching change is open in the TypeScript SDK). The SDK sends the value unchanged, so toSdkInterval() converts a validated interval at the three call sites. It can be removed once the dependency moves to an SDK release whose OiFundingInterval includes '1m'.
  • oxa orders flow and oxa hip4 orders flow take --cursor and send it: a resume point in Unix ms, and the API starts the response at the first bucket that opens after it. Commands without it are unchanged. --limit help says it is the maximum number of buckets, oldest first (default 1000, max 10000). The README documents --cursor and says how buckets are labelled.
  • New tests/order-flow.test.ts: the cursor is sent on the core and HIP-4 commands and a nextCursor in the response is printed in the envelope; it fails without the change.
  • New tests/intervals.test.ts: every served interval passes validation; 2h, 1w, 1s and an empty value exit before a request.
  • CHANGELOG: an Unreleased entry, including that order-flow nextCursor arrives with an API switch. No version bump.

Test plan

  • tsc --noEmit: clean.
  • vitest run: 73 passed (5 files).
  • 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.

…kets

The API now serves 1-minute buckets on funding, open interest, price,
liquidation-volume and breadth history. The CLI validated the aggregation
interval against 5m to 1d, so funding, oi and prices refused 1m before
sending.

- validateInterval accepts 1m, and the help and README list it.
- Published SDK releases leave 1m out of OiFundingInterval, although the
  SDK sends the value unchanged. toSdkInterval() converts a validated
  interval at the three call sites; drop it once the dependency is on an
  SDK release that includes 1m.
- orders flow help and README list the bucket widths the API serves (1m,
  5m, 15m, 1h), not 30m, 4h and 1d, which it refuses.
- New tests: every served interval passes validation, and 2h, 1w, 1s and
  an empty value exit before a request.
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. `oxa orders flow` and `oxa hip4 orders flow`
printed `nextCursor` but had no `--cursor` to follow it.

- `--cursor` on both commands, sent with the request. Commands without
  it are unchanged.
- `--limit` help says it counts buckets (default 1000, max 10000).
- With `--out`, the summary reports `has_more` and `nextCursor`, and
  pretty output says when more data is available, as order history
  does.
- README: the `--cursor` row and how to page.
- New test: the cursor is sent on the core and HIP-4 commands and the
  next cursor is printed. It fails without the change.
@0xFantomMenace 0xFantomMenace changed the title Accept --interval 1m on aggregated history, and list order flow's buckets Accept --interval 1m on aggregated history, and page order flow with --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 help and README must not tell users to page by it, and the
--out summary must not report has_more: false while more buckets exist.

- `--cursor` stays on `oxa orders flow` and `oxa hip4 orders flow`,
  described as a resume point in Unix ms. `--limit` is the maximum
  number of buckets, oldest first.
- The --out summary's has_more and nextCursor, the pretty "Has more"
  field and the "use --cursor to paginate" hint are held back. The
  output envelope keeps its nextCursor, as before.
- README: no paging paragraph.
- CHANGELOG: order-flow nextCursor arrives with an API switch.
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