[On-Chain data]

DefiLlama protocol TVL, GeckoTerminal DEX pool OHLCV, and derived TVL spike events — not a wallet, not CEX-only price.

On-Chain data

AXIS on-chain data plane: search public protocol and DEX metrics and plot them next to your chart. Built-in providers include DefiLlama protocol TVL (total value locked, USD), GeckoTerminal DEX pool OHLCV, and derived TVL spike/drop events.

Abstract

PieceRole
On-Chain panelSearch protocols / pools, attach / hide / detach series
DefiLlama TVLDaily USD liquidity history for a protocol slug
GeckoTerminal OHLCVDEX pool candlesticks (minute / hour / day aggregates)
TVL spike eventsDay-over-day |%| threshold events from attached TVL (tvl_spike / tvl_drop)
Left price scaleIndependent metric axis so main OHLCV keeps the right scale
ProvenanceEach series records provider + finality / snapshot notes

Open from the topbar Panels group (On-Chain), or command palette → toggle the On-Chain panel (panel id onchain).

What this is not

  • Not a wallet. AXIS does not connect to MetaMask, Ledger, or any signing wallet for this plane.
  • Not CEX price by default. Protocol TVL is liquidity in USD, not the exchange candle series for the chart symbol. DEX pool OHLCV is on-chain pool price, which can diverge from centralized venues.
  • Not Pine. These overlays are host-side dataset series; they are not produced by indicator() / strategy() plots.

Conceptual model

How to use (DefiLlama TVL)

  1. Load a market as usual (symbol + source + timeframe).
  2. Open On-Chain.
  3. Search a protocol (e.g. aave, uniswap, lido).
  4. Click a result to attach its TVL history.
  5. The curve appears on the left scale of the price pane (when overlay wiring is active).
  6. Hide or remove series from the Attached series list; Clear removes all.

Multiple protocols can be attached (chart safety caps the number of on-chain lines).

Refresh, export, popular presets

Command palette (⌘K / Ctrl+K) exposes host jobs for attached TVL series — no Pine required:

Command idTitleWhat it does
onchain.refreshOn-Chain: Refresh Attached TVLRe-fetch every attached DefiLlama TVL series (refreshAllAttachedTvl)
onchain.export.seriesOn-Chain: Export Series CSVDownload all attached series as long CSV (series,time,value)
onchain.attach.popularOn-Chain: Attach Popular TVLAttach the top 5 protocols by current TVL (attachPopularTvl(5))

Related palette actions (panel / hygiene):

Command idRole
panel.onchainToggle On-Chain panel
onchain.mode.tvlOpen panel (TVL mode entry)
onchain.clear.seriesDetach all series
onchain.clear.eventsClear event markers plane
onchain.healthProbe Worker /api/onchain/health (Connection HUD)

Export format: one row per point — series,time,value — with time as unix seconds and value as USD TVL (or other scalar). Empty attachments still download a header-only file.

Popular preset: empty DefiLlama protocol browse (highest TVL first), capped by the chart series limit (MAX_ONCHAIN_SERIES, currently 8). Already-attached slugs refresh in place rather than duplicating.

Refresh: re-runs the DefiLlama protocol TVL fetch for each attachment so left-scale lines stay current after long sessions.

DEX pools (GeckoTerminal)

Phase 2 adds DEX pool OHLCV via GeckoTerminal public API (no API key). Use this when you want on-chain pool candles rather than protocol TVL:

ConceptDetail
NetworkGecko network id (eth, solana, base, arbitrum, polygon_pos, …)
Pool addressEVM 0x + 40 hex, or Solana-style base58
Timeframeminute / hour / day with aggregate (e.g. 1h → hour + aggregate 1)
CurrencyDefault USD when proxied with query pass-through
Page sizeMax 1000 candles per request (limit); Gecko hard cap
Walk-backendTime → Gecko before_timestamp (bars strictly before that unix second)

Client helpers live in src/onchain/geckoterminal.ts (fetchGeckoPoolOhlcv, searchGeckoPools, interval/network maps). Browsers should use the Worker gecko proxy (below) because public GeckoTerminal hosts often lack CORS for arbitrary origins.

Deep history (Data Sources + GeckoTerminal DEX)

Topbar Load fetches a single page (up to 1000 bars). For multi-page history down to a past date:

  1. Set the chart source to GeckoTerminal DEX (geckoterminal-ohlcv).
  2. Use a pool symbol such as eth:0x… (network + pool address).
  3. Open Data (Data Source Manager) → set symbol / source / timeframe / accumulate to.
  4. Start background backfill — AXIS walks older pages with endTime only (each page maps to before_timestamp). The source does not multi-page inside one fetchHistorical call; DSM does it page-by-page.

