{
 "openapi": "3.1.0",
 "info": {
  "title": "Perpfield Trading Cost API",
  "version": "0.6",
  "x-generated-at": "2026-12-06T03:07:16Z",
  "description": "Read-only, keyless JSON API for the Perpfield crypto perpetual-futures trading-cost comparison. All numbers are the live all-in cost (taker fee + spread + slippage) to trade a given size, measured every ~5 minutes. Attribute republished data as 'Data: Perpfield' and keep the generated timestamp. CORS is open; no key or auth.",
  "license": {
   "name": "CC BY 4.0",
   "url": "https://creativecommons.org/licenses/by/4.0/"
  },
  "contact": {
   "email": "partners@perpfield.com",
   "url": "https://perpfield.com"
  }
 },
 "servers": [
  {
   "url": "https://perpfield.com"
  }
 ],
 "paths": {
  "/api/index.json": {
   "get": {
    "operationId": "get_cheapest_venue",
    "summary": "Full ranking of all venues by all-in cost, cheapest first.",
    "description": "Returns the whole ranking. The cheapest venue is the first element of `headline.ranked`. Each row carries the venue, type, all-in cost in USD and bps for $1k/$10k/$100k, fee and gap split, and rank.",
    "responses": {
     "200": {
      "description": "Ranking snapshot",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Ranking"
        }
       }
      }
     }
    }
   }
  },
  "/api/venues/{venue_id}.json": {
   "get": {
    "operationId": "get_venue_cost",
    "summary": "All-in cost and fee detail for one venue.",
    "parameters": [
     {
      "name": "venue_id",
      "in": "path",
      "required": true,
      "description": "Venue id.",
      "schema": {
       "type": "string",
       "enum": [
        "apex",
        "aster",
        "backpack",
        "binance",
        "bingx",
        "bitget",
        "bitrue",
        "bitunix",
        "blofin",
        "bybit",
        "coinbaseadv",
        "coinw",
        "cryptocom",
        "deribit",
        "dydx",
        "edgex",
        "extended",
        "gate",
        "gmx",
        "grvt",
        "gtrade",
        "htx",
        "hyperliquid",
        "krakenfutures",
        "kucoin",
        "lbank",
        "lighter",
        "mexc",
        "nado",
        "okx",
        "pacifica",
        "phemex",
        "primexbt",
        "toobit",
        "weex",
        "whitebit",
        "xt"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "One venue",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Venue"
        }
       }
      }
     },
     "404": {
      "description": "Unknown or not-ranked venue"
     }
    }
   }
  },
  "/api/markets.json": {
   "get": {
    "operationId": "list_markets",
    "summary": "Cheapest venue and all-in cost per market (coin).",
    "responses": {
     "200": {
      "description": "Per-market costs",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   }
  },
  "/api/openapi.json": {
   "get": {
    "operationId": "get_openapi",
    "summary": "This specification.",
    "responses": {
     "200": {
      "description": "OpenAPI document"
     }
    }
   }
  },
  "/api/mcp": {
   "get": {
    "operationId": "get_mcp_descriptor",
    "summary": "Read-only MCP tool descriptor.",
    "responses": {
     "200": {
      "description": "MCP descriptor"
     }
    }
   }
  },
  "/data/all-in-cost.csv": {
   "get": {
    "operationId": "get_csv",
    "summary": "The ranking as CSV.",
    "responses": {
     "200": {
      "description": "CSV",
      "content": {
       "text/csv": {}
      }
     }
    }
   }
  }
 },
 "components": {
  "schemas": {
   "Ranking": {
    "type": "object",
    "properties": {
     "generated_at_iso": {
      "type": "string",
      "format": "date-time"
     },
     "methodology_version": {
      "type": "string"
     },
     "headline": {
      "type": "object",
      "description": "The site ranking. `ranked` is cheapest-first.",
      "properties": {
       "ranked": {
        "type": "array",
        "items": {
         "$ref": "#/components/schemas/Venue"
        }
       }
      }
     }
    }
   },
   "Venue": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "enum": [
       "apex",
       "aster",
       "backpack",
       "binance",
       "bingx",
       "bitget",
       "bitrue",
       "bitunix",
       "blofin",
       "bybit",
       "coinbaseadv",
       "coinw",
       "cryptocom",
       "deribit",
       "dydx",
       "edgex",
       "extended",
       "gate",
       "gmx",
       "grvt",
       "gtrade",
       "htx",
       "hyperliquid",
       "krakenfutures",
       "kucoin",
       "lbank",
       "lighter",
       "mexc",
       "nado",
       "okx",
       "pacifica",
       "phemex",
       "primexbt",
       "toobit",
       "weex",
       "whitebit",
       "xt"
      ]
     },
     "name": {
      "type": "string"
     },
     "type": {
      "type": "string",
      "enum": [
       "cex",
       "dex"
      ]
     },
     "rank": {
      "type": "integer"
     },
     "usd_by_size": {
      "type": "object",
      "description": "All-in USD cost keyed 1k/10k/100k."
     },
     "allin_10k_bp": {
      "type": "number",
      "description": "All-in cost for a $10,000 trade, in basis points (1 bp = $1)."
     },
     "fees_usd": {
      "type": "number"
     },
     "gap_usd": {
      "type": "number",
      "description": "Spread + slippage, USD."
     }
    }
   }
  }
 },
 "x-venues": [
  {
   "id": "binance",
   "name": "Binance",
   "type": "exchange"
  },
  {
   "id": "bybit",
   "name": "Bybit",
   "type": "exchange"
  },
  {
   "id": "okx",
   "name": "OKX",
   "type": "exchange"
  },
  {
   "id": "bitget",
   "name": "Bitget",
   "type": "exchange"
  },
  {
   "id": "mexc",
   "name": "MEXC",
   "type": "exchange"
  },
  {
   "id": "kucoin",
   "name": "KuCoin",
   "type": "exchange"
  },
  {
   "id": "gate",
   "name": "Gate",
   "type": "exchange"
  },
  {
   "id": "bingx",
   "name": "BingX",
   "type": "exchange"
  },
  {
   "id": "krakenfutures",
   "name": "Kraken Futures",
   "type": "exchange"
  },
  {
   "id": "deribit",
   "name": "Deribit (owned by Coinbase)",
   "type": "exchange"
  },
  {
   "id": "hyperliquid",
   "name": "Hyperliquid",
   "type": "onchain app"
  },
  {
   "id": "dydx",
   "name": "dYdX",
   "type": "onchain app"
  },
  {
   "id": "gmx",
   "name": "GMX v2",
   "type": "onchain app"
  },
  {
   "id": "aster",
   "name": "Aster",
   "type": "onchain app"
  },
  {
   "id": "lighter",
   "name": "Lighter",
   "type": "onchain app"
  },
  {
   "id": "edgex",
   "name": "edgeX",
   "type": "onchain app"
  },
  {
   "id": "whitebit",
   "name": "WhiteBIT",
   "type": "exchange"
  },
  {
   "id": "htx",
   "name": "HTX",
   "type": "exchange"
  },
  {
   "id": "phemex",
   "name": "Phemex",
   "type": "exchange"
  },
  {
   "id": "xt",
   "name": "XT.com",
   "type": "exchange"
  },
  {
   "id": "weex",
   "name": "WEEX",
   "type": "exchange"
  },
  {
   "id": "bitunix",
   "name": "Bitunix",
   "type": "exchange"
  },
  {
   "id": "cryptocom",
   "name": "Crypto.com Exchange",
   "type": "exchange"
  },
  {
   "id": "toobit",
   "name": "Toobit",
   "type": "exchange"
  },
  {
   "id": "lbank",
   "name": "LBank",
   "type": "exchange"
  },
  {
   "id": "blofin",
   "name": "BloFin",
   "type": "exchange"
  },
  {
   "id": "backpack",
   "name": "Backpack Exchange",
   "type": "exchange"
  },
  {
   "id": "extended",
   "name": "Extended",
   "type": "onchain app"
  },
  {
   "id": "grvt",
   "name": "GRVT",
   "type": "onchain app"
  },
  {
   "id": "pacifica",
   "name": "Pacifica",
   "type": "onchain app"
  },
  {
   "id": "apex",
   "name": "ApeX Omni",
   "type": "onchain app"
  },
  {
   "id": "nado",
   "name": "Nado",
   "type": "onchain app"
  },
  {
   "id": "gtrade",
   "name": "gTrade (Gains)",
   "type": "onchain app"
  },
  {
   "id": "coinw",
   "name": "CoinW",
   "type": "exchange"
  },
  {
   "id": "bitrue",
   "name": "Bitrue Futures",
   "type": "exchange"
  },
  {
   "id": "primexbt",
   "name": "PrimeXBT",
   "type": "exchange"
  },
  {
   "id": "coinbaseadv",
   "name": "Coinbase Advanced",
   "type": "exchange"
  }
 ],
 "x-current": {
  "id": "lighter",
  "name": "Lighter",
  "all_in_usd_10k": 6.53,
  "all_in_bps_10k": 6.5
 }
}