Tags

PythonLLM AgentsSQLiteRobinhood MCPOpenRouteraifinanceagentsautomation

Finalyst is a local autonomous equities-trading experiment built around one rule: the LLM proposes, Python disposes. An LLM-backed analyst can produce a trade decision, but it never gets to bypass risk, idempotency, market-calendar, broker-reconciliation, or live-mode gates — all of which are deterministic Python, not model output.

> This is a real system that can place real trades with real money once Robinhood MCP is configured and live mode is intentionally armed. Nothing in it is financial advice.

The Autonomous Cycle

Each run walks through a fixed pipeline: broker/account snapshot → live reconciliation (when armed) → market data → candidate generation → an LLM analyst that decides each candidate against an explicit investment mandate → a deterministic red-team critique → a greedy portfolio-manager agent that selects the final basket by confidence within a daily order-count budget → deterministic risk checks → idempotency checks → SQLite persistence → JSONL audit logs → a plain-English run summary. In dry_run mode (the default), approved orders are simulated and recorded only — no live gates need to be armed to see the full loop work end to end.

Risk & Safety Gates

  • Hard capital caps ($250 total, $75 per trade in the example profile), 5 open positions max, cash-only — no margin, no short selling
  • Mandatory per-cycle position review with deterministic (non-LLM) stop-loss / take-profit exits
  • Regular-market-hours-only trading, plus a local kill switch file that halts everything
  • Live orders require three independent confirmations: mode: live, LIVE_TRADING_ENABLED=true, and an explicit --confirm-live flag
  • A curated allowed-equities universe with one hardcoded exclusion — NFLX, because the operator works there

Strategies & Data

Trend/momentum, semantic mean reversion, aggressive breakout, an optional macro ETF regime-rotation overlay, and (on the swing profile) earnings gap-and-hold plus sector relative-strength. Market data comes from Stooq historical bars and Yahoo best-effort quotes; optional dossier enrichment pulls SEC EDGAR filings and Yahoo news/signals. All of it is scored against a capital-preservation-first mandate the analyst optimizes toward, not a pure-return objective.

Operator Dashboard

A stdlib HTML server (not Streamlit) serves as a local control surface — status cards, quick actions, phone-fallback URLs, and a live view of mode, kill-switch state, recent runs, decisions, risk checks, orders, benchmarks, shadow orders, and audit events. It exposes POST actions to trigger a manual cycle, run research, or save a one-off custom trader profile without touching the immutable built-in presets.

Tech Stack

Python 3.11+ (via uv), a pluggable LLM provider layer (defaults to a no-key stub provider; OpenRouter for live decisioning), SQLite + JSONL for persistence and audit trails, and the Robinhood Agentic Trading MCP for the live broker adapter — narrowed to typed methods (get_account, get_positions, get_quote, place_order, and reconciliation calls) with equities-only support.