4 min read

Walsh puts a veto-capable risk manager over four trading agents

Walsh combines four stock-analysis agents with a veto-capable risk manager, but its 2023 backtest returned 75.52% versus 119.75% for buy-and-hold.

Image: Hacker News

Walsh routes every ticker through four parallel research agents—Fundamental, Technical, Sentiment, and Macro—before a confidence-weighted Portfolio Manager synthesizes their signals. A separate, rule-based Risk Manager has the final say: it can approve the decision, downgrade it, or veto the trade entirely.

The project is available on GitHub, with a live dashboard at walsh-demo.vercel.app and a second demo at demo-cyan-delta.vercel.app. The dashboard contains five pre-generated runs: AAPL was approved as a BUY after agreement among all four agents; MSFT was vetoed because Fundamental returned SELL while Technical returned STRONG_BUY; NVDA produced an approved STRONG_BUY; TSLA was vetoed after Fundamental and Technical took opposing positions; and META was vetoed because annualized volatility reached 76%, above the 40% risk cap.

How Walsh makes and gates decisions

The orchestrator uses asyncio.gather to run the agents concurrently. Each produces an AgentThesis, which the Portfolio Manager converts into a PortfolioDecision using confidence-weighted numeric signal scores.

Recommended reading

Startup targets Nvidia with 128TB AI server

The four agents use different inputs:

  • Fundamental Analyst: PE ratio, revenue growth, profit margin, and debt-to-equity. A PE below 15 adds a bullish vote, while a PE above 30 adds a bearish one. Revenue growth above 15% and profit margins above 20% each add bullish votes.
  • Technical Analyst: 20-day and 50-day SMA crossovers, MACD histogram direction, and an optional golden-cross flag. The backtest version instead uses realized 20-day and 50-day momentum from yfinance data.
  • Sentiment Analyst: news and social sentiment scores ranging from −1 to +1, combined with an insider-buying bonus. Confidence is dampened when sentiment is close to neutral.
  • Macro Analyst: GDP growth, the Fed Funds rate, inflation, and a sector outlook. Growth above 2.5%, rates below 4%, inflation below 3%, and a bullish sector each count as favorable conditions.

The Portfolio Manager reduces confidence when agents disagree. Its formula is confidence × max(0.5, 1 − spread × 0.1), where spread is the difference between the highest and lowest agent signal. A four-point gap—from STRONG_BUY to STRONG_SELL—therefore halves confidence.

The Risk Manager applies two hard vetoes: confidence below 45% forces a HOLD, and an agent spread of 4 or more vetoes the decision because of extreme disagreement. A softer rule downgrades STRONG_BUY to BUY, or STRONG_SELL to SELL, when confidence falls between 45% and 65%. Decisions that trigger no rule pass through with “No risk flags.”

2023 backtest results

Walsh’s deterministic backtest covered AAPL, MSFT, and NVDA from January 2023 through December 2023, using $100,000 in initial capital and strict no-lookahead enforcement. It underperformed equal-weight buy-and-hold during the bull-market period:

| Metric | Walsh pipeline | Buy and hold (equal-weight) | |---|---:|---:| | Total return | +75.52% | +119.75% | | Sharpe ratio | 2.36 | 2.86 | | Maximum drawdown | −13.50% | −13.22% | | Win rate | 76.2% | — | | Final value | $175,518 | $219,749 |

The pipeline exited all positions in October 2023 after momentum signals weakened, then stayed in cash for the rest of the month and missed a subsequent NVDA recovery rally. The repository describes that as the intended risk-gate behavior in a high-uncertainty period, but the result exposes the cost of conservative thresholds in a trending market.

The backtest numbers do not come from the LLM-powered agents shown in the dashboard. They use deterministic rule-based agents, including SMA crossover, momentum, and mean-reversion signals. A volatility damper (vol_cap=40% in backtest/engine.py) also reduced NVDA’s allocation for much of the year because its realized volatility was approximately 70–90%. The MeanReversionSignalAgent issued SELL signals when stocks reached 52-week highs, further hurting performance. Walsh’s documented estimate is that the strategy underperformed passive buy-and-hold by about 44 percentage points.

Known failure modes and unfinished evaluation

The repository’s adversarial suite contains 18 test cases across three agent types, with five flagged for overconfidence. Examples include:

  • Technical signals reporting 0.80 confidence on zigzag prices where SMA20 and SMA50 should largely cancel.
  • A stale bullish signal after a sharp crash because moving averages lag the market.
  • A single-day 50% jump producing a STRONG_BUY at 0.80 confidence.
  • Negative prices generating a confident momentum signal because input validation does not reject corrupted data.
  • A mean-reversion agent reporting 0.76 confidence for a price sitting in the middle of its 52-week range.

Several measurements remain unavailable. Per-agent accuracy and confidence calibration require at least 50 completed pipeline runs with follow-up price data. Cost and latency figures will be populated only after LLM-backed agents replace the current rule-based stubs. Walsh also has no live market-data integration: the orchestrator currently points to the mock endpoint api.finance.example.com.

The project requires Python 3.11+ and an Anthropic API key for its LLM-backed agents, although the backtest and adversarial evaluation do not call the Anthropic API. The main commands include python -m backtest.engine --tickers AAPL,MSFT,NVDA --start 2023-01-01 --end 2024-01-01, python -m eval.adversarial, and python -m orchestrator.main AAPL.

Ava Chen

AI Editor

Ava covers the rapidly evolving world of artificial intelligence, from foundational models and research labs to the real-world economics of intelligence. With a background in computational linguistics, she cuts through the hype to find out what actually works. She firmly believes that benchmarks are just marketing until reproduced in the wild.

via Hacker News

/ Keep reading