All Projects
Open Source · Multi-Agent Research

Haat

Haat mirrors an institutional research desk, not a chatbot. Given a ticker and as-of date, a LangGraph workflow runs specialized agents in sequence: five analysts gather evidence, bull and bear debate, the trader proposes, risk stress-tests sizing, and the portfolio manager issues a final rating plus trade_ticket.json. A deterministic quant layer (six-dimension scoreboard, ATR ticket math, verified OHLCV snapshot) grounds every LLM stage so prices and levels never get invented. Delivery channels include a Typer CLI with checkpoint/resume, a FastAPI web desk with SSE progress, and optional Supabase archive cache.

Problem

Single-shot LLM stock answers hallucinate prices, skip risk debate, and collapse evidence gathering into one opaque response. A research desk needs staged evidence, bull/bear argument, trader proposal, risk stress-test, and a final rated decision - with deterministic numbers grounded in verified market data.

Before and After

Before

  • One chat prompt returns narrative without structured debate
  • LLM invents last price and technical levels
  • No machine-readable trade ticket for downstream tools
  • Fundamentals and technicals blended into one opaque score
  • No checkpoint/resume or historical eval harness

After

  • LangGraph pipeline: analysts -> debate -> trader -> risk -> PM
  • Quant 6D engine + ATR ticket from verified OHLCV
  • trade_ticket.json with action, levels, size, invalidation
  • Fundamentals and regime as separate conviction layers
  • SQLite checkpoints, decision memory, and haat eval scoring

How a Ticker Becomes a Trade Ticket

Haat is a multi-agent LangGraph research desk - not a chatbot. Deterministic quant ingestion grounds every LLM stage, analysts gather evidence, bull and bear debate, the trader proposes, risk stress-tests, and the portfolio manager issues a rated trade ticket. Pick any block to see the flow.

Input

Orchestration

Data

Quant

Analysts

Research

Trade

Risk

Decision

Output

Web

What I Built

LangGraph multi-agent research desk

  • 14+ specialized LLM agents: five analysts, bull/bear/manager, trader, three risk voices, portfolio manager.
  • Shared graph state - each stage reads prior reports and writes structured output.
  • Per-agent provider/model overrides (OpenAI, Anthropic, Gemini, Bedrock, Ollama, and more).
  • Google API key pool for quota failover across projects.

Deterministic quant grounding

  • Six-dimension technical scoreboard: Trend, Momentum, Volume, Volatility, Structure, Relative Strength.
  • Verified market snapshot drives last price, ATR defaults, and cited EMA/SMA/band levels.
  • Fundamentals and market regime cap conviction separately - not averaged into technical score.
  • LLMs write narrative and direction; formulas own the numbers.

Pluggable data vendor layer

  • Yahoo Finance OHLCV, fundamentals, news, and brokerage consensus (default path).
  • StockTwits/Reddit sentiment with India .NS/.BO to .NSE/.BSE mapping.
  • Optional FRED macro, Polymarket prediction markets, Alpha Vantage fallback.
  • Lookahead guards on news/social; missing vendor keys skip gracefully.

CLI, web desk, and evaluation

  • Typer CLI with Rich live progress, LangGraph SQLite checkpoint/resume, and Docker packaging.
  • FastAPI + SSE web channel: single-flight runs, daily IP quota, 24h archive cache replay.
  • Vite/React desk UI with 4,700+ instrument autocomplete and PDF export.
  • haat eval harness scores historical tickets against OHLCV-only outcomes.

Engineering Decisions

  • Deterministic/LLM split - prices and ATR ticket math from verified data; LLMs debate and narrate only.
  • LangGraph over ad hoc chains - explicit stages, checkpoint/resume, and testable graph boundaries.
  • Per-agent LLM routing - quick vs deep tiers plus HAAT_AGENT_* overrides for cost/quality tuning.
  • Web/CLI isolation - API writes to .haat-web/, CLI to ~/.haat/; no cross-contamination.
  • Vendor routing with explicit chains - no silent fallback to unconfigured data sources.
  • Research tool disclaimer - not a broker; outputs are structured research, not financial advice.

By the Numbers

Automated tests

~565 pytest cases

Specialized LLM agents

14+ agent IDs

India instrument catalog

4,700+ NSE/BSE

LLM providers supported

15+ vendors

CI Python matrix

3.10 through 3.13

Rating tiers

5 (Buy to Sell)

License

Apache 2.0

Reliability and Ops

  • LLM retry budget (HAAT_LLM_MAX_RETRIES) for 429 throttling across long multi-agent runs.
  • Stale OHLCV guards, market data validator, and safe ticker path sanitization.
  • Single-flight API (409 if busy) and daily IP quota (429) protect shared web desk instances.
  • Graceful vendor degradation - missing FRED/Polymarket keys skip without aborting the graph.

Testing

  • pytest across agents, quant engine, vendors, CLI, API, and graph integration (66 test files).
  • GitHub Actions matrix on Python 3.10-3.13 with ruff lint and clean-install smoke checks.
  • haat eval replays historical dates with OHLCV-only scoring - no live social for backtests.

What I Did

  • 01Architected a 14-agent LangGraph pipeline - analysts, bull/bear debate, trader, risk stress-test, portfolio manager - producing structured ratings and trade_ticket.json.
  • 02Built deterministic quant grounding: 6D technical scoreboard, ATR risk ticket math, and verified market snapshots that prevent price hallucination.
  • 03Implemented multi-provider LLM routing with per-agent model overrides, Google API key failover pools, and quick/deep tiers for long multi-agent runs.
  • 04Designed pluggable data vendors (Yahoo, FRED, StockTwits, Polymarket) with lookahead-safe dates and graceful degradation on missing keys.
  • 05Shipped Typer CLI with Rich progress, LangGraph SQLite checkpoint/resume, decision memory, and an OHLCV eval harness for historical scoring.
  • 06Built FastAPI web desk with SSE live progress, single-flight concurrency, daily quota, Supabase/local archive cache, and Vite/React UI with PDF export.