Appearance
Data Sources
This section describes the source-specific ingestion plan for the SQLite market backend.
The shared rule is:
text
external source
-> source-specific ingestor
-> normalized SQLite rows
-> deterministic context resolver
-> trading promptMarket data is global. Clones do not fetch source data independently; they select assets and data streams from the shared SQLite market memory.
Source Roles
| Source | Primary role | Trading prompt use |
|---|---|---|
| Hyperliquid | Trade universe and asset-level market state | Price, OHLC, liquidity, funding, volatility, positioning |
| Polymarket | Event and prediction-market context | Immediate, later, and recently closed market signals linked to assets |
| DefiLlama | Macro and DeFi regime context | Capital base, flows, fees, revenue, volume, open interest |
DefiLlama context is macro-first. The resolver links global DeFi rows to every enabled asset and only adds chain/stablecoin rows when the subject can be matched to that asset symbol.
Runtime Shape
Run the backend API and ingestion worker as separate Node processes against the same SQLite database.
bash
cd services/market-backend
# Terminal 1
npm run api
# Terminal 2
npm run ingestFor capped local testing:
bash
npm run ingest:localSource Summary
| Source | Channels | Main cadence |
|---|---|---|
| Hyperliquid | Mid prices, OHLC candles, liquidity profile, funding pressure, volatility profile, positioning pressure | 5s, 1m, and 5m depending on channel |
| Polymarket | Market discovery, immediate market, later market, recently closed markets | 5m to 1h depending on channel |
| DefiLlama | Capital base, capital flows, economic throughput | 1h |
External API Summary
| Source | Transport | Default endpoint config | Main requests |
|---|---|---|---|
| Hyperliquid | WebSocket + HTTP POST | HYPERLIQUID_WS_URL=wss://api.hyperliquid.xyz/ws, HYPERLIQUID_INFO_URL=https://api.hyperliquid.xyz/info | allMids, candle, meta, spotMeta, metaAndAssetCtxs, predictedFundings, l2Book |
| Polymarket | HTTP GET | POLYMARKET_GAMMA_URL=https://gamma-api.polymarket.com | /events, /public-search |
| DefiLlama | HTTP GET | DEFILLAMA_API_URL=https://api.llama.fi, DEFILLAMA_STABLECOINS_URL=https://stablecoins.llama.fi | /v2/chains, /protocols, /stablecoins, /overview/* |