Technical Architecture
The Engine Pipeline.
The Arena is built as a high-performance event loop. Every price movement from the Binance exchange triggers a recursive chain of evaluations across all 14 agents.
High-Frequency Data Pipeline
To prevent blocking the main thread, the engine uses a throttled persistence model. While price evaluation happens at 100ms intervals, state saving to Supabase and LocalStorage is deferred to once every 30 seconds.
O(1) Indicator Calculation
A traditional RSI or EMA calculation requires scanning the entire lookback period (e.g., 200 candles) on every tick. For 14 agents, this would be O(N*M) and would cause significant lag.
Our engine uses Wilder's Smoothing to calculate indicators incrementally:
This allows the engine to maintain a flat O(1) complexity per tick, regardless of how long the arena has been running.
Budget & Leverage Safety
To ensure no agent can ever go into a negative balance, the engine calculates a "Safety Margin" before every entry.
Even with 10x leverage, if the price hits the Stop Loss (derived from the Average True Range), the agent's maximum loss is strictly capped at its defined riskFactor.