Pre-trade checks for AI trading agents

reTrade is an independent pre-trade check for AI trading. Before your agent’s order reaches the broker, the SDK asks reTrade, and the order is placed as sent, cut to what fits, or blocked.

In development. Not released yet; names and formats may change.View as Markdown

What reTrade does

We make AI Agentic Trading mistakes insurable. Your AI agent still decides what to trade. reTrade checks each of its orders against rules your business sets, such as how much of the account one stock may take, and answers in the same request. No AI can change those rules, your own agent included.

Each order gets one of three answers. Nothing waits for a person: there are no holds and no approval step.

reTrade’s three answers, and what happens to the order
AnswerWhat it meansWhat the SDK doesWhat your code does
ALLOWThe order fits every rule.Places it as sent, once.Keep the decision id with your order record.
CUTIt fits only at a smaller quantity.Places the smaller quantity reTrade approved.Treat quantity as what was placed. Don’t send the rest another way.
BLOCKIt breaks a rule, or no room is left.Places nothing.Don’t send it another way. Resize to fits when it’s set, re-plan or ask your user.

Every answer comes with a signed receipt, chained into your log so any later change shows: the log is tamper-evident. The SDK keeps the signed records on your side, as evidence an insurer can review. reTrade is not an insurer, guarantees nothing and pays no losses.

How one order flows

  1. Your agentDecides on an order and hands it to the SDK with place.
  2. The SDKReads the account and a fresh quote from your broker through your adapter, signs the request with your bot’s key and sends it to reTrade.
  3. reTradeChecks the order against your rules, answers ALLOW, CUT or BLOCK with the rule that decided, signs the answer and chains it into your log.
  4. The SDKChecks the signature and that the answer is about this exact request, then places what was approved through your adapter: the order, the smaller size, or nothing.
  5. Your recordsThe SDK reports what the broker did, gets a signed receipt back and keeps all of it in the claim kit. Your agent gets the result.

reTrade never connects to your broker, never holds your broker login and never moves money. Only your own code, the adapter, talks to the broker.

An example

Your agent asks to buy 40 shares at a 187.25 limit, an order worth 7,490. The account’s per-order line is 5,000, so reTrade answers BLOCK, reason approval_line per_order, with fits of 26: 26 shares at 187.25 is 4,868.50. Nothing is placed. Your agent can send 26, re-plan, or ask its user.

What you need

  • Python 3.12 or later, or Node 22.18 or later.
  • A tenant at reTrade with at least one account in it. Access comes through a pilot: ask for one.
  • From your admin: your bot’s key id and the account’s ref. From reTrade: its root public key.
  • Your broker code: four small functions the SDK calls to read the account and to place, find and cancel orders.

Where to go next

reTrade is pre-release, and live trading isn’t switched on yet: test with a paper or practice account. Ids, prices and orders in these docs are illustrations.