Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/alphaleaks60-maker/docs2/llms.txt

Use this file to discover all available pages before exploring further.

The live trader writes its complete state to PostgreSQL on every position open and close, logs structured output for every decision it makes, and surfaces pipeline health through the /api/stats endpoint. This page covers what to watch, where to find it, and what the values mean.
If the live trader process has halted due to a circuit breaker, it will stop logging decisions but will not exit. Check both the process logs and the live_portfolio table to confirm whether the trader is actively making decisions.

PostgreSQL tables

live_portfolio

The live_portfolio table is the single source of truth for overall performance. It tracks the running portfolio state across all trades:
FieldDescription
current_balanceAvailable SOL balance (not including deployed capital in open positions)
total_pnlCumulative net profit and loss across all closed trades, in SOL
total_tradesTotal number of closed positions
total_winsNumber of closed positions with positive net P&L
total_lossesNumber of closed positions with negative net P&L
current_streakPositive integer for win streak, negative for loss streak
is_activeWhether this is the currently running portfolio instance
SELECT
  current_balance,
  total_pnl,
  total_trades,
  total_wins,
  total_losses,
  current_streak,
  ROUND(total_wins::numeric / NULLIF(total_trades, 0) * 100, 1) AS win_rate_pct
FROM live_portfolio
WHERE is_active = TRUE;

live_trades

The live_trades table records one row per trade, updated on entry and again on exit:
FieldDescription
token_mintThe Pump.fun token mint address
strategyThe strategy name that opened the position (e.g. reach_2x_1h)
entry_priceSOL price per token at time of buy
exit_priceSOL price per token at time of sell (null if position still open)
position_size_solAmount of SOL deployed
exit_reasonOne of: take_profit, trailing_stop, stop_loss, timeout, anti_signal
net_pnlNet profit or loss in SOL after Jito tip costs
entry_timeTimestamp of the buy transaction
exit_timeTimestamp of the sell transaction (null if still open)
statusopen or closed
-- Recent closed trades with exit reason breakdown
SELECT
  strategy,
  exit_reason,
  COUNT(*) AS count,
  ROUND(AVG(net_pnl)::numeric, 4) AS avg_pnl,
  ROUND(SUM(net_pnl)::numeric, 4) AS total_pnl
FROM live_trades
WHERE status = 'closed'
  AND entry_time > NOW() - INTERVAL '24 hours'
GROUP BY strategy, exit_reason
ORDER BY strategy, exit_reason;
-- Currently open positions
SELECT token_mint, strategy, entry_price, position_size_sol, entry_time,
       EXTRACT(EPOCH FROM (NOW() - entry_time)) / 60 AS hold_minutes
FROM live_trades
WHERE status = 'open'
ORDER BY entry_time;

Pipeline stats

The /api/stats endpoint returns a snapshot of the full pipeline state. Poll this endpoint to verify that the upstream data pipeline is healthy before attributing poor signal quality to the live trader.
const stats = await fetch('/api/stats').then(r => r.json());
{
  "ws": {
    "connected": true,
    "eventsPerSec": 42,
    "totalEvents": 4320000,
    "currentSlot": 312450000
  },
  "signals": {
    "total": 84200,
    "last24h": 1240
  },
  "wallets": {
    "tracked": 2840,
    "scored": 1920,
    "bots": 340
  },
  "regime": {
    "state": "bull_normal",
    "confidence": 0.6
  },
  "models": {
    "loaded": 4,
    "scored": 81200,
    "fallbacks": 42
  },
  "uptime": 86400,
  "memMb": 312
}
FieldHealthyWarning
ws.connectedtruefalse — pipeline not receiving on-chain data
ws.eventsPerSec20–200+ (market dependent)Near 0 — possible WebSocket disconnect
models.fallbacks0Rising — ML inference degraded, signals using rule-based scoring
wallets.scoredGrowing over timeStagnant — feature computation may have stalled
regime.stateAny valid statebear — signal quality is typically lower across the board

Live feed as a health signal

