{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/hitbtc/json-schema/hitbtc-trading-futures-account-cross-schema.json",
  "title": "Cross",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/hitbtc-futures-accounts-api-openapi.yml#/components/schemas/trading_FuturesAccountCross",
  "allOf": [
    {
      "$ref": "#/$defs/trading_AccountBase"
    },
    {
      "$ref": "#/$defs/trading_Leverage"
    },
    {
      "type": "object",
      "required": [
        "positions"
      ],
      "properties": {
        "positions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/trading_FuturesPosition"
          },
          "description": "Open positions of the margin account."
        },
        "currencies": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/trading_CrossAccountBalance"
          },
          "description": "Amount of funds on margin account.\n"
        }
      }
    }
  ],
  "$defs": {
    "trading_AccountBase": {
      "title": "Margin account",
      "type": "object",
      "required": [
        "symbol",
        "type",
        "created_at",
        "updated_at",
        "currencies",
        "margin_call",
        "margin_auto",
        "amr"
      ],
      "properties": {
        "symbol": {
          "type": "string",
          "description": "Trading symbol, where base currency is the currency of funds\nreserved on the exchange account for positions and quote currency is\nthe currency of funds reserved on a margin account.\n"
        },
        "type": {
          "$ref": "#/$defs/trading_MarginModeCommon"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "description": "Account creation date and time.\n"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "description": "Account last update date and time.\n"
        },
        "margin_call": {
          "type": "boolean",
          "description": "Flag indicating whether additional margin is required to maintain\nthe position.\n"
        },
        "margin_auto": {
          "type": "boolean",
          "description": "Flag indicating whether AMM (auto margin management) is enabled for\nthe margin account.\n"
        },
        "amr": {
          "type": "boolean",
          "description": "Current value of the AMR (auto margin replenishment) flag of the\nmargin account.\n"
        }
      }
    },
    "trading_CrossAccountBalance": {
      "title": "Cross account balance",
      "allOf": [
        {
          "$ref": "#/$defs/trading_IsolatedAccountBalance"
        },
        {
          "required": [
            "margin_call_margin",
            "liquidation_margin",
            "debt_sum"
          ]
        },
        {
          "properties": {
            "margin_call_margin": {
              "type": "string",
              "description": "The lower boundary to `margin_balance` minus debt.\n\nℹ️ If the margin is equal to this value, a margin call is sent.\n\nℹ️ This do not carry information that would be valuable for\npredicting the condition of a position, since those change after an\nadjusted price (mark price) changes.\n"
            },
            "liquidation_margin": {
              "type": "string",
              "description": "The lower boundary to `margin_balance` minus debt.\n\nℹ️ If the margin is equal to this value, it is liquidated.\n\nℹ️ This do not carry information that would be valuable for\npredicting the condition of a position, since those change after an\nadjusted price (mark price) changes.\n"
            },
            "debt_sum": {
              "type": "string",
              "description": "Account debt for interests (fundings), fees, and loss.\n"
            }
          }
        }
      ]
    },
    "trading_FuturesPosition": {
      "title": "Margin position",
      "allOf": [
        {
          "$ref": "#/$defs/trading_Leverage"
        },
        {
          "$ref": "#/$defs/trading_FuturesPositionBase"
        }
      ]
    },
    "trading_FuturesPositionBase": {
      "title": "Margin position",
      "allOf": [
        {
          "$ref": "#/$defs/trading_PositionBase"
        },
        {
          "properties": {
            "sum_fundings": {
              "type": "string",
              "description": "Sum of all settled funding to a position.\n"
            },
            "adl_ranking": {
              "type": "string",
              "description": "Rank of a position which defines how appropriate a position is\nto be used for closing bankrupt positions avoided liquidation.\n\nThe rank represents the probability of a position becoming\ndeleveraged: a high rank value signifies a high probability,\nand vice versa.\n\nValues: 0 – 4\n"
            }
          }
        }
      ]
    },
    "trading_IsolatedAccountBalance": {
      "title": "Margin account balance",
      "type": "object",
      "required": [
        "code",
        "margin_balance",
        "reserved_orders",
        "reserved_positions"
      ],
      "properties": {
        "code": {
          "type": "string",
          "description": "Currency code."
        },
        "margin_balance": {
          "type": "string",
          "description": "The total value of funds reserved for the position."
        },
        "reserved_orders": {
          "type": "string",
          "description": "The value reserved for active orders in the position."
        },
        "reserved_positions": {
          "type": "string",
          "description": "The minimum value reserved for position's executed quantity that cannot be reduced."
        }
      }
    },
    "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"
        }
      }
    }
  }
}