Lenstock

API Documentation

Lenstock's read API. All responses are JSON { data, meta }, served from the indexer's cache — no key required. Base URL is this deployment's origin. Prices are USD; timestamps are unix seconds.

GET/api/tokens

Every tracked market with live on-chain price, real-share price (equities), premium/discount, 24h volume, pool depth, 24h change (crypto), and market cap.

{
  "data": [
    {
      "symbol": "NVDA", "kind": "equity", "name": "NVIDIA",
      "address": "0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec",
      "onchainUsd": 217.68, "stockUsd": 217.55,
      "premium": { "pct": 0.06, "direction": "premium", "absUsd": 0.13 },
      "change24hPct": -0.63, "dexMarketCap": 9960397,
      "volume24hUsd": 1484505, "poolDepthUsd": 146509,
      "holders": null, "logoUrl": "https://...", "hasPool": true
    }
  ],
  "meta": { "count": 87, "asOf": 1788148200 }
}
GET/api/tokens/{symbol}/candles

OHLCV candles for the symbol's primary pool, built from on-chain swaps. Time is unix seconds.

interval1m | 5m | 1h — default 1m
limit1–2000 — default 500
{
  "data": [
    { "time": 1788143400, "open": 217.29, "high": 217.32,
      "low": 217.29, "close": 217.31, "volume": 9223.55 }
  ],
  "meta": { "symbol": "NVDA", "interval": "5m", "count": 288 }
}
GET/api/tokens/{symbol}/stats

24h volume & trade count, holders, total supply, current price, pool depth, premium, and the minute-by-minute premium history.

sinceseconds of premium history, 3600–2592000 — default 86400
{
  "data": {
    "symbol": "NVDA", "volume24hUsd": 1438405, "trades24h": 2744,
    "holders": null, "totalSupply": "45400000000000000000000",
    "lastPriceUsd": 217.68, "poolDepthUsd": 146509,
    "premium": { "pct": 0.06, "direction": "premium", "absUsd": 0.13 },
    "poolCount": 4,
    "poolsList": [
      { "address": "0xd4eb…14a3", "fee": 500, "depthUsd": 146509, "isPrimary": true }
    ],
    "premiumHistory": [
      { "time": 1788140000, "premiumPct": 0.12, "onchainUsd": 217.6, "stockUsd": 217.3 }
    ]
  },
  "meta": { "asOf": 1788148200 }
}
GET/api/alerts

Recent in-app premium/discount threshold alerts (fired when |premium| ≥ ALERT_THRESHOLD_PCT).

{
  "data": [
    { "id": 3, "symbol": "MSTR", "ts": 1788147000,
      "premiumPct": 2.31, "thresholdPct": 2, "direction": "premium",
      "acknowledged": false }
  ],
  "meta": { "count": 1 }
}
POST/api/lens-ai

LensAI chat. Send the conversation; the response streams back as Server-Sent Events (text/event-stream). Each data: line is a JSON {"text": "…"} delta, terminated by data: [DONE]. Needs ANTHROPIC_API_KEY set.

body{ "messages": [{ "role": "user", "content": "why is MSTR at a premium?" }] }
data: {"text":"MSTR is trading "}
data: {"text":"about 1.3% above its real "}
data: {"text":"share price because…"}
data: [DONE]
GET/api/rugcheck

Rug-risk report for a Robinhood Chain token — DexScreener market data + on-chain checks (sell simulation, burn balances) scored by Lenstock. Pass ?q=name to search for a token instead.

address0x… token contract — returns the full report
qname / symbol search — returns { results: [{ address, symbol, name, liquidityUsd }] }
{
  "data": {
    "symbol": "PIPEDOG", "name": "pipedog",
    "riskScore": 18, "verdict": "Low risk",
    "priceUsd": 0.002755, "liquidityUsd": 9304724, "marketCap": 34031126,
    "ageDays": 34.2, "volume24hUsd": 1849350, "buys24h": 722, "sells24h": 938,
    "change24hPct": -1.73, "burnedPct": 0,
    "checks": [
      { "id": "sell", "label": "Sell tax / round-trip loss",
        "status": "pass", "weight": 0,
        "detail": "Sells simulate fine (~0.4% loss beyond the 1.00% pool fee)." }
    ],
    "notes": [], "pairAddress": "0xb7f1…42d6",
    "dexUrl": "https://dexscreener.com/robinhood/0xb7f1…42d6"
  },
  "meta": { "asOf": 1788148200 }
}
GET/api/health

Liveness: DB reachable, Finnhub configured, last processed swap block.

{ "ok": true, "finnhub": true, "swapCursor": "50543568", "ts": 1788148200 }