Skip to main content
← Back to Guides
Advanced📖 12 min

The Rule Builder: From IF-THEN Rules to Safe Automation

Most trading automation fails in one of two ways: the logic is a black box you can't audit, or the guardrails are an afterthought you discover during a drawdown. Predite's Rule Builder is our attempt to fix both at once — entry logic you write yourself as plain IF-THEN rules, wrapped in an execution system where every dollar of live money has to be earned through paper trading first. This guide walks the whole path: building a rule, validating it with alerts, composing exits, and graduating it from simulation to the real CLOB.

What the Rule Builder Is

Open Bots → Create and choose the Rule Builder template. Where the other templates (ARB Hunter, Whale Copier, Mean Reversion…) ship with fixed logic and a few tunable knobs, the Rule Builder gives you an empty rule: a set of conditions, a combine mode, and an action. On every evaluation cycle the bot scans eligible markets, tests your conditions against each one, and acts on the markets that pass.

The design goal is auditability. You should be able to look at any trade your bot made — even weeks later — and see exactly why it happened. That's why every entry records a trade reason listing the specific conditions that matched, with the actual values ("edge 12.4pp ≥ 10pp; resolves in 41h ≤ 72h; whale $31k ≥ $25k"). If a rule is misbehaving, the trades themselves are the debug log.

The Nine Conditions

