Rules and limits
Your admins set the rules each account’s orders are checked against. Agents can’t change them.
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:
| Code | What it limits |
|---|---|
single_name_cap | How much of the account one stock may take, such as no more than 10% of the account in any one stock. |
group_cap | How much a group of holdings may take. |
order_size_cap | How big one order may be. |
cash_funding | Buying with cash the account doesn’t have. |
no_short | Selling shares the account doesn’t hold. |
Rules that forbid an order outright give a BLOCK:
| Code | What it checks |
|---|---|
restricted_list | The stocks the account won’t trade. |
agent_permission | Which agents may trade the account. |
order_form | The order’s form. |
new_position_pace | The pace of new positions. |
written_exit | The order’s exit level: it reads the order’s stop price. |
runaway_throttle | Too many orders a minute from one agent, or a duplicate. |
agent_conflict | Another 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.