OS Trading Engine
Getting Started
Core Concepts
Overview

Core Concepts Overview

Understand the fundamental concepts that power Nexgent's trading engine.


How Nexgent Works

Nexgent is an automated trading engine that processes signals and executes trades on Solana. Here's the high-level flow:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Signal    │────▢│    Agent    │────▢│    Trade    │────▢│  Position   β”‚
β”‚   Arrives   β”‚     β”‚  Evaluates  β”‚     β”‚  Executes   β”‚     β”‚  Monitored  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚                                       β”‚
                           β”‚                                       β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”                         β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”
                    β”‚  Eligible?  β”‚                         β”‚ Stop Loss / β”‚
                    β”‚  - Balance  β”‚                         β”‚ DCA / Manualβ”‚
                    β”‚  - Config   β”‚                         β”‚    Close    β”‚
                    β”‚  - Filters  β”‚                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Core Components

1. Trading Signals

What: Buy recommendations for specific tokens.

Where they come from:

  • External services via API
  • Webhooks
  • Manual entry

Key attributes:

  • Token address
  • Signal type (e.g., Hypersurge, Breakout confirmation, Price Reversal)
  • Signal strength (1-5)
  • Signal provider (e.g., Nexgent AI)
  • Activation reason (e.g., Price broke above 5-period high, Bullish candle formation, Volume up 74.30% vs average, Price up 3.14% vs last bucket, Buy/sell ratio strongly bullish (157.73%))

Learn more about Trading Signals β†’


2. Agents

What: Autonomous trading entities with their own configuration and wallets.

What they do:

  • Evaluate incoming signals
  • Execute trades when criteria are met
  • Manage positions

Key attributes:

  • Trading mode (simulation/live)
  • Trading configuration
  • Wallet assignments
  • Automated trading toggle

Learn more about Agents β†’


3. Positions

What: Active token holdings being monitored.

Lifecycle:

  1. Opened - Buy trade executed
  2. Monitored - Price tracked, stop loss evaluated
  3. Closed - Sold (manual, stop loss, or DCA exit)

Key attributes:

  • Purchase price and amount
  • Current value and P&L
  • Stop loss percentage
  • DCA history

Learn more about Positions β†’


4. Trading Modes

Simulation: Virtual trades with fake balances. No real money.

Live: Real trades on Solana blockchain. Uses actual SOL.

Learn more about Simulation vs Live β†’


5. Risk Management

Stop Loss: Automatically sells when price drops below threshold.

DCA (Dollar Cost Averaging): Automatically buys more when price drops.

Learn more about Risk Management β†’


The Trading Flow

Let's trace a complete trade from signal to close:

Step 1: Signal Arrives

{
  "tokenAddress": "DezXAZ8z...",
  "symbol": "BONK",
  "signalType": "Hypersurge",
  "signalStrength": 4,
  "source": "Nexgent AI",
  "activationReason": "Price broke above 5-period high, Bullish candle formation, Volume up 74.30% vs average, Price up 3.14% vs last bucket, Buy/sell ratio strongly bullish (157.73%)"
}

Step 2: Agent Evaluates

The agent checks:

CheckExample
Signal strengthIs 4 β‰₯ minScore (3)? βœ“
BalanceHas enough SOL? βœ“
BlacklistToken not blocked? βœ“
WhitelistToken allowed (if enabled)? βœ“
Existing positionNot already holding? βœ“

Step 3: Trade Executes

If all checks pass:

  1. Calculate position size based on balance and config
  2. Get quote from Jupiter Aggregator
  3. Execute swap (simulated or on-chain)
  4. Create position record

Step 4: Position Monitored

Continuously:

  1. Fetch current price from price feeds
  2. Calculate P&L against purchase price
  3. Evaluate stop loss - sell if triggered
  4. Evaluate DCA - buy more if triggered
  5. Broadcast updates via WebSocket

Step 5: Position Closes

Position closes when:

  • Stop loss triggers - Price drops below threshold
  • Manual close - User closes via dashboard
  • Stale trade - Configurable auto-close for idle positions

Data Flow Diagram


Key Concepts Summary

ConceptPurposeKey Point
SignalTrade triggerStrength 1-5, filtered by agent (score, type, blacklist)
AgentTrading entityHas config, wallet, positions
PositionActive holdingTracked until closed
SimulationPaper tradingRisk-free learning
LiveReal tradingActual SOL on Solana
Stop LossLimit lossesAuto-sell on drop
DCAAverage downAuto-buy on drop