Live · public read access, operator-gated writes

X Copy-Trade Tool

A cautious pipeline that watches specific X accounts for trade calls, has an LLM turn them into a strict structured signal, independently validates and risk-checks that signal, and — depending on mode — logs it, proposes it for human approval, or submits it to a real OANDA practice account. Never connected to live money.

View live dashboard → Source on GitHub
Trades copied
…
Win rate
…
Closed trades
…
Currently open
…

What it does

Every post that comes in goes through the same pipeline, end to end, before anything is ever proposed or submitted:

X post→ classify→ extract signal→ validate→ risk-check→ approve→ OANDA practice

Architecture

Posts arrive through one of three input adapters (manual/JSON, a webhook fed by a companion browser extension, or the full X API v2) and land in a SQLite audit trail before anything else touches them. A rule-based pre-filter plus an OpenAI structured-output call classifies each post; a context engine pulls in prior posts from the same author only when it can state an explicit reason two posts are related, rather than assuming adjacency means continuity. A second OpenAI call extracts a strict structured signal, with hard-coded (not just prompted) safeguards — every evidence fragment must appear verbatim in the source post. That signal then passes through deterministic validation (staleness, instrument mapping, stop/target logic, market hours, conflicting positions) and a separate risk manager with its own numeric thresholds and a circuit breaker, before reaching one of three approval modes and, finally, an OANDA v20 practice-only broker integration that structurally refuses to construct against the live endpoint.

The dashboard itself is a server-rendered FastAPI + Jinja2 page with vanilla JS polling — deliberately no frontend build step. Public visitors get full read access to every tab; every write (approve/reject, kill switch, tracked accounts, manual posts) requires an operator session, enforced server-side by middleware rather than just a disabled button.

Design principles

  • Practice only, structurally. The broker layer refuses to construct against OANDA's live endpoint at all — this isn't a config flag away from real money.
  • Evidence must be verbatim. The signal extractor's cited evidence is checked against the actual source post text, not trusted from the model.
  • Validation and risk are independent. Deterministic checks (staleness, instrument mapping, stop/target logic) run separately from the risk manager's numeric thresholds — one bad number can't silently waive the other.
  • Everything is recorded. Every post, classification, signal, proposal, order, and trade is written to an audit trail, whether or not it ever became a trade.
  • Public means read-only, by default. Anyone can watch it work. Only a logged-in operator can change anything.

Tech stack

Python 3.12 FastAPI Jinja2 + vanilla JS SQLAlchemy Core SQLite OpenAI structured outputs OANDA v20 REST API Chrome/Edge extension pytest · 139 tests Docker Render

Open source

The whole thing is open source — classification/extraction, risk management, the OANDA integration, this dashboard, and this landing page. Clone it and run your own copy against your own OANDA practice account in a few minutes:

git clone https://github.com/1234Es/x-copy-trade-tool-demo.git
cd x-copy-trade-tool-demo
python -m venv .venv && source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env        # fill in OPENAI_API_KEY at minimum
python -m app.main          # open http://127.0.0.1:8000

That gets the dashboard running locally with manual/webhook post input. Full setup (OANDA practice credentials, the X API adapter, the browser extension, a security checklist before leaving it running) is in the repo's README.