Skip to main content
AI Fin Hub

Generator

Trading System Blueprinter

Pick your data source, LLM, broker, storage, risk engine, logger. Get a Mermaid architecture diagram + a copyable starter file tree.

Runs in your browser. Nothing you enter is uploaded, and no account or API key is needed.

Education, not investment advice. Past performance does not predict future results. How we check our numbers.

1. Pick your stack

Data source

Where your bars / quotes / book events come from.

Broker

Who your orders route through.

LLM layer

Research + decision-support model. BYO keys.

Storage

How you persist bars, trades, decisions, dossiers.

Risk engine

What stops you from blowing up.

Logging + observability

How you see what the agent actually did.

Scheduler

How cadence is enforced.

Stack signature

Alpaca → Claude Opus 5.5 → Alpaca

7 / 7 layers chosen, risk: Fractional Kelly sizer (quarter Kelly cap)

Schedule: launchd (macOS-native). Storage: DuckDB + Parquet. Logging: Heartbeat JSON + Telegram alerts

2. Architecture (Mermaid)

flowchart LR
  SCHED["launchd"] -->|tick| DATA["alpaca"]
  DATA -->|bars / book events| NORM[Normalize + persist]
  NORM --> STORE["duckdb"]
  STORE --> RESEARCH["claude-opus-5-5 · price-blind research"]
  RESEARCH -->|proposal + confidence| RISK["fractional-kelly"]
  RISK -->|sized order| EXEC["alpaca"]
  EXEC -->|fills + errors| LOG["heartbeat-json"]
  LOG --> STORE
  LOG -.-> ALERT[Telegram / email]

Paste into any Mermaid-compatible renderer (Notion, Obsidian, GitHub, VS Code preview).

3. Starter repo scaffold

trading-system/
├── README.md                    # start here
├── .env.example                 # API keys (never commit real values)
├── scripts/
│   ├── fetch-bars.py            # data source → local duckdb
│   ├── research.py              # LLM call (price-blind context builder)
│   ├── decide.py                # risk sizing + decision logger
│   ├── execute.py               # broker call (idempotent)
│   └── heartbeat.py             # health probe + alert
├── data/
│   ├── heartbeat.json           # last-heartbeat timestamp (watchdog reads)
│   ├── circuit.json             # {"paused": false, "reason": ...}
│   └── tickers/                 # per-ticker markdown dossiers
├── memory/
│   └── decisions.jsonl          # append-only decision log
├── plists/
│   └── com.you.trader-*.plist   # launchd schedules
├── tests/
│   ├── test_research_no_price_leak.py
│   ├── test_sizing_caps.py
│   └── test_idempotent_orders.py
└── pyproject.toml

Minimal, opinionated layout. Everything non-runtime lives outsidescripts/. Add pyproject / requirements to taste.

Why this shape

  • Schedule → data → research → risk → execute → log enforces the ordering that keeps your LLM out of the price decision loop.
  • Heartbeat + circuit breaker are first-class so you can spot dead pipelines in under one cycle.
  • Append-only decisions.jsonl makes post-mortems possible; any LLM-driven system is unauditable without it.
  • Tests cover the three most dangerous failure modes: price leakage, sizing blow-up, duplicate orders.

How to use it

  1. Pick your data source (Databento, Alpaca, Polygon, or Tiingo). This sets the ingestion layer in the diagram.
  2. Choose the LLM for signal generation and the broker for execution (Alpaca, IBKR, Tradier, or paper trading).
  3. Select the storage backend, risk engine (fractional Kelly, vol-target, max-drawdown kill, or no risk layer), logger, and scheduler.
  4. Read the Mermaid architecture diagram — it reflects your seven selections and shows how each layer connects.
  5. Copy the starter file tree to your clipboard. It's a scaffold — wire your own tests, secrets management, and observability before pointing it at real capital. There is no ZIP download and no compliance section.

Questions people ask

What does the blueprint output look like?

A Mermaid architecture diagram that reflects your seven picks (data source, LLM, broker, storage, risk engine, logger, scheduler) and a copyable starter file tree for the repo. It's a shape-and-scaffold tool: the diagram is the discussion artefact, the file tree is the folder skeleton — not a per-component spec or a generated codebase.

Is this for institutional or retail?

There is no scope selector. The seven dropdowns target small-team, single-strategy production — a useful starting point for any automated strategy. Choosing the paper broker gives a research-only scaffold; a live broker adds an execution layer to the diagram. Scale the file tree to your actual needs by hand.

What does it recommend for execution infrastructure?

For retail automated strategies the execution layer is a broker API (IBKR, Alpaca, Tradier, or paper), and the tool reflects your broker choice in the diagram. Colocation and direct-exchange-connectivity tradeoffs are outside what the tool models, and the blueprint does not generate them.

Does it cover compliance and audit logging?

It picks a logger for the diagram (heartbeat JSON, Loki/Grafana, Sentry, or stdout), but it does not generate a compliance section, trade-blotter spec, or FINRA-recordkeeping checklist. Regulatory recordkeeping is your responsibility, not something the tool outputs.

Are there template configs I can copy?

The output is a copyable file tree — a folder-and-file skeleton you paste into a new repo — plus the Mermaid diagram. There are no downloadable docker-compose files, Terraform templates, monitoring dashboards, or links to template repositories; you wire the real implementation yourself.

  • Directories Finance MCP Directory

    Security-graded catalog of finance MCP servers — Alpaca, Polygon, Databento, IBKR, Tradier, Tiingo, NautilusTrader. Scope, auth, idempotency, transport.

  • Comparators Market Data API Cost Calculator

    Compute annual cost of market data across Databento, Polygon, Alpaca, Tiingo, FMP, and Alpha Vantage for your exact universe, bar resolution, and real-time needs.

  • Playgrounds Price-Blind Research Auditor

    Paste a research prompt or agent context bundle. The auditor flags price numbers, directional words, and outcome-leaking phrases that cause LLMs.

All articles

Use it from code

The same calculation as a JavaScript module you can import. It runs where you import it, with no request, key or rate limit.

import { compute } from "https://aifinhub.io/engines/trading-system-blueprinter.js";

Input and output contract and the guide for agents.