API contract 2026-10-01: error codes, capabilities, has_more, filters, one grammar - #10
Open
0xFantomMenace wants to merge 1 commit into
Open
0xFantomMenace wants to merge 1 commit into
0xFantomMenace wants to merge 1 commit into
Conversation
…, one grammar Every request selects API version 2026-10-01, and the CLI reads the response shapes of that version. - Failures print the API's error_code, request_id, status, param and valid_values on the stderr JSON line, in every output format, and exit by error class: request errors 2, key and plan errors 3, the rest 4. WebSocket errors carry error_code the same way. - oxa capabilities [--exchange] [--datatype]: what each venue serves, as JSON or a table. No API key needed. - has_more on every paged JSON response and --out summary; pretty output prints the cursor to pass back. - --side buy|sell on trade history (every venue, ranged and recent), --triggered on order history (Hyperliquid, HIP-3, HIP-4), and --depth on full-depth L2 history; order book history --depth now applies on HIP-3, HIP-4 and Spot. - Stream and replay follow the SDK's channel table: bulk replay of every L4 channel on HIP-3, HIP-4 and Spot and of the full-depth books; live HIP-4 book and open interest; replay-only channels refused up front. - One grammar: oxa <datatype> <verb> --exchange <venue> (trades history, candles history, cvd history, instruments list, symbols list, summary get, prices history, freshness get, and --exchange spot on the shared datatypes Spot serves), with venue-only data under the venue (lighter l3, lighter accounts, spot pairs get, spot twap history). Earlier forms keep working.
Contributor
|
Target date: no date → 2026-10-08 Date status: Proposed. This is a proposed delivery target; owner confirmation is still required. Why: K requested a Target date on every active tracked item. This copies the already recorded planning/review date; it does not create owner agreement or change scope, status, priority, ownership, implementation/deployment/sending permission, or any release hold. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adopts the 0xArchive API contract
2026-10-01inoxa. Every request selects that API version (the0xArchive-Versionheader on REST,version=on WebSocket connections), including the requests the CLI sends itself for HIP-4 and Spot candles. Folded into the unreleased 1.10.0 section of the changelog; the version is unchanged.Requires
@0xarchive/sdk1.12.0 (0xArchiveIO/sdk-typescript#23), which the package already names as its floor.Changes
error_code,request_id,status, and, when the API names them,paramandvalid_valueson the stderr JSON line, in every output format. WebSocket errors fromoxa streamandoxa stream replaycarryerror_codetoo. Exit codes stay 2, 3, 4, 5 and are now chosen by error class: request errors (invalid_*,range_before_coverage,unsupported_for_venue,route_not_found,not_found) exit 2; key and plan errors (unauthorized,forbidden,historical_*_exceeded,insufficient_credits, ...) exit 3; rate limits, conflicts, upstream and internal errors,slow_consumer, and unknown codes exit 4. Without a code, 401 and 403 exit 3 and the rest 4, as before. The README lists the mapping.oxa capabilities [--exchange <venue>] [--datatype <d>]: rows fromclient.capabilities(), as JSON (default) or a table (--format pretty); one row prints in full. No API key needed.has_moreon every paged JSON response and--outsummary, next tonextCursor, from the SDK'shasMore(falling back to the cursor on an older SDK). Pretty output prints the cursor to pass back. The CLI has no auto-paging loops; the README shows a shell loop that stops onhas_more.--side buy|sellonoxa trades history(every venue, ranged and recent),oxa hip4 trades, andoxa spot trades;--triggered true|falseonoxa orders historyandoxa hip4 orders history;--depthonoxa l2 history, and onoxa orderbook historyfor HIP-3, HIP-4 and Spot.WS_CHANNEL_CAPABILITIES; the CLI keeps no channel list of its own.oxa stream replaynow runs bulk replay of every L4 channel on HIP-3, HIP-4 and Spot and oforderbook_full/hip3_orderbook_full(pretty output summarizes each page).oxa stream subscribeaccepts the live HIP-4 book and open interest and refuses the replay-only candle channels before connecting.oxa stream trades|orderbook --exchange hip4added.oxa <datatype> <verb> --exchange <venue>:trades history,candles history,cvd history --symbol,instruments list,symbols list,summary get,prices history,freshness get, and--exchange spoton the shared datatypes Spot serves (order book get and history, trades, candles, L4, order history, freshness, instruments). Venue-only data sits under the venue:oxa lighter l3 get|history,oxa lighter accounts by-l1,oxa spot pairs list|get,oxa spot twap history. Every earlier form keeps working and runs the same command; nothing is removed or hidden.JSON output follows the response shapes of
2026-10-01: RFC 3339timestampwithtimestampMson CVD, the HIP-3 oracle, Lighter liquidations and the resting orders of an L4 snapshot;snapshotTsMsbesidesnapshotTson levels; Lighter replay rows in the live shapes. Also fixed: the pretty order history table showed blank price and user columns.Tests
npm run typecheck,npm test,npm run build,npm run check:packpass with SDK 1.12.0: 435 passed, 17 skipped (the opt-in live suite and the old-SDK case).tests/contract.test.ts(errors and exit codes, capabilities,has_more, filters, both command forms),tests/contract-http.test.ts(requests and answers over a stubbed fetch, through the SDK and the CLI's own client), andtests/live.test.ts, read-only against the live API and skipped unlessOXA_LIVE_API_KEYis set. It passes against production (16 tests).--sideon Lighter and Lighter on Robinhood Chain is marked expected to fail there until the API applies that filter on those venues.npm pack --dry-runshipsLICENSE,README.md,dist/cli.js,dist/cli.js.map,package.json, as before.