OS Trading Engine
Platform Guide
Trading Signals
Signal Processing Flow

Signal Processing Flow

Nexgent AI uses a fast, event-driven pipeline to process trading signals. The entire journey from signal creation to trade execution typically takes less than 500ms.


High-Level Flow

The diagram below illustrates the path a signal takes through the system:


Detailed Processing Steps

1. Signal Creation & Validation (< 10ms)

  • Validation: The API checks for required fields (tokenAddress, signalType, etc.).
  • Persistence: The signal is saved to the database.
  • Emission: An internal signal_created event is fired immediately after storage.

2. Agent Discovery (< 10ms)

The Signal Processor listens for the creation event. It queries Redis to find all active agents and their configurations. By using Redis instead of the primary database, Nexgent avoids bottlenecks during high-volume periods.

3. Parallel Eligibility Check (< 50ms)

The system evaluates the signal against all agents simultaneously. To trigger a trade, an agent must pass these filters:

  • Automated Trading: Enabled for the current mode.
  • Min Score: Signal strength ≥ agent's minScore.
  • Filters: Token is not blacklisted (and is whitelisted, if applicable).
  • Liquidity: Sufficient SOL balance in the agent's wallet.

4. Trade Execution (< 400ms)

Eligible agents execute trades in parallel:

  • Deduplication: A SignalExecution record is created first to prevent double-trading.
  • Execution: The agent requests a swap via Jupiter Aggregator (on-chain for Live, mock for Simulation).
  • Position Tracking: A new position is created and monitoring starts instantly.

Performance & Scaling

FeatureImplementationBenefit
ArchitectureEvent-DrivenDecouples API response from heavy processing.
ConcurrencyParallel ExecutionScaling from 1 agent to 100+ doesn't increase processing time.
CachingRedis-FirstSub-millisecond configuration lookups.
IndexingDB OptimizationFast audit trails and historical performance lookups.

Error Handling & Guarantees

  • Idempotency: The SignalExecution table ensures that a single signal cannot be processed twice by the same agent.
  • Independent Failures: If one agent fails to trade (e.g., insufficient balance), it does not affect other eligible agents.
  • Audit Trail: Every evaluation result—including why an agent skipped a signal—is logged and viewable in the dashboard.

Troubleshooting

  • No Trades Executed: Check if the token is blacklisted or if the agent's SOL balance is below the configured minimum.
  • Delayed Processing: Monitor RPC latency or Redis connection health.
  • Missing Signals: Ensure your API key has the correct signals scope and that your source is sending valid JSON.