Alpha Agent — a gigacontext trading research buddy (MVP) Inspiration We love agentic tools, but they usually “forget” most of the real context: years of filings, transcripts, macro series, and price history. We wanted an assistant that feels like a junior quant on the desk—able to read large corpora, spin up real backtests, sanity-check risk, and suggest allocations. Not perfect yet, but already useful.

What it does (today) Ask research questions and get answers with citations from SEC filings + macro data (pgvector + hybrid retrieval).

Strategy Studio (MVP): give a prompt like “moderate-risk crypto momentum” → we generate a QuantSpec, code, and run parallel backtests on Modal. You get a leaderboard and plots.

Risk & Allocation: quick MC/Historical VaR checks and HRP/Black-Litterman portfolio suggestions under basic constraints.

Neon-green dashboard: a simple chat/sim/allocate UI to watch runs stream in.

Reality check: we didn’t finish everything. Some agents are bare-bones, GraphRAG is limited to a smaller subset, and the UI still has rough edges.

How we built it Agents via MCP + LangGraph Orchestrator routes to Librarian (RAG/GraphRAG), Quant Researcher (vectorbt), Risk (VaR/ES), and Allocator (PyPortfolioOpt). Long jobs are tools, not chat.

Gigacontext retrieval Azure/Unstructured parsing → semantic chunking (tables kept intact) → embeddings in pgvector; hybrid search + optional rerank.

Compute on Modal Map-reduce backtests, Monte Carlo, and small model jobs; artifacts stored on Volumes; Secrets for API keys.

LLM backends Ollama locally for free dev; vLLM (OpenAI-compatible) on Modal for speed when we needed it.

Data SEC EDGAR (no key), FRED (macro), Alpaca (paper), optional Binance.

Stack FastAPI, Uvicorn, LangGraph, pgvector/Postgres (Docker), vectorbt, PyPortfolioOpt, LightGBM+Optuna (WIP), SHAP (WIP), Next.js + Tailwind + shadcn.

Challenges we ran into pgvector on macOS: StackBuilder didn’t ship it; we moved to the pgvector/pgvector Docker image and created init scripts.

Port collisions with multiple MCP servers; added health checks and freeport helpers.

Chunking quality: naïve splits hurt recall. Layout-aware parsing and treating tables as atomic chunks helped a lot.

Tool reliability: long jobs needed retries, timeouts, and idempotent job keys. We also had to cap resource usage to fit hackathon credits.

Accomplishments we’re proud of (even if small) A working end-to-end loop: prompt → strategy code → parallel backtests → basic risk check → allocation → dashboard artifacts.

A simple QuantSpec that turns natural language into reproducible strategy configs.

Clean separation of concerns: agents for brains, Modal for muscles, pgvector for memory.

What we learned Retrieval for finance is about structure (sections, tables) as much as embeddings.

Agents ≠ chat. Heavy work needs typed tools and timeouts, not more prompts.

Serverless burst is perfect for quant sweeps—start from zero, scale to many workers, then back to zero.

What’s next for Alpha Agent Finish Model Scientist: full label/feature pipeline, LightGBM+Optuna HPO, SHAP explanations baked into the UI.

Scale GraphRAG to the full filings corpus and add transcripts/news.

More alloc/risk realism: turnover, transaction costs, liquidity screens; scenario libraries.

UX polish: richer charts, pipeline traces, and one-click shareable research notes.

How to try it (local dev) docker compose up -d (Postgres + pgvector + pgAdmin)

python init_db.py (creates tables & extensions)

Run MCP servers (FastAPI) and the LangGraph orchestrator

Open the dashboard and ask: “Backtest moderate-risk crypto momentum.”

Built With

Share this project:

Updates