- Home
- Skills
- Trading & Investing
- Crypto Trade Post-Mortem from Exchange Fills (PnL, Exits)
Crypto Trade Post-Mortem from Exchange Fills (PnL, Exits)
When a close alert says STOP LOSS you should be able to check it.
$7
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
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
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 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
Gateio
Binance
- Software
- Python 3 (standard library only) and bash
Git
Access to your service logs and the position-closed message. Access to your service logs and the position-closed message.
Permissions
Allowed Hosts
What's inside
Frequently Asked Questions
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.