{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/bigone/main/json-schema/bigone-trade-schema.json",
  "title": "Trade",
  "description": "A contract trade execution record with details about the trade, fees, and PnL.",
  "x-generated": "2026-10-13",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/bigone-contract-openapi.yml#/components/schemas/Trade",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "The unique trade identifier."
    },
    "orderId": {
      "type": "string",
      "format": "uuid",
      "description": "The order ID that was filled by this trade."
    },
    "ts": {
      "type": "integer",
      "format": "int64",
      "description": "The trade timestamp (Unix microseconds)."
    },
    "side": {
      "type": "string",
      "enum": [
        "BUY",
        "SELL"
      ],
      "description": "The trade side. BUY = long position filled, SELL = short position filled."
    },
    "symbol": {
      "type": "string",
      "description": "The contract symbol."
    },
    "currency": {
      "type": "string",
      "description": "The currency used for settlement of fees and PnL."
    },
    "size": {
      "type": "number",
      "description": "The number of contracts filled in this trade."
    },
    "notional": {
      "type": "number",
      "description": "The trade notional value in the quote currency."
    },
    "price": {
      "type": "number",
      "description": "The execution price of the trade."
    },
    "feeRate": {
      "type": "number",
      "description": "The fee rate applied to this trade."
    },
    "pnl": {
      "type": "number",
      "description": "The realized PnL from this trade (0 for taker trades)."
    },
    "fee": {
      "type": "number",
      "description": "The trading fee charged for this trade."
    },
    "order": {
      "type": "object",
      "description": "The associated order that was filled.",
      "properties": {
        "id": {
          "type": "string",
          "description": "The order ID."
        },
        "type": {
          "type": "string",
          "enum": [
            "LIMIT",
            "MARKET",
            "IOC",
            "FOK",
            "POST_ONLY",
            "ADL"
          ],
          "description": "The order type."
        },
        "size": {
          "type": "number",
          "description": "The order size."
        },
        "price": {
          "type": "number",
          "description": "The order price."
        }
      }
    }
  }
}