Crypto Trade Post-Mortem from Exchange Fills (PnL, Exits)

    by Claude Workflow Lab

    1

    When a close alert says STOP LOSS you should be able to check it.

    $7

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    What it does

    • Identifies which specific trigger or manual order closed a position using exchange-side IDs
    • Calculates exact PnL by accounting for fills, fees, and currency conversions across different venues
    • Detects orphaned orders and leftover coins that your bot might have missed or left behind
    • Explains why orders failed to trigger by checking price ticks against exchange protection rules
    • Reveals when bot labels like STOP LOSS are just guesses and points to the real reason for a close

    Who it's for

    Crypto traders and fund managers

    Find out exactly why a trade closed or why a signal failed to fire on certain exchanges.

    Try asking: “Why was I stopped out of my BTC position on Gate.io this morning?”

    Trading bot developers and maintainers

    Debug discrepancies between your logs and actual exchange behavior to fix hidden bugs.

    Try asking: “Find out why the take-profit for this trade was placed but never executed.”

    Account managers and bookkeepers

    Verify PnL to six decimal places and find missing funds or orphaned orders.

    Try asking: “Prove the PnL for yesterday's ETH trades against my exchange fills.”

    Crypto Trade Post-Mortem from Exchange Fills (PnL, Exits)

    Example session with this skill installed

    Our alert says position XYZ closed by STOP LOSS with -2.1 percent. Check from the exchange fills whether that is true and whether the PnL is right.

    • Read your context and instructions
    • Compiled the crypto trade post-mortem

    Example on a fictional trade (symbol ARB_USDT, account acct-a on Gate). Following trade-postmortem the agent pulled the position's fills and the finished conditional orders, read-only. The closing fill carried the text tag of the take-profit order, not the stop: the alert label STOP LOSS was wrong. The monitor's attribution picks the nearest known level by price and falls back to STOP LOSS, so it never saw the id of the order that filled.

    Because that routine believed the stop had fired, it would also skip cancelling the other conditional: the agent found the stop order still open with no position behind it (an orphan) and reported it, with its id, for you to decide on cancelling. It did not cancel anything.

    PnL: fills_pnl.py recomputed from the entry and close fills plus fees: -0.118382 USDT against the reported -0.118391; the difference of 9e-6 came from rounding of the fee in the alert, so the reported PnL is right to the precision shown, and the sign and size match a take-profit hit on a short that was priced above entry. Not verified: funding payments outside the window pulled.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    When a close alert says STOP LOSS you should be able to check it. This skill gives an agent a read-only method to settle what really happened on a trade from the exchange's own records, not from your bot's label.

    What is inside:

    • SKILL.md - the method: pull the venue's fills and conditional-order history, identify the exit by the order's text tag or conditional id, check whether the close-reason label and reported PnL are true (and why a nearest-price attribution routine can guess wrong and leave an orphaned conditional behind), reconcile PnL against fills to 1e-6 including fees, and look for leftover coins or orders on the account.
    • references/entry-never-happened.md - a per-venue checklist for "why did this signal open nothing here": permissions, leverage and margin mode, symbol filters, minimum notional, and refusals that look like bugs.
    • scripts/fills_pnl.py - recomputes PnL from fills.
    • scripts/price_order_time.py - places a price on the order timeline to show what the market did around each order.
    • scripts/gate_close_attribution.sh - read-only Gate close attribution.

    For traders and developers who run their own bots across several exchanges. Needs Python 3 and read-only keys. It never places or cancels an order. Also part of the Crypto Trading Ops Playbooks pack at a lower per-skill price.

    This skill is read-only and cannot cancel orders or move funds. It requires read-only API access to your exchange accounts.

    Built for forensic analysis of Gate.io, OKX, Bitget, and Binance futures/spot trades. It uses shell scripts and Python for PnL reconciliation and Snowflake ID decoding. Requires read-only API keys in environment variables. Analyzes client-order-ids (e.g., Gate's 'text' field) to distinguish between service-sent orders and exchange-triggered conditionals. Compares fills against public tick data and mark/index candles to identify price-deviation protection triggers. Matches trade logs with venue fills to identify netting errors in one-way hold modes.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 1 day ago

    Accounts
    GateioBinance
    Software
    Python 3 (standard library only) and bashGit

    Access to your service logs and the position-closed message. Access to your service logs and the position-closed message.

    Permissions

    Terminal / Shell
    Network Access
    Read Files
    Environment Variables

    Allowed Hosts

    api.gateio.ws
    Listed1 day ago

    What's inside

    Frequently Asked Questions

    This skill compares your trading bot's logs against the exchange's actual records to find out why a trade really closed. It identifies if a stop-loss truly fired, why a take-profit order might have been ignored, and if your reported profits match what the exchange actually paid out.

    You need to provide your AI agent with read-only access to your exchange accounts, specifically for platforms like Binance, OKX, Bitget, or Gate.io. The skill also requires access to your bot's trade logs or database so it can compare the two sets of data.

    The skill produces a clear report showing which specific exit rule triggered the close and your exact profit or loss down to the cent. It also lists any orphaned or leftover orders that are still open on the exchange so you can decide whether to close them manually.

    It can explain why a signal might have opened a position on one exchange but not another, often caused by price limits or connection issues. It also checks for leftovers, such as small amounts of coins or orders that remained because the exchange force-converted your collateral.

    You can ask your agent to investigate a specific trade by giving it the pair name and the time it happened, or by sharing a trade alert that looks incorrect. For example, you could ask, "Check why this stop-loss fired on Binance but not on OKX," or "Verify the exact PnL for my last BTC trade."

    This skill is strictly read-only and will never place, change, or cancel orders for you. If it finds a leftover order that shouldn't be there, it will report it to you so you can handle the manual fix yourself.

    New in Trading & Investing

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Trading & Investing.