{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/hitbtc/json-schema/hitbtc-trading-position-schema.json",
  "title": "Margin position",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/hitbtc-margin-positions-api-openapi.yml#/components/schemas/trading_Position",
  "allOf": [
    {
      "$ref": "#/$defs/trading_PositionBase"
    },
    {
      "$ref": "#/$defs/trading_Leverage"
    }
  ],
  "$defs": {
    "trading_Leverage": {
      "title": "Leverage",
      "type": "object",
      "required": [
        "leverage"
      ],
      "properties": {
        "leverage": {
          "type": "string",
          "description": "Leverage—the ratio of the user own funds to funds borrowed from the\nplatform.\n"
        }
      }
    },
    "trading_MarginModeCommon": {
      "title": "Margin mode",
      "type": "string",
      "enum": [
        "cross",
        "Cross",
        "isolated",
        "Isolated"
      ],
      "description": "Margin mode."
    },
    "trading_PositionBase": {
      "title": "Margin position",
      "type": "object",
      "required": [
        "id",
        "symbol",
        "margin_mode",
        "quantity",
        "price_entry",
        "price_margin_call",
        "price_liquidation",
        "pnl",
        "created_at",
        "updated_at",
        "status",
        "required_margin",
        "orders_margin",
        "margin_auto",
        "amr"
      ],
      "properties": {
        "id": {
          "type": "integer",
          "format": "uint64",
          "description": "Position identifier."
        },
        "symbol": {
          "type": "string",
          "description": "Symbol code."
        },
        "margin_mode": {
          "$ref": "#/$defs/trading_MarginModeCommon"
        },
        "quantity": {
          "type": "string",
          "description": "Position quantity."
        },
        "price_entry": {
          "type": "string",
          "description": "Average weighted price of position open orders."
        },
        "price_margin_call": {
          "type": "string",
          "description": "Margin call price."
        },
        "price_liquidation": {
          "type": "string",
          "description": "Liquidation price."
        },
        "pnl": {
          "type": "string",
          "description": "Unrealized profit and loss."
        },
        "fee_cumulative": {
          "type": "string",
          "description": "Total amount of fees paid throughout the position lifetime until it\n is closed.\n\nFormat: Decimal\n\nValues: `0` if a new position created\n\n⚠️ This value does zero out after the position closes  and does not\n when it flips.\n"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "description": "Position creation date and time."
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "description": "Position last update date and time."
        },
        "status": {
          "type": "string",
          "enum": [
            "normal",
            "blocked",
            "closeOnly"
          ],
          "description": "Position status.\n\nValues:\n* `normal`—the client can place and cancel orders, amend and change\n  the margin;\n* `blocked`—the client cannot place orders on either side;\n* `closeOnly`—the client may only place orders to close the\n  position.\n"
        },
        "required_margin": {
          "type": "string",
          "description": "Amount of currency reserved for close orders.\n"
        },
        "orders_margin": {
          "type": "string",
          "description": "Amount of currency reserved for open orders.\n"
        },
        "margin_call": {
          "type": "boolean",
          "description": "Flag indicating whether additional margin is required to maintain the position.\n"
        },
        "margin_auto": {
          "type": "boolean",
          "description": "Flag indicating whether AMM (auto margin management) is enabled for\n the position.\n"
        },
        "amr": {
          "type": "boolean",
          "description": "Current value of the AMR (auto margin replenishment) flag of the\n position.\n"
        }
      }
    }
  }
}