Trading Config Defaults
Every agent has a trading configuration that controls how it trades. This page documents the default values applied when an agent is created.
Overview
The trading configuration is stored as JSON in the database and cached in Redis. It includes settings for:
- Purchase Limits - Balance and position size constraints
- Signal Filtering - Score thresholds, signal types, and token lists
- Stop Loss - Automatic loss protection
- Position Sizing - Dynamic position sizes based on balance
- Stale Trade - Auto-close stuck positions
- DCA - Dollar cost averaging on dips
Default Configuration
// packages/shared/src/constants/trading-config-defaults.ts
export const DEFAULT_TRADING_CONFIG: AgentTradingConfig = {
purchaseLimits: {
minimumAgentBalance: 0.5,
maxPurchasePerToken: 2.0,
maxPriceImpact: 0.05, // 5% max slippage
},
signals: {
minScore: 1, // Accept all signals (1-5)
allowedSignalTypes: [], // Empty = accept all types
tokenFilterMode: 'none', // Accept all tokens
tokenList: [],
},
stopLoss: {
enabled: true,
defaultPercentage: -32,
mode: 'fixed',
trailingLevels: [],
},
positionCalculator: {
solBalanceThresholds: {
minimum: 0.2,
medium: 5,
large: 10,
},
positionSizes: {
small: { min: 0.1, max: 0.1 },
medium: { min: 0.5, max: 1.0 },
large: { min: 1.5, max: 2.0 },
},
randomization: { enabled: true },
},
staleTrade: {
enabled: true,
minHoldTimeMinutes: 60,
minProfitPercent: 1,
maxProfitPercent: 10,
},
dca: {
enabled: false,
mode: 'moderate',
levels: [],
maxDCACount: 3,
cooldownSeconds: 30,
},
};Purchase Limits
Controls when an agent can trade and position sizes.
| Setting | Default | Description |
|---|---|---|
minimumAgentBalance | 0.5 SOL | Minimum balance required to trade |
maxPurchasePerToken | 2.0 SOL | Maximum position size per token |
maxPriceImpact | 0.05 | Max acceptable slippage (5%) |
interface PurchaseLimits {
minimumAgentBalance: number; // Min SOL balance to trade
maxPurchasePerToken: number; // Max SOL per position
maxPriceImpact?: number; // Max slippage (0.05 = 5%)
}Signal Configuration
Filters which signals the agent will act on.
| Setting | Default | Description |
|---|---|---|
minScore | 1 | Minimum signal strength (1-5). Default accepts all. |
allowedSignalTypes | [] | Signal types to accept. Empty accepted all types. |
tokenFilterMode | 'none' | Token filtering: 'none', 'blacklist', or 'whitelist' |
tokenList | [] | Token addresses for blacklist/whitelist mode |
interface SignalConfig {
minScore: number; // 1-5 score threshold
allowedSignalTypes: string[]; // Empty = accept all types
tokenFilterMode: 'none' | 'blacklist' | 'whitelist';
tokenList: string[]; // Token addresses for filtering
}Token Filter Modes
| Mode | Behavior |
|---|---|
'none' | Accept signals for any token (default) |
'blacklist' | Accept all tokens except those in tokenList |
'whitelist' | Only accept tokens in tokenList |
Stop Loss Configuration
Automatic loss protection with trailing stop support.
| Setting | Default | Description |
|---|---|---|
enabled | true | Stop loss active |
defaultPercentage | -32 | Default stop loss (-32% from purchase) |
mode | 'fixed' | Stop loss calculation mode |
trailingLevels | [] | Custom trailing levels (for custom mode) |
Stop Loss Modes
| Mode | Description |
|---|---|
fixed | Linear 10% steps. At 50% gain, stop loss is 40% |
exponential | Loose at low gains, tighter as profit increases |
zones | 5-zone system with different keep percentages |
custom | User-defined trailing levels |
interface StopLossConfig {
enabled: boolean;
defaultPercentage: number; // Negative = loss from purchase
mode: 'fixed' | 'exponential' | 'zones' | 'custom';
trailingLevels: TrailingLevel[]; // Only for 'custom' mode
}
interface TrailingLevel {
change: number; // Price change % (e.g., 200 = 2x)
stopLoss: number; // Keep % of peak (e.g., 90 = keep 90%)
}Position Calculator
Dynamic position sizing based on agent balance.
Balance Thresholds
| Threshold | Default | Description |
|---|---|---|
minimum | 0.2 SOL | Below this, don't trade |
medium | 5 SOL | Threshold for medium sizes |
large | 10 SOL | Threshold for large sizes |
Position Sizes
| Category | Min | Max | Trigger |
|---|---|---|---|
| Small | 0.1 SOL | 0.1 SOL | Balance under 5 SOL |
| Medium | 0.5 SOL | 1.0 SOL | Balance 5–10 SOL |
| Large | 1.5 SOL | 2.0 SOL | Balance over 10 SOL |
interface PositionCalculator {
solBalanceThresholds: {
minimum: number;
medium: number;
large: number;
};
positionSizes: {
small: { min: number; max: number };
medium: { min: number; max: number };
large: { min: number; max: number };
};
randomization: {
enabled: boolean;
};
}Randomization
When randomization.enabled is true, position size is randomly chosen between min and max for the applicable tier.
Stale Trade Configuration
Auto-close positions that are stuck with modest gains.
| Setting | Default | Description |
|---|---|---|
enabled | true | Stale trade check active |
minHoldTimeMinutes | 60 | Minimum hold time (1 hour) |
minProfitPercent | 1 | Close if profit ≥ 1% |
maxProfitPercent | 10 | Close if profit ≤ 10% |
interface StaleTradeConfig {
enabled: boolean;
minHoldTimeMinutes: number;
minProfitPercent: number;
maxProfitPercent: number;
}How It Works
- Position is held for at least
minHoldTimeMinutes - Current P&L is between
minProfitPercentandmaxProfitPercent - Position is automatically closed to free capital
Set minProfitPercent to a negative value (e.g., -5) to also close losing positions.
DCA Configuration
Dollar cost averaging - buy more when price drops.
| Setting | Default | Description |
|---|---|---|
enabled | false | DCA disabled by default |
mode | 'moderate' | DCA template |
levels | [] | Custom levels (for custom mode) |
maxDCACount | 3 | Maximum DCAs per position |
cooldownSeconds | 30 | Min time between DCAs |
interface DCAConfig {
enabled: boolean;
mode: 'aggressive' | 'moderate' | 'conservative' | 'custom';
levels: DCALevel[];
maxDCACount: number;
cooldownSeconds: number;
}
interface DCALevel {
dropPercent: number; // Trigger at this % drop (e.g., -20)
buyPercent: number; // Buy this % more (e.g., 75)
}DCA Templates
Aggressive
Tighter levels, more frequent DCAs at -10% drops.
Moderate (Default)
Balanced approach with -20% drop triggers.
Conservative
Wider levels, fewer DCAs at -20% drops.
DCA levels are measured from the average purchase price, which updates after each DCA buy.
Type Definitions
Complete type definitions are in packages/shared/src/types/trading-config.ts.
export interface AgentTradingConfig {
purchaseLimits: PurchaseLimits;
signals: SignalConfig;
stopLoss: StopLossConfig;
positionCalculator: PositionCalculator;
staleTrade: StaleTradeConfig;
dca: DCAConfig;
}