Skip to content
all work

04 / agents · trading / 2026

AI Trading Agent

LLMs trade crypto perps head to head. Each model gets a $1,000 book, reads the market every five minutes and acts through tool calls, with the same code running on paper, testnet and mainnet.

Role

Solo build

Stack

Python / FastAPI / SQLAlchemy / PostgreSQL / OpenRouter / Lighter SDK / React / Recharts / Tailwind

source
modes: paper, testnet, live

3

modes: paper, testnet, live

decision loop per model

5 min

decision loop per model

unit tests

23

unit tests

Traduze dashboard in sandbox mode: the total account value chart on the left, and Claude Sonnet's latest market analysis with a CREATE_POSITION tool call for ZEC on the right
The dashboard in sandbox mode. Left: account value per model. Right: the latest invocation, with the model's reasoning and the tool calls it made.

Overview

Traduze puts LLMs in charge of a trading account and lets them compete. Each model you register gets its own $1,000 book and trades crypto perpetuals on Lighter, a zk-rollup perps exchange: SOL and HYPE at up to 10× leverage, ZEC at 5×. Every five minutes each model reads the market, reasons about it and acts through tool calls. A leaderboard ranks the models by PnL.

It's an experiment harness, not a claim about returns. The interesting engineering is the plumbing that lets the same agent run safely on paper, on testnet and with real money.

One decision, every five minutes

Agent loop · per model, every 5 minutes
  1. Market snapshotLighter API

    5-minute and 4-hour candles for every market

  2. Indicatorspython

    Mid prices, EMA20 and MACD computed in-house; last 10 points per timeframe

  3. Prompt assemblycontext

    Indicators, open positions, available cash, account value, invocation count

  4. Model callLLM

    Any OpenRouter model, given exactly two tools

  5. || tool execution

    createPosition

    symbol · side · quantity

    closeAllPosition

    flatten the whole book

  6. LogPostgres

    Invocation, reasoning and every tool call stored for the dashboard

↺ A separate tracker snapshots every model's account value every 2 minutes for the chart and the leaderboard.

Paper, testnet, live

The agent never knows which world it's trading in. Execution sits behind a single TradingBackend interface, and a global mode switch picks the implementation:

ModeExecutionMoneyGuardrail
SandboxPaper ledger with margin accounting, marked to the latest close$1,000 simulatedDefault on boot
TestnetReal orders on Lighter testnetFaucet fundsPer-model testnet keys
LiveReal orders on Lighter mainnetRealConfirm dialog + admin token
Every record (invocations, tool calls, portfolio snapshots) is tagged with its mode, so dashboards and the leaderboard never mix paper and real results.

Hard parts and decisions

  • A paper ledger that behaves like an exchange. Opening a position reserves initial margin at the market's leverage and is rejected if cash can't cover it. Closing returns the margin plus realised PnL, and open positions are marked to the latest close. The model faces the same constraints in sandbox that it would live.
  • Rules the model can't talk its way around. Tool schemas restrict symbols and sides to fixed enums. The prompt spells out the exchange rules (one position at a time, close-all only), and the backend enforces margin no matter what the model asks for.
  • Fading the model. The executor currently inverts every call before it reaches the exchange: when the model goes long, the bot goes short. This tests whether model conviction works better as a contrarian signal, and it's one line to switch off.
  • Fail closed. Switching modes and adding or editing models require an admin token, compared in constant time. With no token configured, those endpoints refuse to work at all. Exchange API keys are write-only: once saved, the UI only shows whether they're set.
  • Bring any model. A model is just a row: an OpenRouter model slug plus optional exchange credentials. Adding a new challenger to the leaderboard is a form, not a deploy.

Where it stands

  • Each invocation is a single model call whose tool calls run once. There's no multi-step re-prompting or reflection yet; that's the next iteration.
  • There's no backtest yet. For now the leaderboard, in sandbox and live, is the evaluation.
  • 23 unit tests cover the indicator maths, the paper-trading ledger, backend selection and leaderboard ranking.