{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/hitbtc/json-schema/hitbtc-trading-new-futures-order-schema.json",
  "title": "trading_NewFuturesOrder",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/hitbtc-futures-orders-api-openapi.yml#/components/schemas/trading_NewFuturesOrder",
  "allOf": [
    {
      "type": "object"
    },
    {
      "title": "Futures order",
      "oneOf": [
        {
          "$ref": "#/$defs/trading_NewFuturesLimitOrder"
        },
        {
          "$ref": "#/$defs/trading_NewFuturesMarketOrder"
        },
        {
          "$ref": "#/$defs/trading_NewFuturesStopLimitOrder"
        },
        {
          "$ref": "#/$defs/trading_NewFuturesStopMarketOrder"
        },
        {
          "$ref": "#/$defs/trading_NewFuturesStopLimitOrder"
        },
        {
          "$ref": "#/$defs/trading_NewFuturesStopMarketOrder"
        }
      ]
    }
  ],
  "$defs": {
    "trading_ClosePosition": {
      "title": "Close position",
      "type": "object",
      "properties": {
        "close_position": {
          "type": "boolean",
          "description": "Flag indicating a stop market order must close a margin position\n when executed or be canceled otherwise.\n"
        }
      }
    },
    "trading_Contract": {
      "title": "Contract"
    },
    "trading_HiddenOrderFields": {
      "title": "Hidden order",
      "type": "object",
      "properties": {
        "display_quantity": {
          "type": "string",
          "enum": [
            "0"
          ],
          "description": "The visible part of the hidden order quantity.\n\nConditions: `time_in_force` is `GTC`, `Day`, `GTD`\n"
        }
      }
    },
    "trading_MarginAuto": {
      "title": "Auto margin management",
      "type": "object",
      "properties": {
        "margin_auto": {
          "type": "boolean",
          "description": "Flag indicating whether AMM (auto margin management) is enabled for\n the margin account or position the order belongs to.\n\nConditions: returned for margin orders only\n"
        }
      }
    },
    "trading_MarginMode": {
      "title": "Margin mode",
      "type": "object",
      "required": [
        "margin_mode"
      ],
      "properties": {
        "margin_mode": {
          "default": "isolated",
          "$ref": "#/$defs/trading_MarginModeCommon"
        }
      }
    },
    "trading_MarginModeCommon": {
      "title": "Margin mode",
      "type": "string",
      "enum": [
        "cross",
        "Cross",
        "isolated",
        "Isolated"
      ],
      "description": "Margin mode."
    },
    "trading_MarginOrderTrades": {
      "title": "Margin order trades",
      "type": "object",
      "properties": {
        "trades": {
          "type": "array",
          "items": {
            "allOf": [
              {
                "$ref": "#/$defs/trading_OrderTradesBase"
              },
              {
                "$ref": "#/$defs/trading_PositionId"
              }
            ]
          }
        }
      }
    },
    "trading_NewFuturesLimitOrder": {
      "title": "Limit order",
      "allOf": [
        {
          "$ref": "#/$defs/trading_NewFuturesMarketOrder"
        },
        {
          "$ref": "#/$defs/trading_Price"
        }
      ]
    },
    "trading_NewFuturesMarketOrder": {
      "title": "Market order",
      "allOf": [
        {
          "$ref": "#/$defs/trading_OrderBase"
        },
        {
          "$ref": "#/$defs/trading_MarginOrderTrades"
        },
        {
          "$ref": "#/$defs/trading_ReduceOnly"
        },
        {
          "$ref": "#/$defs/trading_Contract"
        },
        {
          "$ref": "#/$defs/trading_MarginMode"
        },
        {
          "$ref": "#/$defs/trading_MarginAuto"
        }
      ]
    },
    "trading_NewFuturesStopLimitOrder": {
      "title": "Stop limit order",
      "allOf": [
        {
          "$ref": "#/$defs/trading_NewFuturesLimitOrder"
        },
        {
          "$ref": "#/$defs/trading_StopPrice"
        },
        {
          "$ref": "#/$defs/trading_HiddenOrderFields"
        },
        {
          "required": [
            "stop_price"
          ]
        }
      ]
    },
    "trading_NewFuturesStopMarketOrder": {
      "title": "Stop market order",
      "allOf": [
        {
          "$ref": "#/$defs/trading_NewFuturesMarketOrder"
        },
        {
          "$ref": "#/$defs/trading_StopPrice"
        },
        {
          "$ref": "#/$defs/trading_ClosePosition"
        },
        {
          "required": [
            "stop_price"
          ]
        }
      ]
    },
    "trading_OrderBase": {
      "title": "Order",
      "allOf": [
        {
          "$ref": "#/$defs/trading_OrderCommon"
        },
        {
          "type": "object",
          "required": [
            "post_only"
          ],
          "properties": {
            "post_only": {
              "type": "boolean",
              "description": "A post-only order is an order that does not remove liquidity.\n\n⚠️ If the post-only order would cause a match with a\npre-existing order as a taker, then the order will be canceled.\n"
            }
          }
        }
      ]
    },
    "trading_OrderCommon": {
      "title": "Order",
      "type": "object",
      "required": [
        "id",
        "client_order_id",
        "symbol",
        "quantity",
        "quantity_cumulative",
        "time_in_force",
        "side",
        "status",
        "type",
        "created_at",
        "updated_at"
      ],
      "properties": {
        "id": {
          "type": "integer",
          "format": "uint64",
          "description": "Unique order identifier as assigned by the exchange."
        },
        "client_order_id": {
          "type": "string",
          "description": "Client-provided or system-generated identifier of an order."
        },
        "symbol": {
          "type": "string",
          "description": "Symbol code."
        },
        "side": {
          "type": "string",
          "enum": [
            "sell",
            "buy"
          ],
          "description": "Order side."
        },
        "status": {
          "type": "string",
          "enum": [
            "new",
            "suspended",
            "partiallyFilled",
            "filled",
            "canceled",
            "expired",
            "rejected"
          ],
          "description": "Order status.\n\nValues:\n* `new`—an order is placed in the order book;\n* `suspended`—a `stopLimit`, `stopMarket`, `takeProfitLimit` or `takeProfitMarket` order is parked until it meets the conditions for placement in the order book;\n* `partiallyFilled`—an order is executed, but a part of its quantity is not filled yet;\n* `filled`—order quantity filled completely;\n* `canceled`—an order is canceled. It can either be done by a user through a cancel/replace request or by the system under specific circumstances;\n* `expired`—an order is deactivated after it no longer satisfies Time in Force (IOC, FOK) or Post Only requirements;\n* `rejected`—an order has been rejected.\n"
        },
        "type": {
          "type": "string",
          "enum": [
            "limit",
            "market",
            "stopLimit",
            "stopMarket",
            "takeProfitLimit",
            "takeProfitMarket"
          ],
          "description": "Order type.\n\nValues:\n* `limit`—an order that will be executed at or better than the specified price. The remainder, if any, is added to the order book or expired by terms of its Time-In-Force instruction;\n* `market`—an order that will be executed at the \"best\" available market price. If the order depletes its price level, then leaves quantity is placed to the order book at this limit price;\n* `stopLimit`—a limit order that remains inactive until the market crosses a specified stop price (for sell orders—falls below, for buy orders—rises above);\n* `stopMarket`—a market order that remains inactive until the market crosses a specified stop price (for sell orders—falls below, for buy orders—rises above);\n* `takeProfitLimit`—a limit order that remains inactive until the market crosses a specified stop price (for sell orders—rises above, for buy orders—falls below);\n* `takeProfitMarket`—a market order that remains inactive until the market crosses a specified stop price (for sell orders—rises above, for buy orders—falls below).\n"
        },
        "time_in_force": {
          "type": "string",
          "enum": [
            "GTC",
            "IOC",
            "FOK",
            "Day",
            "GTD"
          ],
          "description": "Order expiration mode.\n\nValues:\n* `GTC` (\"Good-Till-Canceled\")—order will not be closed until it is filled;\n* `IOC` (\"Immediate-Or-Cancel\")—order must be executed immediately. Any part of an IOC order that cannot be filled immediately will be canceled;\n* `FOK` (\"Fill-Or-Kill\")—order must be executed immediately and completely or not executed at all;\n* `Day`—keeps the order active until the end of the trading day (23:59 UTC+0);\n* `GTD` (\"Good-Till-Date\")—order will be canceled on the specified date.\n"
        },
        "quantity": {
          "type": "string",
          "description": "Order quantity."
        },
        "quantity_cumulative": {
          "type": "string",
          "description": "Executed order quantity."
        },
        "expire_time": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Date of order expiration.\n\nConditions: `time_in_force` is `\"GTD\"`\n"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "description": "Date of order creation."
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "description": "Date of order last update."
        },
        "price_average": {
          "type": "string",
          "description": "Average price of executed order quantity.\n"
        }
      }
    },
    "trading_OrderTradesBase": {
      "title": "Order trades",
      "type": "object",
      "required": [
        "id",
        "quantity",
        "price",
        "fee",
        "timestamp",
        "taker"
      ],
      "description": "The list of trades the order participated in.",
      "properties": {
        "id": {
          "type": "integer",
          "format": "uint64",
          "description": "Trade identifier."
        },
        "quantity": {
          "type": "string",
          "description": "Quantity of the trade."
        },
        "price": {
          "type": "string",
          "description": "Trade price."
        },
        "fee": {
          "type": "string",
          "description": "Fee paid for trade."
        },
        "timestamp": {
          "type": "string",
          "description": "Date and time of the trade."
        },
        "taker": {
          "type": "boolean",
          "description": "Liquidity indicator."
        }
      }
    },
    "trading_PositionId": {
      "title": "Position ID",
      "type": "object",
      "required": [
        "position_id"
      ],
      "properties": {
        "position_id": {
          "type": "integer",
          "format": "uint64",
          "description": "Position identifier."
        }
      }
    },
    "trading_Price": {
      "title": "Price",
      "type": "object",
      "required": [
        "price"
      ],
      "properties": {
        "price": {
          "type": "string",
          "pattern": "^\\d+\\.?\\d*$",
          "description": "Order price."
        }
      }
    },
    "trading_ReduceOnly": {
      "title": "Reduce-only",
      "type": "object",
      "required": [
        "reduce_only"
      ],
      "properties": {
        "reduce_only": {
          "type": "boolean",
          "description": "Flag indicating whether the order, being filled, guarantees not to put the position quantity to the point when the position flips."
        }
      }
    },
    "trading_StopPrice": {
      "title": "Stop price",
      "type": "object",
      "properties": {
        "stop_price": {
          "type": "string",
          "description": "The price level that triggers order activation."
        }
      }
    }
  }
}