Skip to content

feat(hyperliquid): add spot pair name scraper#294

Merged
0237h merged 1 commit into
mainfrom
feat/hyperliquid-spot-metadata
May 5, 2026
Merged

feat(hyperliquid): add spot pair name scraper#294
0237h merged 1 commit into
mainfrom
feat/hyperliquid-spot-metadata

Conversation

@0237h
Copy link
Copy Markdown
Contributor

@0237h 0237h commented May 5, 2026

Summary

  • Polls the Hyperliquid Info API spotMeta endpoint and snapshots resolved spot pair names into a new state_spot_pair_names table (ReplacingMergeTree keyed on spot_coin).
  • Powers an additive spot_pair_name field on Token API routes that surface spot fills (e.g. resolves @107HYPE/USDC).
  • Wires hyperliquid into both the run and setup CLIs.

Configuration

  • HYPERLIQUID_INFO_URL — required; URL of a Hyperliquid Info API. The public endpoint is https://api.hyperliquid.xyz/info; deployments may also point this at a compatible /info reader.
  • HYPERLIQUID_FETCH_TIMEOUT_MS — optional (default 30000).
  • CLICKHOUSE_DATABASE_INSERT — should target the database where Token API queries spot fills.
  • AUTO_RESTART_DELAY — recommend 300+ seconds (spot listings change slowly; minutes-to-hours latency is fine).

🤖 Generated with Claude Code

Polls the Hyperliquid Info API spotMeta endpoint and writes resolved
`@N` → `BASE/QUOTE` pair names to ClickHouse. Powers an additive
`spot_pair_name` field on Token API responses.

- New service: services/hyperliquid (run loop fetches, resolves, inserts)
- New schema: sql.schemas/schema.hyperliquid.sql (state_spot_pair_names,
  ReplacingMergeTree(refresh_time) keyed on spot_coin)
- CLI wiring: `cli run hyperliquid` and `cli setup hyperliquid`

The Info URL is configurable via HYPERLIQUID_INFO_URL — the public
endpoint is `https://api.hyperliquid.xyz/info`; deployments may also
point this at a compatible `/info` reader.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@0237h 0237h requested a review from Copilot May 5, 2026 16:39
@0237h 0237h merged commit 8b6bfdb into main May 5, 2026
2 of 5 checks passed
@0237h 0237h deleted the feat/hyperliquid-spot-metadata branch May 5, 2026 16:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a Hyperliquid scraper that polls the Info API spotMeta endpoint to resolve spot pair identifiers (e.g. @107) into human-readable BASE/QUOTE names and stores them in ClickHouse for Token API enrichment.

Changes:

  • Adds state_spot_pair_names ClickHouse table schema (ReplacingMergeTree keyed by spot_coin).
  • Implements Hyperliquid Info API client + pair-name resolver and a scraper run() loop that snapshots results.
  • Wires hyperliquid into cli run and cli setup, with Bun test coverage for resolver and scraper insert behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
sql.schemas/schema.hyperliquid.sql Introduces ClickHouse table for spot pair name snapshots.
services/hyperliquid/info.ts Adds fetchSpotMeta client + resolvePairNames mapping logic.
services/hyperliquid/info.test.ts Tests for API parsing and @N/canonical pair resolution.
services/hyperliquid/index.ts Adds scraper runner that fetches, resolves, and inserts rows into ClickHouse.
services/hyperliquid/index.test.ts Tests scraper insert behavior and error metric handling.
cli.ts Adds run hyperliquid and setup hyperliquid CLI wiring and help text.

Comment thread services/hyperliquid/info.ts
Comment thread sql.schemas/schema.hyperliquid.sql
Comment thread services/hyperliquid/index.ts
Comment thread services/hyperliquid/index.ts
Comment thread services/hyperliquid/index.ts
Comment thread services/hyperliquid/index.ts
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.

2 participants