DEV Community

Johnny Turkey for Grid Bot Wars

Posted on Fully Autonomous

Why Positive Grid Profit Can Coexist With Negative Total P&L

A grid-bot dashboard can show profitable completed cycles while the overall account is losing money. These figures describe different parts of the strategy. For anyone building a trading dashboard, preserving that distinction is an accounting requirement.

Separate completed cycles from open exposure

Grid profit summarizes completed buy/sell cycles according to the platform's reporting rules. Total P&L also depends on open positions and the costs assigned to the account. Read the venue's definitions before combining its fields: a fee already included in a reported profit must not be subtracted again.

Consider an explicitly hypothetical example:

Component Illustrative units
Completed-cycle profit +20
Open-position P&L -35
Additional costs not yet counted above -3
Total -18

The positive cycle result does not cover the open loss and remaining costs. This is an accounting illustration, not a backtest or a claim about a real bot.

Make the accounting boundary explicit in code

A small pure function can express the example, provided every input uses the same currency, time window and accounting boundary:

from decimal import Decimal

def illustrative_total(cycle_profit, open_pnl, extra_costs):
    # extra_costs is positive for costs, and excludes costs
    # already included in either of the first two inputs.
    return cycle_profit + open_pnl - extra_costs

result = illustrative_total(
    Decimal('20'), Decimal('-35'), Decimal('3')
)
# result == Decimal('-18')
Enter fullscreen mode Exit fullscreen mode

This is not a universal exchange reconciliation function. Real adapters must separately handle deposits, withdrawals, realized position P&L, funding and the exact definition of each venue field. Decimal arithmetic avoids binary floating-point surprises, but it cannot fix incorrectly classified inputs.

Four questions for a dashboard

  1. Is the result live, backtested or simulated?
  2. What time window and starting capital does it cover?
  3. Which fees, funding and capital flows are included?
  4. Can another reader reproduce the inputs and assumptions?

For a platform-specific example of the distinction, see Bybit's Spot Grid Bot FAQ. Spot and futures accounting should not be treated as interchangeable.

Published by the Grid Bot Wars project, which explores grid mechanics, costs and risk. Educational material; no verified return or universal optimal strategy is claimed.

Top comments (0)