feat(hyperliquid): add spot pair name scraper#294
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
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_namesClickHouse table schema (ReplacingMergeTree keyed byspot_coin). - Implements Hyperliquid Info API client + pair-name resolver and a scraper
run()loop that snapshots results. - Wires
hyperliquidintocli runandcli 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. |
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.
Summary
spotMetaendpoint and snapshots resolved spot pair names into a newstate_spot_pair_namestable (ReplacingMergeTree keyed onspot_coin).spot_pair_namefield on Token API routes that surface spot fills (e.g. resolves@107→HYPE/USDC).hyperliquidinto both therunandsetupCLIs.Configuration
HYPERLIQUID_INFO_URL— required; URL of a Hyperliquid Info API. The public endpoint ishttps://api.hyperliquid.xyz/info; deployments may also point this at a compatible/inforeader.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