Skip to main content

Rule trees

Each strategy has one boolean rules tree. Action sizing is a separate numeric expression. VOTE.threshold is a fraction greater than zero and at most one. The following tree requires two of three children, not one:
NOT has no singular child field:
The JSON examples describe saved engine rules, not an editor import format. In Rule tree, use AND / OR / NOT gates. The engine supports boolean operators inside an EXPR, but the editor paste path is different.

Expression grammar

min and max take exactly two arguments. Nest them for additional caps. There is no floor, pow, ternary operator, assignment, or arbitrary JavaScript execution.
The result is 2. Numbers use the engine’s high-precision expression VM. Positive action sizes are truncated toward zero when converted to integer intent amounts; a positive fraction below one raw unit does not create a usable amount. See Action Config.

Guard runtime division

Prefer multiplication for ratio triggers:
If division is necessary, place its guard first:
Both are false for an empty snapshot without dividing by zero. AND/OR tree order matters for the same reason. Do not rely on a guard in a different strategy. A VOTE tree is not a substitute for an outer safety guard.

Validation stages

  1. Editor: quantity, token metadata, action parameters, and expression checks help construct a payload. Copy the normalized engine expression to inspect its actual units.
  2. Save: backend shape, identifier-policy, and static-type checks reject malformed trees, unknown aliases, and boolean/numeric type mismatches. This is not an empty-snapshot execution.
  3. Evaluation: the compiled expression reads a snapshot. Missing identifiers read as zero at this low-level stage; division can still fail at runtime.
  4. Publication: readiness, freshness, positive integer size, conviction, risk, cooldown, and occupied-slot checks can prevent an intent even when its boolean rule is true.
  5. Execution: authorization, available balances, venue constraints, slippage, and transaction success are separate checks.
A syntactically valid dynamic identifier is not proof that a feed supplies it. Select actual fields from Variables and verify their units and freshness, as in Write and update a strategy. Do not invent aliases such as vault_pps_stale or tick_age_seconds.

Conviction

Minimum conviction can suppress publication. These modes do not count consecutive passing ticks. RULE_VOTE_RATIO evaluates top-level children independently, so a separate top-level guard does not protect another child’s division while calculating that score. Make each child safe or use BINARY for a guarded trigger.