AI Agent That Scans 50 Altcoins for Patterns Using n8n + OpenAI

The Impossible Task: Monitoring 50 Altcoins Manually

The altcoin market moves fast. While Bitcoin and Ethereum get all the headlines, the real opportunities and risks often appear in mid-cap and small-cap altcoins first. By the time a pattern appears on CT (Crypto Twitter), the best entry point has already passed.

The solution is automation. In this tutorial, you will build a fully autonomous AI trading bot using n8n and OpenAI GPT-4o that scans 50 altcoins every hour, identifies technical patterns, scores each opportunity from 1 to 10, and sends you a curated alert report with only the highest-conviction setups.

This is the most advanced n8n crypto automation workflow in this series. By the end, you will have a personal AI market analyst running 24/7 on infrastructure that costs less than $10 per month to operate.

What This AI Agent Does

The workflow completes these tasks every 60 minutes automatically: fetches OHLCV (Open, High, Low, Close, Volume) data for 50 predefined altcoins, calculates technical indicators including RSI, MACD, Bollinger Bands, and volume ratios, sends the structured data to GPT-4o for pattern recognition and opportunity scoring, filters results to show only coins with a score of 7 or higher, and sends a formatted Telegram report with the top 3 to 5 setups of the hour.

Prerequisites

  • n8n self-hosted on Railway.app (covered in our Railway.app deployment guide)
  • Binance API key (read-only, for OHLCV data fetching)
  • OpenAI API key (GPT-4o-mini for cost efficiency)
  • Telegram bot for receiving reports
  • Familiarity with n8n HTTP Request and Function nodes

Step 1: Define Your Altcoin Watchlist

Create a Set node at the start of your workflow with your 50-coin watchlist. Organize it by market cap tier for systematic coverage:

Large Cap: SOL, BNB, AVAX, DOT, MATIC, LINK, UNI, AAVE
Mid Cap: INJ, TIA, SUI, APT, ARB, OP, DYDX, LDO
Small Cap: PENDLE, PYTH, JUP, W, STRK, MANTA, ALT
Defi: CRV, CVX, BAL, SUSHI, 1INCH, GMX, GNS
Layer 1: NEAR, FTM, ALGO, XTZ, EOS, ZIL, ONE
GameFi: AXS, SAND, MANA, ENJ, GALA, ILV, MAGIC

This selection covers the major sectors of the crypto market, ensuring you catch sector rotations and narrative shifts before they become mainstream news.

Step 2: Fetch OHLCV Data via Binance API

Add an HTTP Request node configured to use the Binance Kline endpoint:

Method: GET
URL: https://api.binance.com/api/v3/klines
Query Parameters:
  symbol: {{ $json.coin }}USDT
  interval: 4h
  limit: 50
Authentication: None (public endpoint)

The 4-hour timeframe is ideal for this type of scanner because it filters out noise from 15-minute charts while still catching intraday momentum shifts that daily charts miss.

Before the HTTP Request node, add a Split In Batches node set to process one coin at a time, with a short delay of 100 milliseconds between requests to respect Binance API rate limits. This prevents your workflow from getting rate-limited mid-scan.

Step 3: Calculate Technical Indicators in a Function Node

Add a Function node after the HTTP Request to calculate the technical indicators that your AI agent will analyze:

// Parse Binance kline data
const klines = items[0].json;
const closes = klines.map(k => parseFloat(k[4]));
const highs = klines.map(k => parseFloat(k[2]));
const lows = klines.map(k => parseFloat(k[3]));
const volumes = klines.map(k => parseFloat(k[5]));

// Current and recent prices
const currentPrice = closes[closes.length - 1];
const price24hAgo = closes[closes.length - 6]; // 6 x 4h = 24h
const change24h = ((currentPrice - price24hAgo) / price24hAgo * 100).toFixed(2);

// Simple RSI calculation (14-period)
function calculateRSI(prices, period = 14) {
  // RSI calculation logic
  const gains = [], losses = [];
  for (let i = 1; i < prices.length; i++) {
    const diff = prices[i] - prices[i-1];
    gains.push(diff > 0 ? diff : 0);
    losses.push(diff < 0 ? Math.abs(diff) : 0);
  }
  const avgGain = gains.slice(-period).reduce((a,b) => a+b, 0) / period;
  const avgLoss = losses.slice(-period).reduce((a,b) => a+b, 0) / period;
  const rs = avgGain / avgLoss;
  return (100 - (100 / (1 + rs))).toFixed(1);
}

// Volume analysis
const avgVolume20 = volumes.slice(-20).reduce((a,b) => a+b, 0) / 20;
const currentVolume = volumes[volumes.length - 1];
const volumeRatio = (currentVolume / avgVolume20).toFixed(2);

const rsi = calculateRSI(closes);
const recentHigh = Math.max(...highs.slice(-10));
const recentLow = Math.min(...lows.slice(-10));
const pricePosition = ((currentPrice - recentLow) / (recentHigh - recentLow) * 100).toFixed(0);

