← Back to home

How to Reconcile Your Bot's P&L Against the Exchange Dashboard

Your bot reports a $2,400 profit. The exchange dashboard shows $1,850. You've just spent three hours cross-checking trades one by one. This happens to every serious bot trader—and it's not always the bot lying to you or the dashboard being wrong. Both can be correct and still show different numbers. The difference lives in what each system counts, when it counts it, and what it ignores.

This guide walks you through a concrete, row-by-row method to find every dollar of that gap and understand exactly where it came from. You'll pull raw API data, match it against your bot's internal journal, and identify the real sources of discrepancy so you can trust your P&L again.

Why Exchange Dashboards and Bot P&L Diverge

The exchange dashboard and your bot are watching the same account—but they're answering different questions. Your bot tracks positions and realized P&L as it executes. The exchange tracks settled fills, realized P&L, and unrealized positions at the moment you check the dashboard. Here's where the gaps live:

The Reconciliation Method: Step-by-Step

Use this method to extract the ground truth from the exchange API and match it against your bot's journal line-by-line. You'll identify every source of discrepancy and prove where the gap lives.

Step 1: Extract Your Bot's Internal P&L Report

Dump your bot's complete trade journal and any internal P&L calculation it maintains. This should include:

Export this to CSV with precise numeric values—no rounding, no currency conversion shortcuts. Include the bot's internal timestamp for every trade.

Step 2: Pull Raw Fill Data from the Exchange API

Call the exchange's fills or order history endpoint. For Hyperliquid:

Download the complete fill history for your reporting period. Store this in CSV format with columns: timestamp_ms, symbol, side, price_usd, size, fee_usd, fee_token, order_id. Ensure you have the exact numeric values without rounding. If the exchange API returns fee in a native token, convert it to USD at the spot price at the moment of fill, or keep both columns and reconcile separately.

Step 3: Pull Funding Payments and Other Collateral Movements

Funding payments are separate from trades. Call the funding history endpoint (if available) or check the account statement in the dashboard. For Hyperliquid, check:

Export this as a separate CSV: timestamp_ms, event_type (funding/deposit/withdrawal/etc), symbol, amount_usd. This will be your second reconciliation pass.

Step 4: Aggregate Exchange Data by Position Lifecycle

Group fills by position: entry fills, all subsequent fills on that position, and exit fills. For each position:

This is your exchange's ground truth. Every dollar that moved is here, timestamped and fee-accounted.

Step 5: Match Bot Positions Against Exchange Positions

For each closed position your bot reported, find the corresponding set of fills in the exchange data. Match on:

When you find a match, compare:

Create a reconciliation table: Bot Position ID | Symbol | Bot Entry Price | Exchange Entry Price | Match? | Bot Fees | Exchange Fees | Fee Difference | Bot P&L | Exchange P&L | P&L Difference.

Step 6: Isolate the Gaps

Sum all differences in the reconciliation table. You should now have clear categories:

Common Causes of Mismatches: A Checklist

When you find gaps, work through this list:

Conclusion

Bot P&L reconciliation is grunt work, but it's worth the precision. By pulling API data and matching row-by-row, you move from suspicion ("something's wrong") to certainty ("fees are 0.015% higher than assumed"). That certainty lets you adjust your bot's assumptions, recalibrate your profit targets, and trust the next month's numbers.

The discrepancy between your bot and the exchange dashboard is never a mystery if you have the API data. Every trade, every fee, every funding payment is timestamped and signed. Your job is to match them correctly and account for the real sources of divergence. Do that, and you own your numbers.

Affiliate disclosure: Some links on this site may be affiliate links. If you sign up through them we may earn a commission at no extra cost to you. We only recommend tools and services we've actually evaluated.