Rules and limits

Your admins set the rules each account’s orders are checked against. Agents can’t change them.

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

Who sets the rules

Your business’s people do, with their admin keys, through reTrade’s admin API and its command line, retrade-admin (both in development). A tenant has at least two admin keys. An agent’s key can ask for decisions and engage a stop, never change limits, modes or keys. So no AI can change the rules it’s checked against, including your own agent.

A tighter limit applies at once. A looser one waits 24 hours.

First setup is the time before any account enforces. During it, changes apply at once. Whether to keep this setup window is still being decided.

What a rule can limit

Each rule has a code, and a CUT or BLOCK names the one that decided it. Limits that leave room for fewer shares give a CUT, or a BLOCK when there’s no room at all:

Limits that can cut an order
CodeWhat it limits
single_name_capHow much of the account one stock may take, such as no more than 10% of the account in any one stock.
group_capHow much a group of holdings may take.
order_size_capHow big one order may be.
cash_fundingBuying with cash the account doesn’t have.
no_shortSelling shares the account doesn’t hold.

Rules that forbid an order outright give a BLOCK:

Rules that block an order
CodeWhat it checks
restricted_listThe stocks the account won’t trade.
agent_permissionWhich agents may trade the account.
order_formThe order’s form.
new_position_paceThe pace of new positions.
written_exitThe order’s exit level: it reads the order’s stop price.
runaway_throttleToo many orders a minute from one agent, or a duplicate.
agent_conflictAnother agent trading the same stock the other way. fits is 0.

Reason codes lists every code, with what the agent can do about each.

Dollar lines

Dollar lines cap the value of orders: per order (per_order), per agent per day (per_agent_day), per day (per_day), and in two other ways (openings_pct, hard_cap_day). An order over a line isn’t held for anyone. It comes straight back as a BLOCK, code approval_line with the line as its reason, and fits: the largest quantity that would pass.

The lines are your own, not limits of reTrade’s. A new tenant starts at 5,000 per order and 10,000 per day. Your admins set their own lines when the tenant is made, or later with retrade-admin policy set.

For example, a buy of 40 at a 187.25 limit is worth 7,490. Under the 5,000 per-order line it comes back as BLOCK, approval_line per_order, with fits of 26: 26 shares at 187.25 is 4,868.50.

Missing or old facts mean BLOCK

reTrade decides only on facts it can check. An account it doesn’t know, a price older than 30 seconds, or a stock it can’t match exactly is a BLOCK, with a code that says which: ACCOUNT-UNKNOWN, QUOTE-STALE, SYMBOL-UNKNOWN. So is account data that’s missing, old or doesn’t add up.

The account data always comes from your broker, through your adapter, never from the agent.

Stops

A stop halts trading for the whole tenant, one account or one agent. Any executor key can engage one, your agent’s included, with stop. Only an admin key releases it (retrade-admin release). While a stop is engaged, the orders it covers come back as BLOCK STOPPED. When reTrade’s runaway check switches an agent off, its orders come back as AGENT-STOPPED until an admin turns it back on.