Back to Home

AI agents for crypto market analysis: Reasoning + Action pattern

The article analyzes problems of existing AI agents for crypto market analysis and offers a solution based on the 'Reasoning + Action' pattern. Agent code on agent-swarm-kit is provided with real signal examples on April 2026 events.

Adaptive AI agents for BTC trading: full code and tests
Advertisement 728x90

Reasoning + Action Pattern for AI Agents in Crypto Fundamental Analysis

Existing repos for automated market analysis suffer from core flaws in handling indicators and news. Take TauricResearch/TradingAgents: the pipeline pulls data from Reddit, X, Bloomberg, Reuters, and Yahoo Finance. Two agents debate—one bullish, one bearish—over a set number of rounds. The side with the stronger arguments wins.

But under the hood, raw indicators like RSI and Stoch RSI are fed to LLMs as plain text. Models struggle with prioritization: reasoning chains are chaotic. Example:

  • RSI signals oversold—bullish hypothesis.
  • No tools to backtest the hypothesis.
  • Stoch RSI flashes overbought—lock in the call.

Hard-coded priority weights kill adaptability, leading to losses. Dynamic prioritization demands 200k tokens for backtesting—from $1.20 (Haiku) to $6.00 (Opus). Without indicators, the system is blind to social media noise: one influencer with fake accounts or pricey APIs ($200/month for X).

Google AdInline article slot

node-ccxt-backtest deploys 8 agents by theme:

  • Balance: on-chain reserves, exchange outflows, LTH supply, HODL waves.
  • Money Flow: ETF inflows, miner pressure, stablecoins, OTC.
  • Fundamentals: hashrate, MVRV, NVT, Stock-to-Flow.
  • Network Revenue: fees, Lightning, DeFi TVL.
  • Insiders: MicroStrategy, BlackRock ETF, Grayscale GBTC.
  • Asset News: regulations, hacks, institutions.
  • Global Macro: Fed, CPI, DXY, Fear & Greed, M2.
  • Price History: anomalous volumes, breakouts.

The issue? It ignores portfolio metrics (max drawdown, Sharpe ratio) and misses real-world twists: a presidential tweet flips everything instantly.

Why Static Approaches Fail

Both examples rely on rigid queries to sources. Markets shift daily: adaptation is non-negotiable. The "Reasoning + Action" pattern fixes this: LLMs alternate analysis and news hunts. Agents zero in on key triggers, tuning out the noise.

Google AdInline article slot

Agent Implementation: April 2026 Signal Examples

Fundamental analysis for April screamed SELL: negatives piled up—Fed holding rates high, strong DXY, BlackRock ETF outflows, low hashrate, 15% funding rate, fear index at 28.

{
  "reasoning": "All reports highlight bearish signals: 1) macro—Fed keeps rates elevated, strong dollar, robust jobs data → risk-off mood...",
  "signal": "SELL"
}

April 5—geopolitics (Iran ultimatum): WAIT. Price below MA, RSI 44, fear at 12, but no catalyst.

April 8—Trump tweet on ceasefire: BUY. Rally to $72k, $425M short liquidations, volume >2M BTC/hour. Stop-loss $70k.

Google AdInline article slot

April 9—mixed signals (breakout above $71k vs. miner selling, 17% put options): WAIT.

Agent Source Code

Web Search Agent

import { addAgent } from "agent-swarm-kit";
...
import { str } from "functools-kit";

addAgent({
  agentName: AgentName.WebSearchAgent,
  completion: CompletionName.OllamaTextCompletion,
  keepMessages: Infinity,
  prompt: str.newline(
    "You are a web search agent in a trading system swarm.",
    "",
    "Your task is to compile an objective report..."
  ),
  tools: [
    ToolName.WebSearchTool,
  ],
});

Signal Generator

import {
  addOutline,
  commitAssistantMessage,
  commitUserMessage,
  dumpOutlineResult,
  execute,
  fork,
  IOutlineHistory,
  IOutlineResult,
} from "agent-swarm-kit";

...

const DISPLAY_NAME_MAP = {
  BTCUSDT: "Bitcoin",
  // ...
};

const SEARCH_PROMPT = str.newline(
  "You hunt for triggers on breaking events...",
  "Level 1—Breaking events..."
);

The code leverages agent-swarm-kit for a swarm of agents. Searches target fresh triggers: breaking news, hacks, Trump tweets, macro surprises. Output is JSON with reasoning and signal (BUY/SELL/WAIT).

Key Takeaways

  • The "Reasoning + Action" pattern delivers adaptability: agents fetch news mid-analysis.
  • Focus on breaking events (tweets, geopolitics) trumps static indicators.
  • Success metrics: max drawdown, Sharpe ratio—essential for backtesting.
  • Cost: optimized for Ollama, skips expensive APIs.
  • Objectivity: prioritizes bearish signals, runs multiple queries.

— Editorial Team

Advertisement 728x90

Read Next