See Data Source Manager for job phases and cache behavior.

Events (TVL spikes)

From an attached TVL scalar series, AXIS can derive day-over-day percent-change events:

FieldBehavior
Typetvl_spike (gain) or tvl_drop (loss)
Default threshold10% absolute day-over-day change
Severitywarn below critical band; critical for large moves (default ~25% or 2.5× threshold)
PayloadpctChange, prevValue, value, thresholds

Pure helper: buildTvlSpikeEvents in src/onchain/events.ts. These are derived from daily snapshots — not mempool or block-final chain events.

DefiLlama raises and token unlocks require Pro API (pro-api.llama.fi) and are not fetched by the free Worker proxy; inject external events only if you already have that data.

Scale and chart behavior

BehaviorDetail
ScaleOn-chain TVL lines use the built-in left price scale (left)
Main marketPrimary OHLCV stays on the right scale
CompareCompare overlays may share the left scale; on-chain keys are onchain_*, not overlay_*
UnitsTVL values are USD liquidity totals from DefiLlama; DEX OHLCV is pool quote (often USD)

Settings

Settings → General → On-Chain is a short note only (no extra bindings):

  • By default the PWA calls DefiLlama / GeckoTerminal directly (public CORS).
  • Worker proxy ({endpoint}/api/onchain/llama / …/gecko) is used only when Backend URL is a real AXIS Worker (*.workers.dev, pynescript-axis, or wrangler :8787).
  • Not a wallet — public metrics only; no signing

Keep Backend URL as the Pro API for Pine (https://axis.hoox.sh or local :5002). That host is not an on-chain proxy.

Network path (CORS / Worker proxy)

Public llama.fi / geckoterminal APIs currently allow browser origins (Access-Control-Allow-Origin: *), so AXIS defaults to direct fetch.

Using https://axis.hoox.sh/api/onchain/… is wrong: nginx serves the SPA HTML, which produces invalid JSON / got HTML. The client now avoids that host for on-chain bases.

When Backend URL is an AXIS Worker, paths map as:

Client requestWorker routeUpstream
{endpoint}/api/onchain/llama/protocolsallowlisted GEThttps://api.llama.fi/protocols
{endpoint}/api/onchain/llama/protocol/{slug}allowlisted GEThttps://api.llama.fi/protocol/{slug}
{endpoint}/api/onchain/gecko/networks/{net}/pools/{addr}/ohlcv/{tf}allowlisted GET (+ query)GeckoTerminal OHLCV
{endpoint}/api/onchain/gecko/search/poolsallowlisted GET (+ query)GeckoTerminal search
{endpoint}/api/onchain/healthlocalfeature flags
  • Local Worker: http://127.0.0.1:8787 + cd worker && bun run dev if you want the allowlisted proxy.
  • Override with plugin config.baseUrl when needed.

Isolate memory caches short-TTL responses (X-Axis-Onchain-Cache: HIT|MISS):

Route classTTL (approx.)
Llama protocols list10 min
Llama protocol detail2 min
Gecko OHLCV60 s
Gecko search120 s

Provenance and finality

Each attached series carries a short provenance line, for example:

  • Provider: DefiLlama · protocol TVL (USD)
  • Provider: GeckoTerminal · pool OHLCV
  • Finality: Daily snapshot · not CEX price (TVL) or pool candle finality notes (DEX)

Treat DefiLlama points as daily aggregates from the public API — not block-final on-chain events and not exchange marks. DEX candles reflect the pool at GeckoTerminal’s sampling, not a CEX order book.

Network, CORS, and proxies

SituationWhat to do
invalid JSON / got HTML for aaveBackend URL is a SPA host (e.g. axis.hoox.sh) — leave it for Pine; on-chain should hit llama.fi directly (reload after upgrade)
Local dev blocked by CORSPoint Backend URL at wrangler :8787 Worker, or set plugin baseUrl
Self-hosted demoOptional: reverse-proxy allowlisted /api/onchain/* to the Worker
OfflineNeeds network; there is no offline synthetic TVL/DEX walk by default

See also CORS and origins for Worker origin allowlisting.

Dataset plugins (advanced)

On-chain providers implement the structural dataset plugin contract (fetchDataset). Built-ins register via the on-chain catalog; dynamic URL plugins may install additional datasets. End users normally only use the On-Chain panel — see Datasets for the contract sketch.

Related docs