AllPath logo

Trading Agent

open source

by AllPath

AllPath · Trading Agent

A trading agent that proposes.
You approve.

Self-hosted, open source. Write strategies in plain YAML, let a sentinel watch them every hour, chat with an agent that remembers how you think — and keep a human approval gate in front of every single order.

Broker
Alpaca · paper
Models
Any via OpenRouter
Stack
Python · SQLite
127.0.0.1:8791 — Dashboard
Dashboard: equity curve with week / month / YTD / year tabs, positions table, and compact strategy cards. All figures are demo data.
demo data — not a real account

How an order happens

Six hops. One of them is you.

  1. sentinel

    rule fires

    price < 150 in your YAML strategy

  2. agent

    agent researches

    reads the chart, your memory, the thesis

  3. agent

    proposal queued

    order or strategy change, with a diff

  4. you

    you approve

    web, phone push, or Telegram link

  5. code

    risk gate

    deterministic caps — cannot be bypassed

  6. broker

    paper order

    Alpaca paper account by default

The agent has no tool that places an order or writes a strategy file. It can research, remember, and propose. Approval is a click on the Pending page, a one-time link in a notification, or nothing at all — in which case nothing happens.

Strategy sentinel

Write the plan once. It gets checked every hour.

Strategies are plain YAML: a thesis, a target weight, and rules like `price < 140 → sell all`. During market hours the sentinel evaluates every active strategy on your interval, arms and fires rules, and queues anything that needs a decision.

Strategies page: cards for four fictional strategies with horizon and bias chips, live price and day change, and colour-coded key levels.

An agent that remembers

Talk to it in the browser or in Telegram — same agent, same memory.

Ask what a position looks like against its plan, tighten a stop, draft a new strategy. It keeps four layers of memory (your profile, strategies, per-stock notes, lessons) and consolidates them nightly, so it gets less generic the longer you use it.

Chat page: the agent answers a question about NVDA with a small table, then queues a stop-loss change for approval.

Nightly reflection

After the close, it re-reads the day and tells you what it thinks.

A bounded reflection session reviews every strategy against the day's fills, prices, and triggers, writes durable lessons into memory, and — when a thesis has drifted — proposes a revision. You get the report on your phone; the proposal waits on the Pending page.

Pending page: a reflection-proposed strategy revision shown as a side-by-side diff, and a triggered buy order with its price context, each with Approve and Reject.

What it will not do

Built for the boring failure modes: nothing moves money without you.

  • Paper by default

    Alpaca paper trading out of the box. Live trading is a deliberate .env change, not a checkbox.

  • Every order waits for you

    The agent can only propose. Web, one-tap link, or Telegram — but a human clicks Approve.

  • Risk gate in code

    Position caps and daily limits are deterministic Python the LLM cannot reach around.

  • Strategy edits are diffs

    Chat drafts and reflection proposals land as side-by-side diffs. Nothing writes to a strategy file except your approval.

  • Runs on your machine

    SQLite, local YAML, your own API keys. Nothing leaves your box but the calls you configured.

  • Honest state

    Draft strategies are labelled not monitored. Fills show submitted vs filled. A stale heartbeat shows as stale.

Quick start

Five minutes to a running agent. Paper account, no card.

  1. 01

    Clone and install

    git clone https://github.com/dukesky/allpath-trading-agent
    cd allpath-trading-agent
    uv sync
  2. 02

    Add two keys

    cp .env.example .env
    # ALPACA_API_KEY / ALPACA_SECRET_KEY  (paper account, free)
    # OPENROUTER_API_KEY  (or OpenAI / Anthropic)
  3. 03

    Start the web UI

    uv run allpath-trade serve
    # → http://127.0.0.1:8791  (token printed on first run)
  4. 04

    Draft a strategy in chat

    “Buy NVDA on pullbacks under 170, up to 20% of the account,
     hard stop at 140.”
    # → queued on Pending as a diff → Approve → activate on the Strategies page
  5. 05

    Take it with you

    Settings → Push (ntfy) or Telegram
    # triggers, fills, reports and approve links on your phone

Full setup, the strategy YAML reference, and every safety note are in the README (English and 中文). Requires Python 3.11+ and uv.

More of the UI

Strategy detail: thesis, rules with live state, version history, and the per-strategy notification toggle.
Strategy detail: thesis, rules with live state, version history, and the per-strategy notification toggle.
Memory page: the agent's curated layers — profile, strategies, per-stock notes, lessons — read-only, written only through conversation.
Memory page: the agent's curated layers — profile, strategies, per-stock notes, lessons — read-only, written only through conversation.
Settings: model dropdowns from a live catalog, per-channel notification tests, Telegram pairing, one Save.
Settings: model dropdowns from a live catalog, per-channel notification tests, Telegram pairing, one Save.