Catalog/cryptocalc-leverage-pnl

Calculators

Leveraged PnL & ROE calculator API

Compute leveraged trade PnL and return-on-equity: long PnL = size·(exit−entry) (short inverts), margin = notional/leverage, ROE = PnL/margin. Deterministic trading math. Answers 'what's my PnL at 10x','return on margin','profit from this leveraged trade'.

Price$0.01per request
MethodPOST
Route/v1/calc/cryptocalc-leverage-pnl
StatusLive
MIME typeapplication/json
Rate limit120/minute
CacheNo cache
calccryptotradingpnlroeleverageperpsmargin
API URLhttps://x402.hexl.dev/v1/calc/cryptocalc-leverage-pnl
Integration docs
Example request
{
  "entryPrice": 2000,
  "exitPrice": 2200,
  "size": 5,
  "leverage": 10,
  "side": "long"
}
Example response
{
  "formula": "PnL = size·(exit−entry); ROE = PnL/margin",
  "side": "long",
  "notional": 10000,
  "margin": 1000,
  "pnl": 1000,
  "roePct": 100,
  "priceMovePct": 10,
  "interpretation": "profit"
}
Input schema
{
  "type": "object",
  "required": [
    "entryPrice",
    "exitPrice",
    "size"
  ],
  "properties": {
    "entryPrice": {
      "type": "number",
      "examples": [
        2000
      ]
    },
    "exitPrice": {
      "type": "number",
      "examples": [
        2200
      ]
    },
    "size": {
      "type": "number",
      "description": "size in base-asset units",
      "examples": [
        5
      ]
    },
    "leverage": {
      "type": "number",
      "examples": [
        10
      ]
    },
    "side": {
      "type": "string",
      "enum": [
        "long",
        "short"
      ],
      "examples": [
        "long"
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}