Skip to content
Docs
Get API Access
Browse the Documentation

Track an Asset's Price and Volume

Find an asset's ID, read its price, FDV, volume and changes, and keep them fresh without wasting requests.

You will find Canton Coin's asset ID from its symbol, read its price, FDV, volume and price changes, and keep them current without spending your rate budget. Every request needs X-API-Key; the examples read it from CANTONCAP_API_KEY.

1. Resolve the Asset ID

The API identifies assets by stable IDs, not symbols, because a symbol can be shared. GET /v1/assets/map matches a symbol case-insensitively and returns every asset that carries it, with its Canton identity (instrument_admin and instrument_id) to tell them apart.

curl -s "https://api.cantoncap.cc/v1/assets/map?symbol=CC" \
  -H "X-API-Key: $CANTONCAP_API_KEY"
JSON
{
  "data": [
    {
      "asset_id": "ast_515c3eaa72bd4a8b9403297879d78ef6",
      "network": "mainnet",
      "instrument_admin": "DSO::1220b1431ef217342db44d516bb9befde802be7d8899637d290895fa58880f19accc",
      "instrument_id": "Amulet",
      "name": "Canton Coin",
      "symbol": "CC",
      "status": "active"
    }
  ],
  "pagination": { "next_cursor": null }
}

Store the asset_id. It does not change, so you resolve it once, not on every request. You can also match exactly on instrument_admin and instrument_id if you already know the instrument.

2. Read the Latest Quote

GET /v1/assets/quotes/latest returns the full quote: price, FDV, 24-hour volume with how it was measured, and price changes over 1 hour, 24 hours, 7 days and 30 days.

curl -s "https://api.cantoncap.cc/v1/assets/quotes/latest?ids=ast_515c3eaa72bd4a8b9403297879d78ef6&convert=USD" \
  -H "X-API-Key: $CANTONCAP_API_KEY"
Read the Nulls
market_cap is always null (no circulating-supply methodology exists), and fdv is null when the total supply is missing or stale. A price change for a window without data is null. Show these as absences, never as 0. See Responses.

If you only need the price, GET /v1/simple/price returns just price and last_updated_at per asset and currency, in a smaller response.

3. Look Closer at Volume

volume_24h is the best available measurement, either the venues' reported aggregate or the volume observed in trades. For the measurements themselves, with their coverage, ask the activity endpoint for the asset:

curl -s "https://api.cantoncap.cc/v1/activity/asset/ast_515c3eaa72bd4a8b9403297879d78ef6?window=24h" \
  -H "X-API-Key: $CANTONCAP_API_KEY"

The default limit=1 returns the current snapshot. Each measurement (volume_usd, volume_usd_reported, volume_usd_derived, execution_count and the unit volumes) carries its own value, completeness, covered_seconds, methods and as_of. An as_of older than the snapshot's means the newest refresh had no value and the last usable one was kept.

4. Keep It Current

Reference prices are recalculated about once a minute, so polling faster than that only returns the same value. Two good options:

  • Poll once a minute with an ETag. Send the last ETag in If-None-Match; an unchanged quote answers an empty 304. See Caching and ETags.
  • Stream it. Subscribe to asset_quote:<asset_id> on the WebSocket and receive each new quote as it is calculated. See Streaming.
let etag = null;
let last = null;

async function refresh() {
  const response = await fetch(
    "https://api.cantoncap.cc/v1/assets/quotes/latest?ids=ast_515c3eaa72bd4a8b9403297879d78ef6&convert=USD",
    { headers: { ...headers, ...(etag ? { "If-None-Match": etag } : {}) } },
  );
  if (response.status === 304) return last;      // unchanged
  if (!response.ok) throw new Error(String(response.status));
  etag = response.headers.get("etag");
  last = (await response.json()).data[0]?.quotes.USD ?? null;
  return last;
}

setInterval(() => refresh().catch(console.error), 60_000);

Judge freshness from last_updated_at, not from when your request ran: if the quote has not moved for longer than your product accepts, say so instead of presenting it as live.

Esc
navigateopenEscclose