Use case 4: Monitoring CEX Health

1. Scenario

Monitor centralized exchange (CEX) health by tracking onchain asset balances and daily net flows.

Goal: Generate daily reports showing:

Name
Assets on Exchange
24hr Net Flows

Coinbase, Inc.

$30bn

$1.2bn

OKX

$129bn

$34m

2. Solution

Use two Nansen API endpoints:

  1. Address Balances (Link Here) - Get total token holdings across all chains

  2. Counterparties (Link Here) - Calculate 24hr net flows (inflows minus outflows)

Alternative: Compare today's balance vs yesterday's balance for a simpler net flow calculation.

3. Step-by-Step Guide

Step 1: Get Current Assets on Exchange

Fetch token balances across all chains covered by Nansen.

Call the address balances endpoint:

curl -X POST "https://api.nansen.ai/api/v1/profiler/address/current-balance" \
  -H "apiKey: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "entity_name": "Coinbase",
    "chain": "all",
    "hide_spam_token": true,
    "pagination": { "page": 1, "per_page": 1000 }
  }'

Process the response:

  • Sum all usd_value fields to get total assets on exchange

  • Store this value for comparison

Step 2: Calculate 24hr Net Flow

Method A: Simple (Balance Difference)

  1. Get today's total balance (from Step 1)

  2. Get yesterday's total balance (same call, run 24 hours earlier)

  3. Calculate: Net Flow = Today's Balance - Yesterday's Balance

Method B: Detailed (Counterparties Breakdown)

Fetch all inflows and outflows for the past 24 hours:

curl -X POST "https://api.nansen.ai/api/v1/profiler/address/counterparties" \
  -H "apiKey: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "entity_name": "Coinbase",
    "chain": "base",
    "date": {
      "from": "2025-10-22T18:43:00Z",
      "to": "2025-10-23T18:43:00Z"
    },
    "group_by": "entity",
    "source_input": "Combined",
    "pagination": { "page": 1, "per_page": 1000 }
  }'

Process the response:

  1. Sum all inflow_usd values = Total Inflows

  2. Sum all outflow_usd values = Total Outflows

  3. Calculate: Net Flow = Total Inflows - Total Outflows

Step 3: Format Results

Combine data into your target format:

Name: [entity_name]
Assets on Exchange: [Sum of usd_value from current-balance]
24hr Net Flows: [Net Flow calculation from Step 2

Last updated

Was this helpful?