LayerHopDocsLaunch app (opens in a new tab)

Market data

Token lists and search, prices, OHLCV candles, trades, holders, top traders and active pools for Berachain and Robinhood Chain, from LayerHop's own indexer. API key required; off by default on each deployment.

LayerHop runs its own indexer for Berachain (Kodiak v2 / v3 and BEX) and Robinhood Chain (Uniswap v2 / v3 / v4). It reads every swap and transfer from the chain itself, and the market data API serves that data under /v1/market/*. It is the same data behind the token pages at app.layerhop.com.

Access and limits#

Every market data request needs an API key. Create one in the dashboard and send it as x-api-key. Without a key you get UNAUTHORIZED.

  • Rate limit: each key gets its own market data limit, separate from the rest of the API: 60 requests a minute by default. With paid plans the plan sets it. On /v1/market/* responses, x-ratelimit-limit and x-ratelimit-remaining describe this limit. Over it you get RATE_LIMITED with retry-after.
  • Monthly calls (only with paid plans): each plan includes a number of market data calls per calendar month (UTC). Live and test keys count together, because both get the same real data. Responses carry x-market-quota-limit and x-market-quota-remaining. Over the cap you get QUOTA_EXCEEDED. GET /v1/account/plan shows usage under usage.marketCalls.
  • Market data requests also count toward the plan's general monthly request quota, like any other API request.
Free Pro Scale
Market data requests per minute (per key) 10 120 600
Market data calls per month 5,000 1,000,000 10,000,000

These numbers apply once paid plans are on. Until then every key gets the default limit above and no monthly cap.

Chains#

Terminal
curl https://api.layerhop.com/v1/market/chains -H "x-api-key: $LAYERHOP_API_KEY"

{chain} in every other route is berachain / 80094 or robinhood / 4663. Any other chain is UNSUPPORTED_CHAIN.

Tokens#

Terminal
# trending tokens in the last 24 hours
curl "https://api.layerhop.com/v1/market/berachain/tokens?sort=trending&limit=20" -H "x-api-key: $LAYERHOP_API_KEY"
# search by symbol, name or address
curl "https://api.layerhop.com/v1/market/berachain/tokens?q=kdk" -H "x-api-key: $LAYERHOP_API_KEY"
# one token, with 7-day volume
curl https://api.layerhop.com/v1/market/berachain/tokens/0xb8cd06e46ef4ea5b0c3f1a4f1b8f5a7d2e6c4b21 -H "x-api-key: $LAYERHOP_API_KEY"
  • sort: trending (default), top (USD volume), new (created in the last 7 days), gainers (24-hour change, with at least 1,000 USD volume).
  • window: 24h (default) or 7d.
  • By default the list leaves out tokens under 100 USD volume or 5 trades in the window. Change that with minVolumeUsd and minTrades. A search (q) includes every token with a trade.
  • Each token's priceUsd, change and quoteSymbol come from its most traded pool, pool. Use that pool with the candles, trades and traders routes.
  • A token detail is served for tokens traded in the last 7 days. Any other token is NOT_FOUND.

Candles#

Terminal
curl "https://api.layerhop.com/v1/market/berachain/pools/0xe97c6a2b1f2fd3c1e5b4a0d9c8b7a6f5e4d3a65b/candles?interval=15m&limit=200" \
  -H "x-api-key: $LAYERHOP_API_KEY"

USD OHLCV candles of one side of a pool, oldest first. time is the candle start in unix seconds and volume is in USD. Intervals: 1m, 5m and 15m cover the last 7 days. 1h, 4h and 1d cover the whole indexed history. A quiet period has no candle (there is no gap filling), and each candle opens at the previous close. token picks the side of the pool; it defaults to the pool's priced token.

Trades#

Terminal
curl "https://api.layerhop.com/v1/market/berachain/pools/0xe97c6a2b1f2fd3c1e5b4a0d9c8b7a6f5e4d3a65b/trades?limit=50" \
  -H "x-api-key: $LAYERHOP_API_KEY"

Trades come newest first. time is in unix milliseconds, and kind is a buy or sell of the token. To page back, pass the previous page's next as before; next is null at the end. wallet is the transaction's sender. It can be null for a moment while the indexer looks it up. zap marks a trade whose transaction also added or removed liquidity on the pool.

Holders#

Terminal
curl "https://api.layerhop.com/v1/market/berachain/tokens/0xb8cd06e46ef4ea5b0c3f1a4f1b8f5a7d2e6c4b21/holders?limit=100" \
  -H "x-api-key: $LAYERHOP_API_KEY"

Holders are counted from every transfer since the token was created, as of syncedBlock. Pools LayerHop indexes are tagged lp. The first time anyone asks about a token, it is counted in the background: status is syncing, with partial: true and the holders found so far, until it becomes ready. Ask again in a minute. Holders are served for tokens traded in the last 7 days.

Top traders and pools#

Terminal
curl "https://api.layerhop.com/v1/market/berachain/pools?window=24h" -H "x-api-key: $LAYERHOP_API_KEY"
curl "https://api.layerhop.com/v1/market/berachain/pools/0xe97c6a2b1f2fd3c1e5b4a0d9c8b7a6f5e4d3a65b/traders?sort=pnl&days=30" \
  -H "x-api-key: $LAYERHOP_API_KEY"

/pools lists each token's main pool, ordered by USD volume in the window. /traders ranks a pool's wallets by pnl (realized plus unrealized, average cost), volume, buys or sells, over all time or the last 1, 7, 30 or 90 days. It is served for the main pool of a token traded in the last 7 days. While coverage.complete is false, the indexer is still filling in wallets or older history.

Freshness and errors#

Answers are cached for 5 seconds (the newest trades) up to 60 seconds (holders, top traders, hourly candles), so polling faster than that returns the same data. If a chain's indexer can't be reached, you get MARKET_UNAVAILABLE (HTTP 503); retry with backoff. Invalid input is INVALID_PARAMS, and the message says which parameter is wrong.

SDK#

TypeScript
import { LayerHop } from "@layerhop/sdk";

const lh = new LayerHop({ apiKey: process.env.LAYERHOP_API_KEY });
const { tokens } = await lh.marketTokens("berachain", { sort: "top", limit: 10 });
const { candles } = await lh.marketCandles("berachain", tokens[0].pool!, { interval: "1h" });

The full parameter and field list is in the API reference.

Last updated