Monitoring

Once a trading session is running, Botmarley provides a real-time monitoring dashboard on the session detail page. This chapter explains every element of that page and how to use it effectively.

Accessing the Session Detail Page

Click on any session in the Trading session list to open its detail page. The URL follows the pattern:

http://localhost:3000/trading/session/{session-id}

The page updates automatically -- you do not need to refresh.

Real-Time Data via SSE

Botmarley uses Server-Sent Events (SSE) to push live updates from the server to your browser. When you open a session detail page, your browser establishes a persistent connection to the SSE endpoint:

/sse/trading/{session-id}

Through this connection, the server sends updates whenever the engine processes a new candle, executes a trade, or changes status. The UI components on the page listen for these events and update themselves instantly via HTMX partial swaps.

This means:

  • No polling delays. You see changes within a second of them happening on the server.
  • No manual refresh needed. The page stays current as long as you have it open.
  • Low bandwidth. SSE sends only the data that changed, not the entire page.

Monitoring Elements

Current Price

The session displays the latest candle close price for the trading pair. This updates every poll cycle (default: every 60 seconds when a new candle arrives).

Balance and PnL

FieldDescription
Current BalanceTotal portfolio value in USD (cash + crypto holdings valued at current price).
PnL (USD)Absolute profit or loss: current balance minus initial capital.
PnL (%)PnL as a percentage of initial capital.

These values update after every candle is processed. During volatile markets, you will see them change with each tick.

Candles Processed

A counter showing how many candles the engine has evaluated since the session started. This gives you a sense of how long the session has been active and confirms that the engine is receiving data from the exchange.

Open Positions

Displays the number of currently open positions and their details:

  • Position number (e.g., #1, #2 for multi-position strategies)
  • Entry price -- the average price at which the position was opened
  • Current value -- the position's value at the current market price
  • Unrealized PnL -- how much the position would gain or lose if sold now

Trade Action History

A table of all executed trade actions for this session, ordered newest first. Each row shows:

ColumnDescription
TimeWhen the action occurred.
ActionType: open_long, buy, or sell.
PriceThe execution price.
AmountUSD and crypto amounts.
TriggerWhich trigger condition caused the action.
PnLRealized profit/loss (for sells).

New actions appear at the top of the table automatically via SSE.

Strategy Trigger Status

Shows the current state of each trigger in your strategy:

  • Whether the trigger condition is currently met or not.
  • For technical indicators: the current indicator value (e.g., RSI = 42.3).
  • For price-based triggers: how close the current price is to the trigger threshold.

This helps you understand what the strategy is "thinking" right now and anticipate when the next trade might fire.

Session Controls

At the top of the page, you will find buttons to control the session:

  • Pause -- temporarily stop evaluation (available when running).
  • Resume -- continue from pause (available when paused).
  • Stop -- permanently end the session.

See Trading Sessions for details on each action.

Live Candlestick Chart

The session detail page includes an interactive candlestick chart powered by Lightweight Charts. The chart displays:

  • Candlesticks showing OHLCV data for the session's trading pair.
  • Buy markers (green arrows) at the exact candles where buy actions executed.
  • Sell markers (red arrows) at sell action candles.
  • Indicator overlays if the strategy uses technical indicators (togglable).

The chart updates in real time as new candles arrive. You can:

  • Zoom in and out with the scroll wheel.
  • Pan by clicking and dragging.
  • Switch timeframes between 1m, 5m, 15m, and 1h for different levels of detail.

Tip

The 5-minute view is a good default for monitoring. It gives enough detail to see individual trades while keeping the chart readable over longer periods.

Tips for Monitoring During Volatile Markets

Volatile markets (high price swings, rapid moves) are when your strategy is most likely to trigger actions. Here are some practical tips:

  1. Keep the session page open. SSE updates ensure you see trades the moment they happen. If you close the page and come back later, you might miss critical context about why a trade fired.

  2. Watch the trigger status panel. During high volatility, indicators like RSI can swing rapidly between overbought and oversold zones. The trigger status panel shows you in real time how close the strategy is to firing.

  3. Check open positions. If your strategy opens positions during a volatile period, monitor unrealized PnL closely. A position that is +5% can swing to -5% quickly.

  4. Do not panic-stop. If the strategy is executing trades during a volatile period, that is what it is designed to do. Stopping the session mid-volatility may leave you with an unfavorable open position. If you are uncomfortable, pause the session instead -- this preserves state and lets you resume later.

  5. Review the action log after the event. Once volatility subsides, scroll through the action history to understand what the strategy did and why. This is valuable feedback for refining triggers.

Note

If you are running multiple sessions simultaneously, each one has its own SSE stream and monitoring page. You can open multiple browser tabs to monitor several sessions at once.

What Gets Persisted

Not everything you see on the monitoring page is stored permanently. Here is the breakdown:

DataStored in DB?Notes
Trade actionsYesFull action log with all details
Session state (balance, PnL, status)YesUpdated periodically
Session events (start, pause, resume, stop)YesTimestamped audit trail
Candle bufferNoIn-memory only; refetched on restart
Indicator cacheNoRebuilt from candle buffer each cycle
Progress store (current price, live PnL)NoIn-memory; reconstructed from DB on restart

This means if the server restarts, you will not lose any trade history or session state, but the live monitoring data (current price, indicator values) will take one poll cycle to repopulate. See Session Recovery for details.