Abhi-AlgoForge Back home

Tradier AI Swing Desk

An AI-assisted swing-trading platform for Tradier — from analyst PDF to filled bracket order, with a human in the loop.

Client engagement — source code stays private. Shown: architecture, flows and UI.

Tradier AI Swing Desk automates weekly swing trades on a regulated US broker — long shares, single calls and puts, and multi-leg debit spreads. What makes it unusual is where signals come from: not indicators or TradingView alerts, but weekly analyst watchlists that arrive as PDF documents.

An intake service feeds each PDF to the Anthropic Claude API, which extracts the technical-analysis section into structured setups — symbol, direction, entry trigger, a two-tier take-profit ladder and a stop. Nothing trades on its own: parsed setups land in a review queue where the trader verifies each one, picks the option expiration and strike from Tradier's live chain, and stages the trade behind a ~25-field validation schema.

From there a 24/7 Python engine takes over. It wakes each trade at its holiday-aware activation slot, watches a real-time WebSocket price stream for the entry trigger, runs a gap-protection check at the open, and routes orders the smartest way available — broker-side OTOCO brackets when the trade shape allows it, engine-managed per-leg execution for options and spreads.

The whole platform runs as three supervised services on a Linux VPS — engine, AI intake and an authenticated Next.js operations dashboard — coordinating through lock-protected atomic state with a full audit trail: an activity feed, a per-trade event timeline and a structured CSV trade log.

System architecture

The modules that make it up, and how data flows between them.

AI intake service

PDF watchlists → JSON setups (Claude)

Operations dashboard

Next.js review & staging queue

Shared state layer

Atomic lock-protected JSON sync

Execution engine

24/7 live execution + recovery

Hover a module to trace what it feeds.

Signal flow

One watchlist entry, end to end — from PDF ingress to the audit trail.

  1. 1

    Watchlist arrives

    The weekly analyst PDF hits an authenticated webhook (or is uploaded manually) and passes size and file-type checks before anything touches it.

  2. 2

    AI extraction

    Claude reads the document and returns structured setups — symbol, direction, entry trigger and condition, take-profit ladder, stop loss — as validated JSON.

  3. 3

    Blocklist filter

    Symbols on the blocklist are dropped at the door; everything else queues as pending review.

  4. 4

    Human review & staging

    The trader verifies each setup in the dashboard, attaches expiration and strike from the live option chain, and stages it — a ~25-field schema rejects anything inconsistent (stops on the wrong side, targets out of order).

  5. 5

    Scheduled activation

    The engine wakes the trade at its activation slot — holiday-aware scheduling included — and subscribes the symbol to the live price stream.

  6. 6

    Gap check at the open

    Within limits

    Price opened near the plan — proceed to the entry watch.

    Gapped past threshold

    Price jumped beyond the configured percent or absolute band — the trade is cancelled before any order is placed.

  7. 7

    Entry trigger

    The streamed price crosses the trigger condition and the engine moves to execute.

  8. 8

    Order routing

    Broker-side bracket

    Eligible share trades go out as OTOCO brackets — stop and targets live at the broker and survive any engine downtime, including a two-bracket split that emulates partial scale-outs the broker doesn't natively support.

    Engine-managed

    Options and spreads are placed per-leg at the trader's preferred price (bid / ask / mid / limit), with contract symbols validated against live quotes and entries capped at three attempts.

  9. 9

    Fill tracking

    Order status is polled until resolution; rejections — including the broker's "200 OK with an embedded error" responses — are caught and surfaced, and the fill price is recorded.

  10. 10

    Exit management

    Stops are checked on every tick, TP1 scales out part of the position, TP2 closes the rest — and a failed exit order is never forgotten: it retries every tick until it lands.

  11. 11

    Audit trail

    Every event is written three ways: the dashboard activity feed, a per-trade event timeline and a structured CSV trade log.

Engineering highlights

The details that keep it alive with real money on the line.

Crash-safe recovery

On every restart the engine reconciles its tracked trades against live broker positions and open orders — and if reconciliation itself fails, it fails safe and flags the trade for manual review instead of re-entering.

Resilient market data

WebSocket stream with exponential-backoff reconnect, automatic REST fallback and promotion back, a watchdog that forces reconnects after silence, and staleness checks on every price read.

Fail-safe exits

A failed stop-loss order can never silently complete a trade — a sticky flag re-fires the exit on every tick until it fills. Entries are capped and auto-cancelled instead of looping.

LLM as production plumbing

Strict-JSON prompting with condition normalization, schema validation and graceful failure paths — AI treated like any other unreliable upstream, not a demo.

Broker-side brackets

Trade shapes are auto-detected and routed to OTOCO brackets whenever possible, so exits keep working even if the engine goes down.

Security by default

Broker token encrypted at rest, timing-safe secret comparison on every entry point, JWT-auth dashboard, and the AI service reachable only through an authenticated relay.

Under the hood

The stack, and the system in numbers.

Engine
PythonWebSocketsRESTFernet encryption
AI intake
FlaskAnthropic Claude API
Dashboard
Next.jsReactTypeScriptTailwind CSSNextAuthZod
Broker
Tradier RESTTradier market-events WebSocket
Operations
Linux VPSPM2nginx
10.7k
Lines of code
3
Always-on services
4
Instrument types
24/7
Running live

Need a system like this?

I design and build trading infrastructure end to end — let's talk about yours.