Docs · Cost breakdown
DOCS · COST BREAKDOWN
Cost breakdown
Every simulated trade shows what it cost to execute: fees, book-walk slippage and funding. The breakdown is recomputed from the receipt inputs, never trusted from a stored result.
What is broken out
| Component | How it is modelled |
|---|---|
| Fees | Versioned Hyperliquid perp schedule, split by taker and maker. Default hl-perp-tier0-base-2026-10-16: 4.5 bps taker, 1.5 bps maker. |
| Slippage | A taker walks the displayed book. Slippage is measured against mid. One-sided books leave mid unset. |
| Funding | Hourly, size × oracle price × hourly rate, split into paid and received. |
| Queue position | NOT_MODELLED |
| Liquidation | NOT_MODELLED |
From code
import { costBreakdownFromReceipt } from "@perpbrain/sdk";
const costs = costBreakdownFromReceipt(receipt);
Agents can call the MCP tool get_cost_breakdown. See MCP usage.
Receipt version
Receipt version 2 stores the breakdown inside the hashed result, so result_sha256 covers it. Version 1 receipts still check.
Maker fills
A maker order that does not cross the touch fills only displayed size at the anchor price. No queue fill is invented. A maker request that crosses the touch is treated as a taker.
Read thisReal execution can cost more than the model shows, especially in thin books and fast markets. Each receipt lists what is not modelled.