The SSE stream itself is a health indicator. A healthy pipeline emits a heartbeat event every 15 seconds. If the heartbeat stops while the connection stays open, the upstream pipeline has stalled at the WebSocket level.
let lastHeartbeat = Date.now();

es.addEventListener('heartbeat', () => {
  lastHeartbeat = Date.now();
});

// Check for stalled feed every 5 seconds
setInterval(() => {
  if (Date.now() - lastHeartbeat > 30_000) {
    console.warn('Feed appears stalled — no heartbeat in 30s');
  }
}, 5000);

Anti-signal rate

Anti-signals appear on the feed as data.type === 'anti_signal'. A healthy market produces a low but non-zero rate of anti-signals. A sudden spike across multiple tokens simultaneously usually indicates a coordinated campaign or a broader shift toward lower-quality tokens. Anti-signal payloads include a severity field (count of triggers that fired, minimum 2) and a reasons array:
{
  "type": "anti_signal",
  "data": {
    "tokenMint": "...",
    "severity": 3,
    "reasons": [
      "Creator risk score 92/100 (87% rug rate across 34 tokens)",
      "71% of buyers are bots",
      "Coordinated bundle detected (89% confidence, 52% of buyers)"
    ]
  }
}

Checking system health

A healthy live trader will show all of the following:
1

Process is running and logging

The process should emit a log line for every signal received, including the score and the strategy selection decision (or the reason a trade was skipped).
2

Pipeline is connected

ws.connected in /api/stats is true and ws.eventsPerSec is non-zero.
3

Models are loaded

models.loaded is 4 (or the number of ONNX model files present on disk). models.fallbacks is 0 or very low.
4

live_portfolio shows recent activity

The total_trades count in live_portfolio should increment as positions close. If it has been static for many hours during market hours, a circuit breaker may be active.
5

No circuit breaker warnings in logs

Search the process logs for circuit breaker or halted to confirm no hard stop is in effect.

Key log patterns

The WebSocket subscriber maintains a backlog counter. If pending events exceed 10, a warning is emitted:
[WsSubscriber] WARNING: event backlog at 14 — consider scaling processing
A sustained backlog means the pipeline is processing events slower than they arrive. Signals emitted during a backlog period may be delayed, which can affect entry timing.

Performance reporting

For a quick performance summary across a time window:
SELECT
  DATE_TRUNC('day', entry_time) AS day,
  COUNT(*) AS trades,
  SUM(CASE WHEN net_pnl > 0 THEN 1 ELSE 0 END) AS wins,
  ROUND(SUM(CASE WHEN net_pnl > 0 THEN 1 ELSE 0 END)::numeric / COUNT(*) * 100, 1) AS win_rate_pct,
  ROUND(SUM(net_pnl)::numeric, 4) AS total_pnl,
  ROUND(AVG(net_pnl)::numeric, 4) AS avg_pnl,
  STRING_AGG(DISTINCT exit_reason, ', ' ORDER BY exit_reason) AS exit_reasons
FROM live_trades
WHERE status = 'closed'
GROUP BY DATE_TRUNC('day', entry_time)
ORDER BY day DESC;

Market regime context

The current market regime affects signal quality across all strategies. The regime is reclassified every 10 minutes and available in /api/stats under regime.state:
StateMeaning for the live trader
bull_euphoriaHigh graduation rates and strong volume. ML probability outputs tend to be higher across the board.
bull_normalStandard positive conditions.
transitionMarket dynamics shifting. Elevated uncertainty — model confidence may be less reliable.
bearLow graduation rates, thin volume. Signal quality tends to be lower; more trades may exit via stop loss.
The regime is included as a feature in the ML models, so the model’s calibrated probability outputs already account for current conditions. The regime state is most useful as context for interpreting a run of losses — if the regime has shifted to bear or transition, the cause may be macromarket, not a problem with the trader.

Circuit breakers

Trigger conditions, reset behaviour, and SQL queries for diagnosing halts.

Market regime

How the 4-state regime classifier works and how it affects signal quality.

ML models

ONNX model architecture, calibration, and hot-reload behaviour.

API overview

Full reference for the /api/stats endpoint and live feed.

Build docs developers (and LLMs) love