RogueTrader is an open-source multi-agent trading framework specializing in both traditional financial assets and cryptocurrencies with on-chain data analysis. Built on a LangGraph-based multi-agent architecture, it deploys specialized LLM-powered agents — from fundamental analysts, sentiment experts, technical analysts, to on-chain data analysts — that collaboratively evaluate market conditions and inform trading decisions through structured multi-agent debates.
What makes RogueTrader different: Deep cryptocurrency-native analysis. Beyond standard price/volume/technicals, RogueTrader analyzes on-chain power structures — whale concentration, DeFi TVL flows, stablecoin supply dynamics, mining economics, Pi Cycle indicators, CME gap detection, and more. It treats crypto assets not just as price charts, but as complex on-chain economies with governance dynamics and capital flow patterns.
User Input (Ticker + Date)
│
▼
┌───────────────────────────────────────────┐
│ PHASE 1: ANALYST TEAM (parallel data gathering) │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐ ┌──────────┐ │
│ │ Market │ │ Social │ │ News │ │ Fundamentals │ │ On-Chain │ │
│ │ Analyst │ │ Media │ │ Analyst │ │ Analyst │ │ Analyst │ │
│ │ │ │ Analyst │ │ │ │ │ │ ★NEW │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────────┘ └──────────┘ │
└───────────────────────────────────────────┘
│
▼
┌───────────────────────────────────────┐
│ PHASE 2: RESEARCH TEAM (structured debate) │
│ Bull Researcher ←→ Bear Researcher │
│ ↓ │
│ Research Manager (judge) │
└───────────────────────────────────────┘
│
▼
┌───────────────────────────────────────┐
│ PHASE 3: TRADER │
│ Synthesizes all reports → trade plan │
└───────────────────────────────────────┘
│
▼
┌───────────────────────────────────────┐
│ PHASE 4: RISK MANAGEMENT (three-way debate) │
│ Aggressive ←→ Conservative ←→ Neutral │
│ ↓ │
│ Portfolio Manager (final decision) │
└───────────────────────────────────────┘
│
▼
FINAL DECISION: BUY / OVERWEIGHT / HOLD / UNDERWEIGHT / SELL
│
▼
Memory Reflection (BM25-based learning from outcomes)
| Agent | Responsibility | Tools |
|---|---|---|
| Market Analyst | Technical analysis using price data and indicators | get_stock_data, get_indicators |
| Social Media Analyst | Social sentiment and community metrics | get_news, get_crypto_sentiment |
| News Analyst | Global news, macro events, insider transactions | get_news, get_global_news, get_insider_transactions |
| Fundamentals Analyst | Company financials, valuation metrics | get_fundamentals, get_balance_sheet, get_cashflow, get_income_statement |
| On-Chain Analyst ★ | On-chain metrics, whale activity, DeFi TVL, stablecoin flows, mining stats, Pi Cycle, NVT, funding rates, CME gaps, Fear & Greed | 10 specialized crypto tools (see below) |
- Bull Researcher: Argues the bullish case, uses BM25 memory to recall similar past situations
- Bear Researcher: Argues the bearish case, identifies risks and downside scenarios
- Research Manager: Judges the debate, synthesizes bull/bear perspectives into a coherent investment thesis
- Trader: Composes all analyst and researcher reports into a concrete trading plan (timing, sizing, direction)
- Risk Management Trio (Aggressive / Conservative / Neutral): Three-way debate evaluating portfolio risk from different perspectives
- Portfolio Manager: Final approval/rejection of any proposed transaction
The On-Chain Analyst is RogueTrader's key differentiator, with 10 specialized tools across 4 analysis dimensions:
| Tool | Data Source | Description |
|---|---|---|
get_onchain_metrics |
CoinGecko | Market cap, circulating/total/max supply, FDV, ATH/ATL, multi-timeframe price changes |
get_nvt_ratio |
CoinGecko + Blockchain.com | Network Value to Transactions ratio (crypto's P/E ratio) — high = overvalued |
| Tool | Data Source | Description |
|---|---|---|
get_whale_activity |
CoinGecko (exchange tickers) | Exchange volume distribution, top-3 concentration, accumulation/distribution proxies |
get_stablecoin_flows |
DeFiLlama | Top-15 stablecoin circulating supplies — available capital for crypto markets |
| Tool | Data Source | Description |
|---|---|---|
get_defi_tvl |
DeFiLlama | Chain-level or protocol-level Total Value Locked — capital flow between ecosystems |
get_mining_stats |
Blockchain.com | BTC hash rate, difficulty, transaction count, active addresses, miner revenue (7-day trends) |
| Tool | Data Source | Description |
|---|---|---|
get_pi_cycle_indicator |
CoinGecko / yfinance | 111-day MA × 350-day MA×2 — major cycle top/bottom detection |
get_crypto_fear_greed |
Alternative.me | 0-100 sentiment index with 7-day/30-day trend analysis |
get_funding_rate |
CoinGecko derivatives | Perpetual futures funding rates — crowded long/short detection |
get_cme_gap |
yfinance | CME Bitcoin futures weekend gap detection (~77% historical fill rate) |
The On-Chain Analyst goes beyond surface metrics. Its system prompt instructs it to analyze:
- Power Structure: Who controls this asset? What are their incentives? Is it dominated by a small number of whales?
- Macro Game Theory: Regulatory stance across jurisdictions, nation-state accumulation patterns, monetary policy impact
- Layer Power Games: L1 dominance battles, L2 MEV and liquidity capture, cross-chain capital flows
- Manipulation Risk: Explicit assessment of whether the asset is vulnerable to pump-and-dump or rug-pull scenarios
RogueTrader supports 7 LLM providers through a unified factory pattern:
| Provider | Models (Quick) | Models (Deep) | API Base |
|---|---|---|---|
| DeepSeek ★ (default) | deepseek-v4-flash |
deepseek-v4-pro |
api.deepseek.com |
| OpenAI | GPT-5.4 Mini/Nano, GPT-4.1 | GPT-5.4, GPT-5.2, GPT-5.4 Pro | api.openai.com |
| Anthropic | Claude Sonnet 4.6, Haiku 4.5 | Claude Opus 4.6, Sonnet 4.6 | api.anthropic.com |
| Gemini 3 Flash, 2.5 Flash | Gemini 3.1 Pro, 2.5 Pro | Google AI | |
| xAI | Grok 4.1 Fast | Grok 4, Grok 4.1 Fast | api.x.ai |
| OpenRouter | NVIDIA Nemotron, GLM 4.5 | Same (free tier) | openrouter.ai |
| Ollama | Qwen3, GPT-OSS, GLM-4.7 | Same (local) | localhost:11434 |
Why DeepSeek is default: It offers an OpenAI-compatible API at significantly lower cost, with
deepseek-v4-profor deeper reasoning anddeepseek-v4-flashfor faster routine agent work.
Deep Thinking LLM (deepseek-v4-pro)
├── Research Manager (investment debate judge)
└── Portfolio Manager (risk debate judge + final decision)
Quick Thinking LLM (deepseek-v4-flash)
├── All 5 Analysts (market, social, news, fundamentals, onchain)
├── Bull/Bear Researchers
├── Trader
└── Risk Management Trio (aggressive, conservative, neutral)
RogueTrader also supports a beginner-friendly agent configuration file:
configs/agents.yamlUse it to adjust each agent's LLM route and persona without editing Python code:
agents:
onchain_analyst:
llm:
tier: quick
model: deepseek-v4-flash
prompt:
identity: |
You are RogueTrader's Lead On-Chain Analyst specializing in crypto assets.
focus: |
Focus on whale behavior, DeFi liquidity, stablecoin flows, derivatives positioning, and manipulation risk.
style: |
Explain conclusions in practical trading language, not only raw metrics.You do not need to configure every agent. Missing fields automatically fall back to the built-in defaults. For A/B testing, set ROGUETRADER_AGENT_CONFIG=/path/to/agents.yaml to load a different file.
RogueTrader uses a BM25-based lexical memory system (no embedding API costs, no token limits):
FinancialSituationMemory (5 instances)
├── bull_memory → Bull Researcher
├── bear_memory → Bear Researcher
├── trader_memory → Trader
├── invest_judge_memory → Research Manager
└── portfolio_manager_memory → Portfolio Manager
After each trading decision, the Reflector analyzes outcomes (returns/losses) against agent reasoning, extracts lessons learned, and stores (situation, recommendation) pairs. On subsequent analyses, agents retrieve the top-K most similar past situations via BM25 lexical matching to inform their current decision.
RogueTrader/
├── main.py # Quick-start entry point
├── pyproject.toml # Package configuration
├── requirements.txt # Dependencies
├── README.md # This file
│
├── roguetrader/ # Core Python package
│ ├── default_config.py # All configuration defaults (DeepSeek by default)
│ │
│ ├── graph/ # LangGraph orchestration
│ │ ├── trading_graph.py # Main orchestrator — RogueTraderGraph class
│ │ ├── setup.py # GraphSetup — builds the agent workflow DAG
│ │ ├── propagation.py # Propagator — state initialization & graph args
│ │ ├── conditional_logic.py # ConditionalLogic — debate routing logic
│ │ ├── reflection.py # Reflector — post-trade learning from outcomes
│ │ └── signal_processing.py # SignalProcessor — extracts BUY/HOLD/SELL from final report
│ │
│ ├── agents/ # 15 agent implementations
│ │ ├── analysts/
│ │ │ ├── market_analyst.py # Technical analysis
│ │ │ ├── social_media_analyst.py # Social sentiment
│ │ │ ├── news_analyst.py # News & macro events
│ │ │ ├── fundamentals_analyst.py # Company fundamentals
│ │ │ └── onchain_analyst.py # ★ On-chain crypto analysis
│ │ ├── researchers/
│ │ │ ├── bull_researcher.py # Bullish case argument
│ │ │ └── bear_researcher.py # Bearish case argument
│ │ ├── managers/
│ │ │ ├── research_manager.py # Investment debate judge
│ │ │ └── portfolio_manager.py # Final decision maker
│ │ ├── risk_mgmt/
│ │ │ ├── aggressive_debator.py # Aggressive risk perspective
│ │ │ ├── conservative_debator.py # Conservative risk perspective
│ │ │ └── neutral_debator.py # Neutral risk perspective
│ │ ├── trader/
│ │ │ └── trader.py # Trade plan synthesis
│ │ └── utils/
│ │ ├── agent_utils.py # Shared utilities, language instructions
│ │ ├── agent_states.py # AgentState, InvestDebateState, RiskDebateState
│ │ ├── memory.py # BM25 FinancialSituationMemory
│ │ ├── core_stock_tools.py # Stock price/fundamentals tools
│ │ ├── technical_indicators_tools.py # Standard technical indicators
│ │ ├── fundamental_data_tools.py # Financial statement tools
│ │ ├── news_data_tools.py # News/insider transaction tools
│ │ ├── onchain_data_tools.py # ★ On-chain metrics tools (9 tools)
│ │ ├── crypto_indicator_tools.py # ★ Crypto-specific indicators (5 tools)
│ │ └── crypto_sentiment_tools.py # ★ Crypto sentiment tools (2 tools)
│ │
│ ├── dataflows/ # Data pipelines (5 sources)
│ │ ├── y_finance.py # Yahoo Finance — stocks, fundamentals, news
│ │ ├── alpha_vantage*.py # Alpha Vantage — alternative data vendor
│ │ ├── onchain_data.py # ★ CoinGecko + DeFiLlama + Blockchain.com + Alternative.me
│ │ ├── crypto_indicators.py # ★ Pi Cycle, NVT, CME Gap, Funding Rate calculators
│ │ ├── crypto_sentiment.py # ★ Aggregated crypto sentiment pipeline
│ │ ├── interface.py # Abstract data vendor interface
│ │ ├── config.py # Runtime config (updated from default_config)
│ │ └── utils.py # Data processing utilities
│ │
│ └── llm_clients/ # Multi-provider LLM abstraction
│ ├── factory.py # create_llm_client() — provider dispatch
│ ├── base_client.py # BaseLLMClient abstract class
│ ├── openai_client.py # OpenAI + DeepSeek + xAI + Ollama + OpenRouter
│ ├── anthropic_client.py # Anthropic Claude
│ ├── google_client.py # Google Gemini
│ ├── model_catalog.py # Centralized model registry (6 providers × 2 modes)
│ ├── agent_registry.py # Per-agent LLM routing and prompt profiles
│ └── validators.py # Model validation logic
│
├── configs/
│ └── agents.yaml # Optional per-agent persona and model routing
│
├── cli/ # Interactive terminal UI
│ ├── main.py # Rich/Typer-based TUI (8-step wizard)
│ ├── models.py # Analyst selection types
│ ├── config.py # CLI-specific configuration
│ ├── utils.py # Prompt functions for each selection step
│ ├── announcements.py # Community announcements fetcher
│ ├── stats_handler.py # LLM/tool call token tracking
│ └── static/welcome.txt # ASCII art splash screen
│
├── my_scripts/ # ★ Personal run scripts
│ ├── roguetrader0.py # Manual entrypoint with command-line arguments
│ └── roguetrader1.py # Hermes/scheduler entrypoint for daily BTC runs
│
├── my_results/ # ★ Personal run outputs
│ ├── 运行结果/
│ │ └── 20260712_104835_BTC_USD/
│ │ ├── 运行索引.json
│ │ ├── 报告.md
│ │ ├── 状态.json
│ │ ├── 最终决策.json
│ │ ├── 运行配置.json
│ │ ├── 终端日志.log
│ │ └── 分段报告/
│ ├── 评估结果/
│ │ └── 20260712_110000_BTC_USD/
│ │ ├── 评估报告.md
│ │ ├── 评估结果.json
│ │ └── 反思候选.json
│ └── 图状态日志/ # Historical legacy output only
│
└── tests/ # Test files
├── test_google_api_key.py
├── test_model_validation.py
└── test_ticker_symbol_handling.py
★ = crypto/on-chain addition — the features added for RogueTrader's crypto-focused workflow
- Python 3.10+
- conda (recommended) or venv
# Clone
git clone https://github.com/yourusername/RogueTrader.git
cd RogueTrader
# Create environment
conda create -n roguetrader python=3.13 -y
conda activate roguetrader
# Install package (editable mode recommended for development)
pip install -e .RogueTrader requires at least one LLM provider API key. The default is DeepSeek:
export DEEPSEEK_API_KEY=your_key_here # DeepSeek (default)
# OR any of these alternatives:
export OPENAI_API_KEY=... # OpenAI
export ANTHROPIC_API_KEY=... # Anthropic
export GOOGLE_API_KEY=... # Google Gemini
export XAI_API_KEY=... # xAI Grok
export OPENROUTER_API_KEY=... # OpenRouterAlternatively, copy .env.example to .env:
cp .env.example .env
# Edit .env with your keysThis working copy is expected to run with the locked uv environment:
uv run --frozen python -m unittest discover -s tests -v
uv run --frozen python -m compileall -q cli roguetrader tests my_scripts main.py
uv run --frozen roguetrader --help
uv run --frozen roguetrader analyze --helpThe current baseline is 25 passing tests. These tests cover provider/model validation, agent registry configuration, CLI behavior, output path normalization, on-chain analyst wiring, graph initialization, OpenAI-compatible client configuration, local Parquet data cutoffs, ticker handling, quick-start configuration, and deterministic signal extraction.
# Launch the interactive TUI
roguetrader # installed command
# OR
python -m cli.main # direct invocationThe CLI walks you through an 8-step wizard:
- Ticker symbol (e.g.,
BTC-USD,ETH-USD,SPY,NVDA) - Analysis date
- Output language (English / Chinese)
- Analyst selection (market, social, news, fundamentals, onchain)
- Research depth (debate rounds: 1-3)
- LLM provider selection
- Model selection (quick + deep thinking)
- Provider-specific configuration (reasoning effort, thinking mode)
This working copy also includes personal/custom run scripts under my_scripts/. These scripts call the Python API directly and are useful for reproducible local runs or daily scheduled runs.
Use the two script entrypoints differently:
my_scripts/roguetrader0.py: manual entrypoint with command-line arguments for ticker, date, analysts, models, and debate depth.my_scripts/roguetrader1.py: Hermes/scheduler entrypoint, kept stable for dailyBTC-USDruns.
Both scripts load .env from the project root, configure DeepSeek by default, and write structured outputs under my_results/运行结果/.
conda activate roguetraderuv run --frozen python my_scripts/roguetrader0.py- Output is printed directly to the terminal.
- Each run automatically creates
my_results/运行结果/<timestamp>_<ticker>/. - That directory contains
运行索引.json,报告.md,状态.json,最终决策.json,运行配置.json,分段报告/, and终端日志.log. - This is the recommended manual full multi-agent run mode.
- To run a fixed historical date:
uv run --frozen python my_scripts/roguetrader0.py --ticker BTC-USD --date 2026-07-13For Hermes or crontab-style daily scheduling, use:
uv run --frozen python my_scripts/roguetrader1.pyFor offline/local-data checks, use my_scripts/roguetrader_local_data.py. The runtime policy is:
raw2is treated as the upstream source of truth.- RogueTrader runtime tools read only standardized
processed/parquet. - Local OHLCV summaries are cut off at the requested analysis date to avoid look-ahead bias.
Smoke test without any LLM/API call:
uv run --frozen python my_scripts/roguetrader_local_data.py \
--skip-roguetrader \
--ticker BTC-USD \
--date 2014-11-30 \
--source manual_or_investing \
--timeframe 1d \
--days 30This writes 运行索引.json, 报告.md, 状态.json, 最终决策.json, and 运行配置.json under my_results/运行结果/<timestamp>_<ticker>/.
uv run --frozen python my_scripts/roguetrader0.py --ticker BTC-USD --date 2026-07-13 > my_results/rogue_btc_0713.log 2>&1- Nothing is printed live in the terminal; stdout and stderr are both additionally written to
my_results/rogue_btc_0713.log. >overwrites an existing file with the same name; use>>to append instead.- This is only an extra shell transcript. The standard complete output remains
my_results/运行结果/<timestamp>_<ticker>/.
uv run --frozen python my_scripts/roguetrader0.py --ticker BTC-USD --date 2026-07-13 2>&1 | tee my_results/rogue_btc_0713.log- You can watch progress in the terminal in real time.
- An extra shell transcript is also saved to
my_results/rogue_btc_0713.log. - Manual
teeis usually unnecessary because the standard run directory already writes终端日志.log.
To reduce Python output buffering, use -u:
uv run --frozen python -u my_scripts/roguetrader0.py --ticker BTC-USD --date 2026-07-13 2>&1 | tee my_results/rogue_btc_0713.lognohup uv run --frozen python -u my_scripts/roguetrader0.py --ticker BTC-USD --date 2026-07-13 > my_results/rogue_btc_0713.log 2>&1 &Check background jobs:
jobs
ps aux | grep roguetrader0Follow the output file:
tail -f my_results/rogue_btc_0713.logTo stop a background run, find the process ID with ps aux | grep roguetrader0, then run:
kill <pid>| Scenario | Command |
|---|---|
| Manual full run | uv run --frozen python my_scripts/roguetrader0.py |
| Manual fixed date | uv run --frozen python my_scripts/roguetrader0.py --ticker BTC-USD --date 2026-07-13 |
| Scheduled run | uv run --frozen python my_scripts/roguetrader1.py |
| Extra shell transcript | uv run --frozen python my_scripts/roguetrader0.py > my_results/report_name.log 2>&1 |
| Print and save extra transcript | uv run --frozen python -u my_scripts/roguetrader0.py 2>&1 | tee my_results/report_name.log |
| Background run | nohup uv run --frozen python -u my_scripts/roguetrader0.py > my_results/report_name.log 2>&1 & |
| Follow background output | tail -f my_results/report_name.log |
| Stop foreground run | Ctrl+C |
| Stop background run | ps aux | grep roguetrader0, then kill <pid> |
For manual runs, prefer my_scripts/roguetrader0.py command-line arguments instead of editing code:
uv run --frozen python my_scripts/roguetrader0.py \
--ticker ETH-USD \
--date 2026-07-13 \
--analysts market,onchain \
--max-debate-rounds 1 \
--quick-model deepseek-v4-flash \
--deep-model deepseek-v4-proCommon arguments:
--ticker: ticker symbol, such asBTC-USDorETH-USD.--date: analysis date inYYYY-MM-DD; defaults to today.--analysts: analyst list, such asmarket,onchainormarket,social,news,fundamentals,onchain.--output-language: output language, such asChineseorEnglish.--max-debate-rounds: Bull/Bear researcher debate rounds.--max-recur-limit: LangGraph recursion limit; increase for more complex runs.
my_scripts/roguetrader1.py is mainly for Hermes/scheduled runs and should stay stable rather than being edited for each manual experiment.
from roguetrader.graph.trading_graph import RogueTraderGraph
from roguetrader.default_config import DEFAULT_CONFIG
# Default config already uses DeepSeek
rt = RogueTraderGraph(debug=True, config=DEFAULT_CONFIG.copy())
_, decision = rt.propagate("ETH-USD", "2026-05-19")
print(decision) # BUY / OVERWEIGHT / HOLD / UNDERWEIGHT / SELLfrom roguetrader.graph.trading_graph import RogueTraderGraph
from roguetrader.default_config import DEFAULT_CONFIG
config = DEFAULT_CONFIG.copy()
config["output_language"] = "Chinese"
config["max_debate_rounds"] = 2
# Use only on-chain analyst for crypto-native analysis
rt = RogueTraderGraph(
debug=True,
config=config,
selected_analysts=["onchain"]
)
_, decision = rt.propagate("BTC-USD", "2026-05-19")
print(decision)rt = RogueTraderGraph(
debug=True,
config=config,
selected_analysts=["market", "social", "news", "fundamentals", "onchain"]
)
_, decision = rt.propagate("ETH-USD", "2026-05-19")config = DEFAULT_CONFIG.copy()
# OpenAI
config["llm_provider"] = "openai"
config["deep_think_llm"] = "gpt-5.4"
config["quick_think_llm"] = "gpt-5.4-mini"
# Anthropic
config["llm_provider"] = "anthropic"
config["deep_think_llm"] = "claude-opus-4-6"
config["quick_think_llm"] = "claude-sonnet-4-6"
# Google
config["llm_provider"] = "google"
config["deep_think_llm"] = "gemini-2.5-pro"
config["quick_think_llm"] = "gemini-2.5-flash"
# Local (Ollama)
config["llm_provider"] = "ollama"
config["deep_think_llm"] = "qwen3:latest"
config["quick_think_llm"] = "qwen3:latest"rt = RogueTraderGraph(debug=True, config=config)
# Initial analysis
_, decision = rt.propagate("ETH-USD", "2026-05-19")
# After you know the actual return, teach the agents
rt.reflect_and_remember(returns_losses=+3.2) # +3.2% return
# This updates all 5 memory instances with lessons learnedAll configuration lives in roguetrader/default_config.py:
| Config Key | Default | Description |
|---|---|---|
llm_provider |
deepseek |
LLM provider: openai, anthropic, google, xai, openrouter, ollama, deepseek |
deep_think_llm |
deepseek-v4-pro |
Model for complex reasoning (Research Manager, Portfolio Manager) |
quick_think_llm |
deepseek-v4-flash |
Model for routine tasks (analysts, researchers, trader, risk debators) |
backend_url |
https://api.deepseek.com |
API endpoint (auto-set per provider if blank) |
output_language |
English |
Report language. Use Chinese for Chinese output. Internal debates always English |
max_debate_rounds |
1 |
Bull vs Bear debate rounds |
max_risk_discuss_rounds |
1 |
Three-way risk debate rounds |
max_recur_limit |
20 |
LangGraph recursion limit |
data_vendors.onchain_data |
coingecko |
On-chain data source: coingecko, defillama, blockchain_com |
data_vendors.crypto_indicators |
local |
Crypto indicator calculation: local (computed from data sources) |
data_vendors.crypto_sentiment |
coingecko |
Crypto sentiment source: coingecko, alternative_me |
| Config Key | Values | Applies To |
|---|---|---|
google_thinking_level |
high, minimal, None |
Google Gemini |
openai_reasoning_effort |
low, medium, high, None |
OpenAI |
anthropic_effort |
low, medium, high, None |
Anthropic Claude |
| Source | Used For | Authentication |
|---|---|---|
Yahoo Finance (yfinance) |
Stock prices, fundamentals, news, technical indicators | None (free) |
| CoinGecko API | Crypto market data, OHLC, exchange volumes, derivatives, social metrics, trending | None (free tier) |
| DeFiLlama API | Chain TVL, protocol TVL, stablecoin supplies | None (free) |
| Blockchain.com API | BTC on-chain stats (hash rate, difficulty, transactions, active addresses, miner revenue) | None (free) |
| Alternative.me API | Crypto Fear & Greed Index | None (free) |
| Alpha Vantage | Alternative stock data vendor | API key required |
All crypto data sources use free tiers with no API key required, though rate limits apply. CoinGecko data is cached with
lru_cacheto minimize API calls.
RogueTrader uses yfinance-compatible ticker symbols:
| Asset Type | Format | Examples |
|---|---|---|
| Crypto (USD) | XXX-USD |
BTC-USD, ETH-USD, SOL-USD, DOGE-USD |
| Crypto (USDT) | XXX-USDT |
BTC-USDT, ETH-USDT |
| US Stocks | SYMBOL |
SPY, NVDA, AAPL, TSLA |
| International | SYMBOL.EXCHANGE |
CNC.TO, 7203.T, 0700.HK |
| Futures | SYMBOL=F |
GC=F (Gold), CL=F (Crude Oil) |
The On-Chain Analyst automatically resolves yfinance tickers to CoinGecko coin IDs (e.g., BTC-USD → bitcoin, ETH-USD → ethereum). 30+ cryptocurrencies are pre-mapped; unknown tickers fall back to CoinGecko search API.
The framework is built on LangGraph with a directed acyclic graph structure:
START → [Selected Analysts in sequence]
↓
Bull Researcher ⇄ Bear Researcher (conditional loop: debate rounds)
↓
Research Manager
↓
Trader
↓
Aggressive → Conservative → Neutral (conditional loop: risk rounds)
↓
Portfolio Manager → END
- Each analyst node conditionally loops to its tool node until all needed data is gathered
- Bull/Bear researchers alternate until debate rounds are exhausted, then proceed to Research Manager
- Risk management trio rotates until risk rounds are exhausted, then proceeds to Portfolio Manager
- All state accumulates in a shared
AgentStateTypedDict
User ticker + date
│
▼
┌─────────────┐ ┌──────────────────┐
│ Dataflows │───▶│ Agent Tools │
│ (raw data) │ │ (LangChain @tool)│
└─────────────┘ └──────────────────┘
│
▼
┌──────────────┐
│ Analysts │
│ (LLM + tools)│
└──────────────┘
│
▼
┌──────────────┐
│ Researchers │
│ + Managers │
│ (deep LLM) │
└──────────────┘
│
▼
FINAL DECISION
- Dataflows are pure Python functions calling external APIs — no LLM dependency
- Agent Tools wrap dataflows as LangChain
@tooldecorators for LLM function calling - Analysts use Quick Thinking LLM + bound tools to gather and analyze data
- Managers use Deep Thinking LLM to synthesize, judge, and decide
This local working copy includes modifications beyond the upstream codebase:
- Default LLM: Changed from OpenAI GPT to DeepSeek (
deepseek-v4-pro+deepseek-v4-flash) - Default backend URL:
https://api.deepseek.com - Added
deepseekas a recognized provider in the LLM factory (uses OpenAI-compatible API path)
- On-Chain Analyst agent (
onchain_analyst.py) — full agent with 4-dimension analysis framework - 16 on-chain/crypto tools across 3 tool modules:
onchain_data_tools.py— 9 tools (market data, whale activity, DeFi TVL, stablecoin flows, mining stats, Pi Cycle, NVT, Fear & Greed, funding rates, CME gaps)crypto_indicator_tools.py— 5 tools (Pi Cycle, NVT Ratio, CME Gap, Funding Rate, Fear & Greed)crypto_sentiment_tools.py— 2 tools (aggregated crypto sentiment, trending coins)
- 3 crypto dataflow modules:
onchain_data.py— CoinGecko + DeFiLlama + Blockchain.com + Alternative.me integration (400+ lines)crypto_indicators.py— Pi Cycle, NVT Ratio, CME Gap, Funding Rate calculatorscrypto_sentiment.py— Aggregated crypto sentiment pipeline
- Ticker mapping: 30+ crypto ticker → CoinGecko coin_id mappings with search API fallback
my_scripts/roguetrader0.py— manual entrypoint with command-line argumentsmy_scripts/roguetrader1.py— Hermes/scheduler entrypoint for daily BTC runsmy_results/— Historical analysis traces and full state logs in JSON
langgraph >= 0.4.8 # Agent workflow orchestration
langchain-openai >= 0.3.23 # OpenAI-compatible LLM client (DeepSeek, xAI, etc.)
langchain-anthropic >= 0.3.15 # Anthropic Claude client
langchain-google-genai >= 2.1.5 # Google Gemini client
langchain-experimental >= 0.3.4
yfinance >= 0.2.63 # Stock/crypto price data
stockstats >= 0.6.5 # Technical indicators
pandas >= 2.3.0 # Data manipulation
pyarrow >= 16.0.0 # Local processed Parquet runtime data
requests >= 2.32.4 # HTTP client for crypto APIs
rank-bm25 >= 0.2.2 # BM25 lexical search for memory
rich >= 14.0.0 # Terminal UI (CLI)
typer >= 0.21.0 # CLI framework
questionary >= 2.1.0 # Interactive prompts
redis >= 6.2.0 # Optional: memory persistence
python-dotenv >= 1.0.0 # Environment variable loading
PyYAML >= 6.0.2 # Agent YAML configuration
What is currently verified:
- Locked
uvenvironment works withuv run --frozen. - CLI command/help paths work as
roguetrader/roguetrader analyze. RogueTraderGraphinitializes with the on-chain analyst and OpenAI-compatible providers.- Local processed Parquet summaries avoid look-ahead bias by cutting data at the analysis date.
- Local report/state generation works in
--skip-roguetradermode and now writes to normalized Chinese output paths undermy_results/运行结果/. - Direct
RogueTraderGraph.propagate()runs now also write a single normalized run directory with an index, report, state, structured decision JSON, config, and section reports. - Offline signal evaluation writes to normalized Chinese output paths under
my_results/评估结果/. - Final decision extraction avoids an extra LLM call when the report already contains an explicit decision.
Known boundaries:
- Full end-to-end multi-agent analysis still requires a working LLM provider key or local Ollama endpoint.
- Online on-chain APIs such as CoinGecko, DeFiLlama, Blockchain.com, Alternative.me, and yfinance may return current/live data; they are not yet guaranteed point-in-time historical datasets for backtests.
- Local processed Parquet is the safer path for historical/offline evaluation.
- This is a research framework, not an execution engine or financial advice system.
Contributions are welcome — especially:
- Additional on-chain data sources (Glassnode, Dune Analytics, Arkham, etc.)
- New crypto-specific indicators
- Multi-asset portfolio optimization
- Backtesting integration
Apache License 2.0 — see LICENSE.
RogueTrader is an independent modified derivative of the TradingAgents project by Tauric Research. See NOTICE for upstream attribution and modification notes.