return [{
  json: {
    coin: items[0].json.coin,
    currentPrice,
    change24h,
    rsi: parseFloat(rsi),
    volumeRatio: parseFloat(volumeRatio),
    pricePosition: parseInt(pricePosition),
    recentHigh,
    recentLow
  }
}];

Step 4: Send Data to OpenAI for Pattern Recognition

This is the core intelligence layer. Add an OpenAI node after your Function node:

Model: gpt-4o-mini
Max Tokens: 200
Temperature: 0.3 (low temperature for consistent, analytical responses)

System Prompt:
You are an expert cryptocurrency technical analyst. Analyze the provided market data and identify any significant technical patterns or setups. Be concise and specific. Always output valid JSON.

User Prompt:
Analyze this crypto data and respond with JSON only:
{
  "coin": "{{ $json.coin }}",
  "price": {{ $json.currentPrice }},
  "change24h": {{ $json.change24h }},
  "rsi": {{ $json.rsi }},
  "volumeRatio": {{ $json.volumeRatio }},
  "pricePosition": {{ $json.pricePosition }},
  "nearHigh": {{ $json.recentHigh }},
  "nearLow": {{ $json.recentLow }}
}

Response format (JSON only):
{
  "pattern": "name of identified pattern or None",
  "signal": "Bullish / Bearish / Neutral",
  "score": 1-10 (10 = highest conviction),
  "reasoning": "one sentence explanation",
  "keyLevel": "important price level to watch"
}

GPT-4o-mini analyzes each coin for patterns including oversold bounces (RSI below 30 with volume spike), breakout setups (price at 90th percentile of recent range with rising volume), divergences (price making lower lows but RSI making higher lows), and momentum continuation patterns.

At approximately $0.0001 per analysis, scanning 50 coins costs about $0.005, meaning you can run this every hour for roughly $0.12 per day — less than the price of a coffee per month for a professional-grade altcoin scanner.

Step 5: Filter High-Conviction Setups

Add an IF node to filter results:

Condition: {{ $json.score }} greater than or equal to 7
AND: {{ $json.signal }} is not equal to "Neutral"
TRUE: proceed to report compilation
FALSE: discard this coin from the report

Out of 50 coins scanned, you typically expect 3 to 8 coins to score 7 or higher in any given hour. This is your signal-to-noise filter, the difference between a useful AI agent and a spammy alert system.

Step 6: Aggregate Results and Send Report

After all 50 coins are processed, use a Merge node set to Append mode to collect all results. Then add a final Function node to format the report, sorted by score descending:

Sort results by score (highest first)
Take top 5 only
Format each as:

[score]/10 COIN - Pattern: [pattern]
Price: $[price] | RSI: [rsi] | Volume: [volumeRatio]x avg
Signal: [signal] | Key Level: $[keyLevel]
Analysis: [reasoning]

Send this formatted report via Telegram. Your morning coffee report covers the entire altcoin market in a two-minute read.

Step 7: Log Everything to Supabase

Add a Supabase node to log every scan result regardless of score. Over time, this database becomes extremely valuable: you can measure your AI agent accuracy by comparing predictions to actual price movements, identify which patterns work best in bull versus bear markets, and fine-tune your scoring threshold based on real performance data.

Advanced: Add Sector Rotation Detection

Extend the workflow with sector-level analysis. After scanning all 50 coins, add a Function node that groups results by sector and calculates average scores per sector. If DeFi coins are averaging a score of 7.5 while Layer 1 coins average 4.2, that is a sector rotation signal worth reporting separately. This kind of macro-level pattern recognition is what separates sophisticated algorithmic trading bot systems from simple single-coin scanners.

Connecting to Your Full AI Automation Stack

This altcoin scanner integrates naturally with the rest of your automation infrastructure. You can pipe high-scoring setups into your Binance price alert workflow to set dynamic alert thresholds. You can log opportunity grades to your CoinGecko portfolio tracker to correlate your holdings against current market opportunities. You can feed the sector rotation data into a GoHighLevel or email automation to share market insights with subscribers or clients, creating a revenue stream from the intelligence your workflow generates.

The Complete n8n Crypto Automation Stack

Combining all three tutorials in this series gives you a complete institutional-grade crypto intelligence system: the Binance price alert workflow for real-time threshold monitoring, the CoinGecko portfolio tracker for daily performance measurement, and this altcoin scanner for proactive opportunity discovery. All three run simultaneously on a single n8n instance, consuming roughly 200 to 400 MB of RAM and costing under $10 per month on Railway.app.

This is exactly the kind of system that professional crypto funds pay tens of thousands of dollars per year to access via Bloomberg Terminal add-ons and institutional data providers. With n8n, OpenAI, and the Binance and CoinGecko APIs, you can build equivalent functionality yourself over a single weekend.

Scroll to Top