PnL Tracking

🟢 Beginner · 2026-04-16

PnL Tracking

Profit and Loss (PnL) tracking tells you whether your grid bot is actually making money. Gridera tracks PnL at multiple levels: per trade, per session, and across your entire portfolio.

Realized vs Unrealized PnL

Realized PnL — Profit locked in through completed trades. When the bot buys at $85 and the TP sells at $86, the $1 difference (minus fees) is realized profit. This is permanent.

Unrealized PnL — Paper profit/loss on open positions. If you bought at $85 and the current price is $87, your unrealized PnL is +$2. This can change as the price moves.

Total PnL = Realized + Unrealized

Portfolio vs Bot View

Gridera shows PnL in two places:

Portfolio (Dashboard)

Shows your all-time cumulative results across all bots:

  • Realized = Sum of all historical session snapshots from DB
  • Unrealized = Live data from currently running bots only
  • Trades = Total wins + losses across all sessions

When no bot is running, unrealized shows $0 — because there are no open positions.

Bot Detail Page

Shows current session data for one specific bot:

  • Real-time unrealized PnL
  • Session realized PnL
  • ROI percentage

ROI Calculation

ROI is calculated as:

ROI = (Realized + Unrealized) / Initial Balance × 100%

This includes both locked-in profit and current paper profit. Example:

  • Investment: $120
  • Realized: $5 (from completed TP fills)
  • Unrealized: $15 (open positions in profit)
  • ROI = ($5 + $15) / $120 × 100 = 16.67%

Session Persistence

PnL data persists across bot restarts:

  • Redis state (7-day TTL) stores realized PnL, win/loss counts, fees
  • Trade cursor backup (28-day TTL) prevents duplicate fill processing
  • On restart, bot loads previous session PnL from Redis

When a bot stops, a PnL snapshot is saved to the database. This becomes part of your Portfolio’s historical data.

PnL Snapshot

Every time a bot session ends (manual stop, grid break, TP/SL hit):

  1. Current PnL state is read from Redis
  2. Snapshot saved to DB (realized, unrealized, fees, trades, ROI)
  3. Portfolio uses these snapshots for cumulative calculations

Fees

Trading fees are tracked separately:

  • Total Fees = Sum of all exchange fees paid
  • Net PnL = Total PnL - |Fees|
  • High fees can significantly impact grid profitability — especially with narrow grids

Tips

  • Realized PnL is what matters — unrealized can disappear
  • Check ROI regularly — it includes both realized and unrealized
  • Portfolio shows your true all-time performance
  • When bot is stopped, unrealized resets to $0 (positions are closed)
  • Fees matter — wider grids and higher order sizes reduce fee impact

✨ Was this article helpful?

Ask your questions on Discord →