DEV Community

agenthustler
agenthustler

Posted on

Building a Volume Anomaly Scanner for Crypto Markets

If you've been building trading signals, you've probably noticed that raw volume numbers are useless. A 100M volume candle means something completely different on a 10B market cap token versus a 100M market cap token.

I've been working on this problem: How do you detect genuine market anomalies versus noise? The answer isn't volume alone -- it's the relationship between volume and market cap.

The Core Idea

When a token's 24h volume exceeds 10-15% of its market cap, something unusual is happening. Either:

  • Legitimate whale accumulation or distribution
  • Coordinated trading activity (pump scheme or liquidation cascade)
  • Major catalyst event driving real interest
  • Natural volatility spike

Most of us catch these by eye, checking charts periodically. But scalable anomaly detection requires automation.

The Method

Volume-to-market-cap ratio analysis works like this:

  1. Pull 24h volume and current market cap from CoinGecko (or your data source)
  2. Calculate the ratio: ratio = volume_24h / market_cap
  3. Compare the current ratio to the token's historical baseline (7-day or 30-day rolling average)
  4. Flag when current ratio is N times the baseline (e.g., 2.5x or 3x)

Why this works:

  • Normalizes noise across different token sizes
  • Detects relative anomalies, not absolute ones
  • Works on tokens at any market cap level
  • Computationally cheap to run continuously

Real-World Example

BTC volume is typically 5-8% of market cap. If tomorrow it spikes to 20%, that's worth investigating. But on a small cap token, 20% might be normal noise. The ratio-based approach handles this naturally.

What I Built

I created an Apify Actor that does exactly this -- scans 50+ tokens, calculates their volume/mcap ratios, and flags anomalies. You can run it on-demand or integrate it into a larger pipeline.

Quick Start with the API

You can trigger a scan with a simple curl call:

curl -X POST "https://api.apify.com/v2/acts/cryptosignals~crypto-signals/runs?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"symbol": "BTC"}'
Enter fullscreen mode Exit fullscreen mode

This returns structured data including:

  • Current volume-to-market-cap ratio
  • Anomaly score relative to baseline
  • Risk classification (low/medium/high)
  • Raw metrics: 24h volume, market cap, price

Single Token Analysis

For focused analysis on a specific token:

{
  "symbol": "BTC",
  "thresholdMultiplier": 2.5
}
Enter fullscreen mode Exit fullscreen mode

This queries Bitcoin's latest metrics and compares them to its 7-day baseline. If volume is >2.5x the typical level, it flags it.

Full Market Scan

To scan all 50+ tokens in one run, just omit the symbol:

{}
Enter fullscreen mode Exit fullscreen mode

Parsing the Results

import requests

API_TOKEN = "YOUR_APIFY_TOKEN"
ACTOR_ID = "cryptosignals~crypto-signals"

# Start a run
run_url = f"https://api.apify.com/v2/acts/{ACTOR_ID}/runs?token={API_TOKEN}"
run = requests.post(run_url, json={"symbol": "BTC"}).json()
run_id = run["data"]["id"]

# Wait for completion and get results
dataset_url = f"https://api.apify.com/v2/actor-runs/{run_id}/dataset/items?token={API_TOKEN}"
results = requests.get(dataset_url).json()

for token in results:
    if token.get("anomaly_score", 0) > 2.0:
        print(f"ALERT: {token['symbol']} - Score: {token['anomaly_score']}")
        print(f"  Volume/MCap: {token['volume_mcap_ratio']:.4f}")
        print(f"  Baseline: {token['baseline_ratio']:.4f}")
Enter fullscreen mode Exit fullscreen mode

Use Cases

  1. Trading signals: Automatically detect entry/exit opportunities based on anomalies
  2. Risk monitoring: Watch for pump-and-dump schemes or coordinated whale activity
  3. Dataset generation: Feed results into machine learning models for prediction
  4. Portfolio surveillance: Alert when holdings experience unusual volume spikes
  5. Bot integration: Connect to trading bots for automated responses to anomalies

The Gotchas

  • Volume can be faked on low-liquidity tokens (look at exchange quality, not just volume)
  • Market cap can lag on rapid price moves, causing false positives
  • CoinGecko data has a small delay -- not suitable for sub-minute trading
  • Altcoin volatility means more false positives (requires tuning the threshold multiplier)

Why Automate This?

Because manual screening doesn't scale. If you're tracking 50+ tokens, you need something that runs every hour and surfaces only the genuine signals. The alternative is staring at TradingView until you burn out.

The actor is open source and available on GitHub: crypto-signals-mcp

It's also available as an MCP server if you're building autonomous trading assistants with AI agents.

Try it here: Crypto Signals on Apify


How do you detect volume anomalies in your own systems? Do you use market cap normalization, or do you have a different method? I'd love to hear about your approach in the comments.

Top comments (0)