Use case 5: Monitoring CEX Health
1. Scenario
Monitor centralized exchange (CEX) health by tracking onchain asset balances and daily net flows.
Goal: Generate daily reports showing:
Coinbase, Inc.
$30bn
$1.2bn
OKX
$129bn
$34m
2. Solution
Use two Nansen API endpoints:
- Address Balances (Link Here) - Get total token holdings across all chains 
- 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_valuefields to get total assets on exchange
- Store this value for comparison 
Step 2: Calculate 24hr Net Flow
Method A: Simple (Balance Difference)
- Get today's total balance (from Step 1) 
- Get yesterday's total balance (same call, run 24 hours earlier) 
- 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:
- Sum all - inflow_usdvalues = Total Inflows
- Sum all - outflow_usdvalues = Total Outflows
- 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 2Last updated
Was this helpful?