A rule combines up to 10 conditions, drawn from nine native types:

  • AI edge ≥ X pp — the gap between Predite's AI probability and the market's implied price, in percentage points. This is the core "the market is wrong" signal.
  • YES price ≤ X¢ — only enter below a price ceiling. Useful for longshot strategies or catching markets that haven't repriced yet.
  • YES price ≥ X¢ — only enter above a price floor. Useful for favorite/convergence strategies.
  • Volume ≥ $X — a liquidity filter. Thin markets have wide spreads that quietly eat your edge.
  • Resolves in ≤ X hours — only markets near resolution.
  • Resolves in ≥ X hours — only markets with time remaining.
  • Whale entered ≥ $X — a whale position of at least $X was detected in the market, from the real on-chain whale feed. Honest limit: this reflects recent on-chain moves the feed has observed, not a guaranteed real-time mirror of every wallet.
  • Title contains term — substring match on the market title ("Fed", "Bitcoin", a candidate's name).
  • Category is X — restrict to one category.

ALL vs ANY: Get This Right First

Conditions combine in one of two modes, and the difference is the single most common source of surprised users:

ALL (AND) means every condition must hold. Each condition you add makes the rule stricter — fewer, higher-conviction entries. ANY (OR) means one condition is enough. Each condition you add makes the rule looser — more entries, lower average quality. A 5-condition ANY rule is not a "sophisticated" rule; it's five separate hair-triggers sharing one bot.

There's no mixed nesting ("A AND (B OR C)") inside one rule, deliberately: nested boolean logic is where people lose the ability to predict their own bot. If you need composite logic, split it into two bots — each one stays readable, and attribution stays clean.

A Worked Example: The Late-Convergence Sniper

Here's a real rule you can build in two minutes. The thesis: in the final days before resolution, markets with a persistent AI edge and fresh whale interest tend to converge toward the AI's probability — and the short time window limits how long your capital is stuck.

Set the combine mode to ALL, then add:

  1. AI edge ≥ 10 pp — we only care about meaningful disagreement between model and market.
  2. Resolves in ≤ 72 hours — the convergence window. Time-boxing the trade also time-boxes the risk.
  3. Whale entered ≥ $25,000 — someone with size (and possibly better information) has already committed to this market on-chain.

Action: Follow AI — buy whichever side the AI favors.

Read what this rule actually says: "when the model and at least one whale both disagree with the crowd, and we'll know the answer within three days, take the model's side." Every condition earns its place. Volume and category filters are reasonable additions, but start minimal — you can tighten a rule that fires too often; you learn nothing from a rule that never fires.

One behavior to know: Follow AI never invents a direction. If a market passes your conditions but has no AI call, the rule simply doesn't enter. You'll occasionally "miss" an entry because of this. That's the correct behavior — an entry without a signal is a coin flip with extra steps.

Validate with Alert-Only Before You Trade

Every rule has an "Alert only" checkbox. Checked, the rule never trades — instead, when conditions match, you get a bell, Telegram, and push notification. Alerts are deduplicated to one per market per 24 hours, so a market oscillating around your threshold doesn't spam you.

This is the cheapest validation loop in the platform, and you should use it before every new rule goes anywhere near execution. Run the sniper rule in alert-only for a week. Each alert is a question: "would I take this trade manually?" If the answer keeps being no, your conditions are wrong — fix them now, while the cost of being wrong is a notification instead of a position. Alert-only also doubles as a permanent mode: some users run rules purely as custom scanners and never automate them at all.

Exits: Where the Actual Risk Management Lives

The Rule Builder decides entries only. Exits come from the bot's standard protection controls, and they compose — you can arm several at once:

  • Stop-loss — exit when the position loses X%.
  • Take-profit — exit when it gains X%.
  • Trailing stop — a stop that ratchets up as the price moves your way, locking in gains.
  • Breakeven — after enough profit, move the stop to your entry so the trade can no longer lose.
  • Pre-resolution exit — close the position a set time before the market resolves.

The pre-resolution exit deserves special attention in prediction markets, because of the 0/1 settlement gap. A stock that goes against you falls 5%; a prediction-market share that resolves against you goes to zero. There is no partial credit at settlement — YES pays $1.00 or $0.00. A stop-loss cannot protect you through resolution, because resolution isn't a price move you can exit into; it's a discontinuity. If your strategy has no view on the final outcome — like the convergence sniper, which bets on the *drift*, not the answer — arm the pre-resolution exit and be out before the coin lands.

Protections are managed as a strict OCO (one-cancels-other) group: when one triggers, the siblings are cancelled, and manually closing a position cancels its pending protections. You'll never take a double exit from two triggers racing.

Paper First: The Graduation Gates

New Rule Builder bots trade paper money, and that's not a suggestion — it's a gate. Live execution for automation is flag-gated and paper-first: a bot must complete at least 10 paper trades before it's eligible to graduate to real money. The Real Trading page shows a 5-step graduation checklist so you always know where a strategy stands on the path from simulation to CLOB.

Ten trades won't prove statistical significance — no honest platform would claim that. What they prove is *mechanical* correctness: the rule fires on the markets you intended, the trade reasons match your thesis, the exits trigger the way you configured them. Statistical confidence takes longer; keep the bot in paper as long as you need. The gate is a floor, not a target.

Going Live: Caps, Exposure, and the Kill Switch

When a rule enters with real money, it doesn't get a blank check. Every live automated entry passes the same guarded execution path as everything else on Predite:

  • Automation caps: $25 max per trade (raisable to $250 via an email-code step-up), $100 per day per bot, at most 3 simultaneous open positions, and $500 per day globally across all your automation.
  • Category exposure limits stop a rule from concentrating your whole account in one category — an OR rule gone loose can't stack ten correlated politics positions.
  • The kill switch halts all live automation instantly, and the "Your safety guards" card on the Real Trading page shows every guard currently applied to your account — master switch, your beta access, caps per origin — so when a trade is blocked, you can see which guard blocked it.

These limits will occasionally stop a trade you wanted. That's the deal: the same ceiling that caps a good rule's enthusiasm caps a broken rule's damage, and at 3am, with a corrupted ruleset, you want the ceiling. Speaking of which — an invalid or corrupted ruleset never opens positions at all. The Rule Builder fails closed.

Publishing and Forking

Once a rule has a track record you're proud of, you can publish it to the strategy marketplace, and other users can fork it. Forking copies the configuration — conditions, combine mode, action, exit settings — into the forker's account. Your capital, positions, and history stay private. Forked bots start at the beginning of the graduation path like any new bot: your 10 paper trades don't transfer, because the fork's owner hasn't verified anything yet.

The Loop, End to End

Build the rule in Bots → Create → Rule Builder → run it alert-only for a week and sanity-check what it flags → switch it to paper and let it trade simulated money → read the trade reasons and tune conditions → complete the graduation checklist → go live inside the automation caps, with the pre-resolution exit armed if your thesis ends before the market does. At every step, the system tells you exactly what it did and why — which is the whole point of writing your own rules instead of trusting someone else's black box.

The Rule Builder: From IF-THEN Rules to Safe Automation | Predite