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  │                         │ Take Profit │
                    │  - Config   │                         │ DCA / Manual│
                    │  - 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 and take-profit evaluated
  3. Closed - Sold (manual, stop loss, take-profit, or stale trade)

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.

Take Profit: Automatically sells portions of the position as price rises (preset or custom levels, optional moon bag).

DCA (Dollar Cost Averaging): Automatically buys more when price drops. Can be enabled together with Take Profit.

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 take-profit - partial sell if gain levels hit (when enabled)
  5. Evaluate DCA - buy more if triggered (when enabled)
  6. Broadcast updates via WebSocket

Step 5: Position Closes

Position closes when:

  • Stop loss triggers - Price drops below threshold
  • Take-profit completes - All levels hit (and no moon bag, or moon bag + stop loss)
  • 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
Take ProfitLock in gainsPartial sell on rise (levels + optional moon bag)
DCAAverage downAuto-buy on drop (can run alongside Take Profit)