Rules Engine

The decision-making core of ClashX.

Core Execution System
The rules engine evaluates bot strategy graphs against live market data and produces a list of actions to execute. It's the core system that takes user intent and translates it into on-chain Pacifica orders.

Supported Conditions

The rules engine supports over 50 approved condition types across several categories:

Price Conditions

  • price_above / price_below
  • price_change_up / price_change_down
  • price_crosses_above / price_crosses_below

Indicator Conditions

  • rsi_above / rsi_below
  • sma_crossover / ema_crossover
  • macd_bullish / macd_bearish
  • bollinger_bands_breakout

Supported Actions

When conditions are met, the engine emits actions. Available actions include:

open_long / open_short// Initiate a new position
close_position / close_all_positions// Exit active trades
set_stop_loss / set_take_profit// Defensive order placement
scale_in / scale_out// Partial position sizing
pause_bot// Hard-stop automation based on severe risk triggers

Validation Pipeline

Before a strategy graph can be deployed, it passes through rigorous structural validation:

Topology checks

Enforces no cycles, no orphan action nodes, single root per isolated logic tree.

Risk enforcement

Asserts that every open_ node has a reachable stop-loss path.

Parameter checks

Verifies schema compliance for numeric thresholds.