Appearance
Polymarket Data Source
Polymarket adds event and prediction-market context around the assets a clone is allowed to trade.
It is not the trade universe. Hyperliquid remains the trade universe; Polymarket is a related-market signal layer.
What We Store
| Channel | Table | Cadence | Purpose |
|---|---|---|---|
| Market discovery | polymarket_events, polymarket_markets, polymarket_market_asset_links | 1h | Discover and link relevant markets to Hyperliquid assets |
| Immediate market | polymarket_immediate_markets | 5m health cadence | Near-term active prediction-market context |
| Later market | polymarket_later_markets | 30m health cadence | Longer-dated context |
| Recently closed markets | polymarket_recently_closed_markets | 15m health cadence | Settled outcomes and recent resolution context |
The current implementation performs discovery as one hourly job, then writes the immediate, later, and recently closed feature rows from that discovered registry.
Discovery Model
Discovery is registry-first:
text
Hyperliquid asset registry
-> asset display names and search terms
-> Gamma crypto tag crawl
-> Gamma public search by asset term
-> local event/market/link registry
-> derived feature rowsThe asset search terms come from hyperliquid_assets, including curated aliases where available. This is important because prediction markets often use names like Bitcoin instead of ticker-only strings like BTC.
How We Fetch Data
Configured endpoint:
| Config | Default |
|---|---|
POLYMARKET_GAMMA_URL | https://gamma-api.polymarket.com |
POLYMARKET_CRYPTO_TAG_ID | 21 |
The ingestor uses Polymarket Gamma HTTP GET requests.
Crypto tag crawl:
http
GET /events?active=true&closed=false&tag_id=21&order=volume_24hr&ascending=false&limit=100&offset=0This pulls high-volume active Crypto-tagged events. Pagination continues until the configured page cap or until a short page is returned.
Asset search:
http
GET /public-search?q=Bitcoin&limit=5Search terms come from the Hyperliquid asset registry. The ingestor runs throttled searches using POLYMARKET_SEARCH_DELAY_MS and can cap total searched terms with POLYMARKET_MAX_SEARCH_TERMS for local testing.
Fetched events and markets are parsed, matched to assets, and written into:
polymarket_eventspolymarket_marketspolymarket_market_asset_linkspolymarket_immediate_marketspolymarket_later_marketspolymarket_recently_closed_markets
Matching Policy
Polymarket rows should be linked to assets cautiously:
- Prefer explicit asset-name and alias matches.
- Keep match source and score metadata.
- Store the durable event/market registry separately from derived summaries.
- Avoid querying every CLOB orderbook by default.
CLOB enrichment can be added later for selected high-signal markets, but v1 should keep Polymarket as compact context rather than a heavy market-data stream.
Trading Context
Trading prompts can use Polymarket context to answer:
- Is there a near-term event changing sentiment for this asset?
- Are longer-dated markets implying a macro/narrative shift?
- Did a recently closed market resolve in a way that affects the asset or sector?
Local Commands
bash
cd services/market-backend
npm run polymarket:discover
npm run polymarket:discover -- --dry-run --max-search-terms=5