QuantAgent Unveiled: A Multi‑Agent LLM Framework for High‑Frequency Trading (Code Open)
QuantAgent introduces a multi‑agent LLM framework that replaces text‑based inputs with raw OHLC price signals, decomposes trading decisions into Indicator, Pattern, Trend, Risk, and Decision agents, and achieves substantially higher direction accuracy and returns across ten financial assets in zero‑shot HFT experiments.
Background – Large language models (LLMs) have shown strong capabilities in financial reasoning for long‑term investment tasks, but high‑frequency trading (HFT) demands ultra‑fast, high‑precision decisions based on structured short‑cycle signals such as technical indicators, chart patterns, and trend features. Text‑based inputs are delayed and noisy, making them unsuitable for HFT.
Problem Definition – Existing financial LLM systems (e.g., MarketBERT, FinBERT) rely on textual data, which cannot meet the speed and accuracy requirements of HFT. A new framework is needed that bases inference solely on price signals and coordinates multiple specialized agents to produce real‑time, explainable trading decisions.
Method – QuantAgent is built on the LangGraph architecture and splits the trading workflow into four dedicated agents, each operating only on OHLC data:
IndicatorAgent computes five classic technical indicators (RSI, MACD, RoC, STOCH, WILLR) and classifies the market state as bullish, neutral, or bearish.
PatternAgent detects geometric chart patterns (e.g., double bottom, V‑shaped reversal, descending triangle) and generates natural‑language explanations.
TrendAgent fits support and resistance lines via ordinary‑least‑squares regression on sliding windows, quantifies trend strength (kappa_t) and determines upward, downward, or sideways trends.
RiskAgent aggregates upstream signals and produces risk‑adjusted trade boundaries (stop‑loss, take‑profit) with a fixed loss threshold rho = 0.05 % and take‑profit level R = r·rho (r = 1.2 or 1.8).
DecisionAgent fuses the outputs of the four upstream agents and issues LONG or SHORT orders only when a majority of agents agree, providing direction, rationale, risk‑return ratio, and execution instructions.
Experiments – The evaluation uses ten financial instruments (Bitcoin, crude oil, gold, S&P 500, Nasdaq futures, etc.) with 4‑hour OHLC data covering roughly three years (~5,000 candles per asset). Zero‑shot testing samples 100 random 100‑candle segments per asset, reserving the last three candles for validation. Metrics include direction accuracy (α), closing‑price return (R_cc), risk‑constrained return (R_sim), and max/min returns.
Main Results – QuantAgent consistently outperforms a random baseline:
Direction accuracy improves from 49 % to 72 % on S&P 500 (+23 %) and from 39 % to 59 % on Nasdaq‑ETF (+20 %); peak accuracy reaches 80 % on SPX validation.
Six of eight assets switch from negative to positive closing‑price returns (e.g., SPX: –0.108 → 0.207); QQQ’s risk‑constrained return rises from –0.252 to 0.193.
With identical stop‑loss/take‑profit settings, loss on volatile assets such as crude oil is cut by 50 %, while Bitcoin’s maximum return improves from 1.115 to 1.232.
Case Studies
PatternAgent (Crude Oil) identifies a descending triangle (flat lows, decreasing highs) and predicts a bearish breakout; the price subsequently falls.
TrendAgent (Dow Jones) fits an upward support line and a horizontal resistance line, confirming higher highs and higher lows, and predicts a bullish move while warning of a possible pull‑back.
IndicatorAgent (Dow Jones) observes a MACD bullish crossover, RSI near overbought (68), and stochastic > 80, leading to a bullish assessment tempered by overbought caution.
Conclusion – QuantAgent demonstrates that a structured price‑signal prior combined with LLM reasoning can substantially improve high‑frequency trading prediction, direction accuracy, and risk management without any fine‑tuning. The framework and code are publicly available for further research.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
