{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/hitbtc/json-schema/hitbtc-trading-order-list-request-schema.json",
  "title": "Order list request",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/hitbtc-order-lists-api-openapi.yml#/components/schemas/trading_OrderListRequest",
  "allOf": [
    {
      "$ref": "#/$defs/trading_OrderListId"
    },
    {
      "type": "object",
      "required": [
        "contingency_type",
        "orders"
      ],
      "properties": {
        "contingency_type": {
          "type": "string",
          "enum": [
            "allOrNone",
            "oneCancelOther",
            "oneTriggerOther",
            "oneTriggerOneCancelOther"
          ],
          "description": "Order list type.\n\nValues:\n  * `allOrNone` (AON)—all orders in the set should be executed within a single transaction or become expired otherwise;\n  * `oneCancelOther` (OCO)—all orders in the set should be canceled if one of them was executed;\n  * `oneTriggerOther` (OTO)—execution of the first (primary) order on the list activates other (secondary) orders as independent of each other;\n  * `oneTriggerOneCancelOther` (OTOCO)—the execution of the first (primary) order on the list activates the other (secondary) orders as an OCO order list.\n"
        },
        "orders": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/trading_OrderRequest",
            "minItems": 2,
            "maxItems": 3
          },
          "description": "Orders in the order list.\n\n⚠️ There must be 2 or 3 orders for `allOrNone`/`oneCancelOther`/`oneTriggerOther` and 3—for `oneTriggerOneCancelOther`. Placing any other number of orders will result in an error.\n"
        }
      }
    }
  ],
  "$defs": {
    "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_LimitDefaultTIF": {
      "title": "Time-in-Force",
      "type": "object",
      "properties": {
        "time_in_force": {
          "default": "GTC"
        }
      }
    },
    "trading_LimitOrderRequest": {
      "title": "Limit order",
      "allOf": [
        {
          "$ref": "#/$defs/trading_OrderRequestBase"
        },
        {
          "$ref": "#/$defs/trading_MarkupRateRequest"
        },
        {
          "$ref": "#/$defs/trading_HiddenOrderFields"
        },
        {
          "$ref": "#/$defs/trading_PriceRequest"
        },
        {
          "$ref": "#/$defs/trading_LimitDefaultTIF"
        }
      ]
    },
    "trading_MarketOrderRequest": {
      "title": "Market order",
      "allOf": [
        {
          "$ref": "#/$defs/trading_OrderRequestBase"
        },
        {
          "$ref": "#/$defs/trading_MarkupRateRequest"
        },
        {
          "type": "object",
          "required": [
            "type"
          ]
        }
      ]
    },
    "trading_MarkupRateRequest": {
      "title": "Markup rate",
      "type": "object",
      "properties": {
        "take_rate": {
          "type": "number",
          "minimum": 0,
          "maximum": 0.1,
          "multipleOf": 1e-06,
          "description": "Markup taker fee rate applied to the order volume."
        },
        "make_rate": {
          "type": "number",
          "minimum": 0,
          "maximum": 0.1,
          "multipleOf": 1e-06,
          "description": "Markup maker fee rate applied to the order volume."
        }
      }
    },
    "trading_OrderListId": {
      "title": "Order list ID",
      "type": "object",
      "properties": {
        "order_list_id": {
          "type": "string",
          "minLength": 8,
          "maxLength": 32,
          "pattern": "^[a-zA-Z0-9_\\-]{8,32}$",
          "description": "Client-provided identifier of the order list.\n\nConditions:\n  * if omitted, will be generated by the system;\n  * equal to `client_order_id` of the first order in the list.\n\n⚠️ Uniqueness must be guaranteed until the last order with the same `client_order_id` becomes inactive (canceled, expired, or fully executed) and some time after that.\n"
        }
      }
    },
    "trading_OrderRequest": {
      "allOf": [
        {
          "type": "object"
        },
        {
          "title": "Order request",
          "oneOf": [
            {
              "$ref": "#/$defs/trading_LimitOrderRequest"
            },
            {
              "$ref": "#/$defs/trading_MarketOrderRequest"
            },
            {
              "$ref": "#/$defs/trading_StopLimitOrderRequest"
            },
            {
              "$ref": "#/$defs/trading_StopMarketOrderRequest"
            },
            {
              "$ref": "#/$defs/trading_StopLimitOrderRequest"
            },
            {
              "$ref": "#/$defs/trading_StopMarketOrderRequest"
            }
          ]
        }
      ]
    },
    "trading_OrderRequestBase": {
      "title": "Order request",
      "allOf": [
        {
          "$ref": "#/$defs/trading_StrictValidateRequest"
        },
        {
          "$ref": "#/$defs/trading_QuantityRequest"
        },
        {
          "type": "object",
          "required": [
            "side",
            "symbol"
          ],
          "properties": {
            "client_order_id": {
              "type": "string",
              "minLength": 8,
              "maxLength": 32,
              "pattern": "^[a-zA-Z0-9_\\-]{8,32}$",
              "description": "Client-provided identifier of an order.\n\n⚠️ Uniqueness must be guaranteed until the last order with the same `client_order_id` becomes inactive (canceled, expired, or fully executed) and some time after that.\n\nℹ️ If omitted, will be generated by the system.\n"
            },
            "symbol": {
              "type": "string",
              "description": "Symbol code."
            },
            "side": {
              "type": "string",
              "enum": [
                "sell",
                "buy"
              ],
              "description": "Order side."
            },
            "type": {
              "type": "string",
              "default": "limit",
              "enum": [
                "limit",
                "market",
                "stopLimit",
                "stopMarket",
                "takeProfitLimit",
                "takeProfitMarket"
              ],
              "description": "Order type.\n\nConditions: required if `market`, `stopMarket`, `takeProfitMarket`\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"
              ],
              "default": "FOK",
              "description": "Order expiration mode.\n\nConditions: `post_only` omitted\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"
            },
            "expire_time": {
              "type": "string",
              "format": "date-time",
              "description": "Date and time of order expiration.\n\nConditions: `time_in_force` is `\"GTD\"`\n"
            },
            "post_only": {
              "type": "boolean",
              "description": "A post-only order is an order that does not remove liquidity.\n\nConditions: `time_in_force` omitted\n\n⚠️ If the post-only order would cause a match with a pre-existing order as a taker, then the order will be canceled.\n",
              "default": false
            }
          }
        }
      ]
    },
    "trading_PriceRequest": {
      "title": "Price",
      "type": "object",
      "required": [
        "price"
      ],
      "properties": {
        "price": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "Order price."
        }
      }
    },
    "trading_QuantityRequest": {
      "title": "Quantity",
      "type": "object",
      "required": [
        "quantity"
      ],
      "properties": {
        "quantity": {
          "type": "string",
          "exclusiveMinimum": 0,
          "description": "Order quantity."
        }
      }
    },
    "trading_StopLimitOrderRequest": {
      "title": "Stop limit order",
      "allOf": [
        {
          "$ref": "#/$defs/trading_LimitOrderRequest"
        },
        {
          "$ref": "#/$defs/trading_StopPriceRequest"
        },
        {
          "$ref": "#/$defs/trading_HiddenOrderFields"
        },
        {
          "$ref": "#/$defs/trading_LimitDefaultTIF"
        },
        {
          "required": [
            "stop_price"
          ]
        }
      ]
    },
    "trading_StopMarketOrderRequest": {
      "title": "Stop market order",
      "allOf": [
        {
          "$ref": "#/$defs/trading_MarketOrderRequest"
        },
        {
          "$ref": "#/$defs/trading_StopPriceRequest"
        },
        {
          "required": [
            "stop_price"
          ]
        }
      ]
    },
    "trading_StopPriceRequest": {
      "title": "Stop price",
      "type": "object",
      "properties": {
        "stop_price": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "The price level that triggers order activation."
        }
      }
    },
    "trading_StrictValidateRequest": {
      "title": "Strict validate",
      "type": "object",
      "properties": {
        "strict_validate": {
          "type": "boolean",
          "description": "Price and quantity will be checked for incrementation within the symbol tick size and quantity step (see the symbol `tick_size` and `quantity_increment`).",
          "default": false
        }
      }
    }
  }
}