{
  "path": "/spot/orders",
  "operation_id": "listOrders",
  "auth_required": true,
  "parameters": [
    {
      "name": "currency_pair",
      "in": "query",
      "description": "Query by specified currency pair. Required for open orders, optional for filled orders",
      "required": true,
      "schema": {
        "type": "string"
      },
      "example": "BTC_USDT"
    },
    {
      "name": "status",
      "in": "query",
      "required": true,
      "description": "List orders based on status\n\n`open` - order is waiting to be filled\n`finished` - order has been filled or cancelled\n",
      "schema": {
        "type": "string"
      },
      "example": "open"
    },
    {
      "name": "page",
      "in": "query",
      "description": "Page number",
      "required": false,
      "schema": {
        "type": "integer",
        "format": "int32",
        "default": 1,
        "minimum": 1
      },
      "example": 1
    },
    {
      "name": "limit",
      "in": "query",
      "description": "Maximum number of records to be returned. If `status` is `open`, maximum of `limit` is 100",
      "required": false,
      "schema": {
        "type": "integer",
        "default": 100,
        "minimum": 1,
        "maximum": 1000
      },
      "example": 100
    },
    {
      "name": "account",
      "in": "query",
      "required": false,
      "description": "Specify query account",
      "schema": {
        "type": "string"
      },
      "example": "spot"
    },
    {
      "name": "from",
      "in": "query",
      "required": false,
      "description": "Start timestamp for the query",
      "schema": {
        "type": "integer",
        "format": "int64"
      },
      "example": 1627706330
    },
    {
      "name": "to",
      "in": "query",
      "required": false,
      "description": "End timestamp for the query, defaults to current time if not specified",
      "schema": {
        "type": "integer",
        "format": "int64"
      },
      "example": 1635329650
    },
    {
      "name": "side",
      "in": "query",
      "description": "Specify all bids or all asks, both included if not specified",
      "required": false,
      "schema": {
        "type": "string"
      },
      "example": "sell"
    }
  ],
  "response_fields": {
    "200": {
      "description": "List retrieved successfully",
      "fields": [
        {
          "path": "$",
          "type": "array<object>",
          "description": "",
          "constraints": ""
        },
        {
          "path": "$[]",
          "type": "object",
          "description": "Spot order details",
          "constraints": ""
        },
        {
          "path": "$[].id",
          "type": "string",
          "description": "Order ID",
          "constraints": ""
        },
        {
          "path": "$[].text",
          "type": "string",
          "description": "User defined information. If not empty, must follow the rules below:\n\n1. prefixed with `t-`\n2. no longer than 28 bytes without `t-` prefix\n3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.)\n\nBesides user defined information, reserved contents are listed below, denoting how the order is created:\n\n- 101: from android\n- 102: from IOS\n- 103: from IPAD\n- 104: from webapp\n- 3: from web\n- 2: from apiv2\n- apiv4: from apiv4\npm_liquidate, comb_margin_liquidate, and scm_liquidate represent cross-margin liquidation orders\nliquidate represents isolated-margin liquidation orders",
          "constraints": ""
        },
        {
          "path": "$[].amend_text",
          "type": "string",
          "description": "The custom data that the user remarked when amending the order",
          "constraints": ""
        },
        {
          "path": "$[].create_time",
          "type": "string",
          "description": "Creation time of order",
          "constraints": ""
        },
        {
          "path": "$[].update_time",
          "type": "string",
          "description": "Last modification time of order",
          "constraints": ""
        },
        {
          "path": "$[].create_time_ms",
          "type": "integer",
          "description": "Creation time of order (in milliseconds)",
          "constraints": "格式：\"int64\""
        },
        {
          "path": "$[].update_time_ms",
          "type": "integer",
          "description": "Last modification time of order (in milliseconds)",
          "constraints": "格式：\"int64\""
        },
        {
          "path": "$[].status",
          "type": "string",
          "description": "Order status\n\n- `open`: to be filled\n- `closed`: closed order\n- `cancelled`: cancelled",
          "constraints": "枚举：open / closed / cancelled"
        },
        {
          "path": "$[].currency_pair",
          "type": "string",
          "description": "Currency pair",
          "constraints": ""
        },
        {
          "path": "$[].trade_quote",
          "type": "string",
          "description": "Actual quote currency used for the trade; can be specified only in a unified market",
          "constraints": ""
        },
        {
          "path": "$[].type",
          "type": "string",
          "description": "Order Type \n\n- limit : Limit Order\n- market : Market Order",
          "constraints": "默认：\"limit\"；枚举：limit / market"
        },
        {
          "path": "$[].account",
          "type": "string",
          "description": "Account type, spot - spot account, margin - leveraged account, unified - unified account",
          "constraints": "默认：\"spot\""
        },
        {
          "path": "$[].side",
          "type": "string",
          "description": "Buy or sell order",
          "constraints": "枚举：buy / sell"
        },
        {
          "path": "$[].amount",
          "type": "string",
          "description": "Trade amount\nWhen `type` is `limit`, this is the base currency to trade (the currency being bought or sold), e.g. `BTC` in `BTC_USDT`.\nWhen `type` is `market`, the meaning depends on the side:\n- `side`: `buy` refers to the quote currency, e.g. `USDT` in `BTC_USDT`\n- `side`: `sell` refers to the base currency, e.g. `BTC` in `BTC_USDT`",
          "constraints": ""
        },
        {
          "path": "$[].price",
          "type": "string",
          "description": "Trading price, required when `type`=`limit`",
          "constraints": ""
        },
        {
          "path": "$[].time_in_force",
          "type": "string",
          "description": "Time in force\n\n- gtc: GoodTillCancelled\n- ioc: ImmediateOrCancelled, taker only\n- poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee\n- fok: FillOrKill, fill either completely or none\nOnly `ioc` and `fok` are supported when `type`=`market`",
          "constraints": "默认：\"gtc\"；枚举：gtc / ioc / poc / fok"
        },
        {
          "path": "$[].iceberg",
          "type": "string",
          "description": "Amount to display for the iceberg order. Null or 0 for normal orders. Hiding all amount is not supported",
          "constraints": ""
        },
        {
          "path": "$[].auto_borrow",
          "type": "boolean",
          "description": "Used in margin or cross margin trading to allow automatic loan of insufficient amount if balance is not enough",
          "constraints": ""
        },
        {
          "path": "$[].auto_repay",
          "type": "boolean",
          "description": "Enable or disable automatic repayment for automatic borrow loan generated by cross margin order. Default is disabled. Note that:\n\n1. This field is only effective for cross margin orders. Margin account does not support setting auto repayment for orders.\n2. `auto_borrow` and `auto_repay` can be both set to true in one order",
          "constraints": ""
        },
        {
          "path": "$[].left",
          "type": "string",
          "description": "Amount left to fill",
          "constraints": ""
        },
        {
          "path": "$[].filled_amount",
          "type": "string",
          "description": "Amount filled",
          "constraints": ""
        },
        {
          "path": "$[].fill_price",
          "type": "string",
          "description": "Total filled in quote currency. Deprecated in favor of `filled_total`",
          "constraints": ""
        },
        {
          "path": "$[].filled_total",
          "type": "string",
          "description": "Total filled in quote currency",
          "constraints": ""
        },
        {
          "path": "$[].avg_deal_price",
          "type": "string",
          "description": "Average fill price",
          "constraints": ""
        },
        {
          "path": "$[].fee",
          "type": "string",
          "description": "Fee deducted",
          "constraints": ""
        },
        {
          "path": "$[].fee_currency",
          "type": "string",
          "description": "Fee currency unit",
          "constraints": ""
        },
        {
          "path": "$[].point_fee",
          "type": "string",
          "description": "Points used to deduct fee",
          "constraints": ""
        },
        {
          "path": "$[].gt_fee",
          "type": "string",
          "description": "GT used to deduct fee",
          "constraints": ""
        },
        {
          "path": "$[].gt_maker_fee",
          "type": "string",
          "description": "GT amount used to deduct maker fee",
          "constraints": ""
        },
        {
          "path": "$[].gt_taker_fee",
          "type": "string",
          "description": "GT amount used to deduct taker fee",
          "constraints": ""
        },
        {
          "path": "$[].gt_discount",
          "type": "boolean",
          "description": "Whether GT fee deduction is enabled",
          "constraints": ""
        },
        {
          "path": "$[].rebated_fee",
          "type": "string",
          "description": "Rebated fee",
          "constraints": ""
        },
        {
          "path": "$[].rebated_fee_currency",
          "type": "string",
          "description": "Rebated fee currency unit",
          "constraints": ""
        },
        {
          "path": "$[].stp_id",
          "type": "integer",
          "description": "Orders between users in the same `stp_id` group are not allowed to be self-traded\n\n1. If the `stp_id` of two orders being matched is non-zero and equal, they will not be executed. Instead, the corresponding strategy will be executed based on the `stp_act` of the taker.\n2. `stp_id` returns `0` by default for orders that have not been set for `STP group`",
          "constraints": ""
        },
        {
          "path": "$[].stp_act",
          "type": "string",
          "description": "Self-Trading Prevention Action. Users can use this field to set self-trade prevention strategies\n\n1. After users join the `STP Group`, they can pass `stp_act` to limit the user's self-trade prevention strategy. If `stp_act` is not passed, the default is `cn` strategy.\n2. When the user does not join the `STP group`, an error will be returned when passing the `stp_act` parameter.\n3. If the user did not use `stp_act` when placing the order, `stp_act` will return '-'\n\n- cn: Cancel newest, cancel new orders and keep old ones\n- co: Cancel oldest, cancel old orders and keep new ones\n- cb: Cancel both, both old and new orders will be cancelled",
          "constraints": "枚举：cn / co / cb / -"
        },
        {
          "path": "$[].finish_as",
          "type": "string",
          "description": "How the order finished:\n\n- open: Pending processing\n- filled: Fully filled\n- cancelled: Cancelled by user\n- liquidate_cancelled: Cancelled by liquidation\n- small: Order size too small\n- depth_not_enough: Cancelled due to insufficient order book depth\n- trader_not_enough: Cancelled due to insufficient counterparty liquidity\n- ioc: Not filled immediately because time-in-force is IOC\n- poc: Post-only requirement not met because time-in-force is set to poc (maker-only); rejected after being detected as taker\n- fok: Not fully filled immediately because time-in-force is FOK\n- stp: Cancelled due to self-trade prevention\n- price_protect_cancelled: Cancelled due to price protection\n- unknown: Unknown",
          "constraints": "枚举：open / filled / cancelled / liquidate_cancelled / depth_not_enough / trader_not_enough / small / ioc / poc / fok / stp / price_protect_cancelled / unknown"
        },
        {
          "path": "$[].action_mode",
          "type": "string",
          "description": "Processing Mode:\nWhen placing an order, different fields are returned based on action_mode. This field is only valid during the request and is not included in the response result\nACK: Asynchronous mode, only returns key order fields\nRESULT: No clearing information\nFULL: Full mode (default)",
          "constraints": ""
        },
        {
          "path": "$[].slippage",
          "type": "string",
          "description": "Maximum supported slippage ratio for Spot Market Order Placement, calculated based on the latest market price at the time of order placement as the benchmark (Example: 0.03 means 3%)",
          "constraints": ""
        },
        {
          "path": "$[].stop_profit",
          "type": "object",
          "description": "Take profit for limit orders. Pass {} to cancel take profit; pass null to leave take profit unchanged.",
          "constraints": ""
        },
        {
          "path": "$[].stop_profit.trigger_price",
          "type": "string",
          "description": "Take profit trigger price\nWhen `side == \"buy\"`, `trigger_price` must be greater than `price`\nWhen `side == \"sell\"`, `trigger_price` must be less than `price`",
          "constraints": ""
        },
        {
          "path": "$[].stop_profit.order_price",
          "type": "string",
          "description": "Take profit order price",
          "constraints": ""
        },
        {
          "path": "$[].stop_loss",
          "type": "object",
          "description": "Stop loss for limit orders. Pass {} to cancel stop loss; pass null to leave stop loss unchanged.",
          "constraints": ""
        },
        {
          "path": "$[].stop_loss.trigger_price",
          "type": "string",
          "description": "Stop loss trigger price\nWhen `side == \"buy\"`, `trigger_price` must be less than `price`\nWhen `side == \"sell\"`, `trigger_price` must be greater than `price`",
          "constraints": ""
        },
        {
          "path": "$[].stop_loss.order_price",
          "type": "string",
          "description": "Stop-loss order price",
          "constraints": ""
        }
      ]
    }
  },
  "source_version": "v4.106.132",
  "source_url": "https://github.com/gate/gateapi-python/blob/cd2cac4d339ec0734480787d23c020f467fd7b80/openapi.yaml",
  "local_tool_limits": [
    "仅检查必填、枚举和简单数值范围",
    "复杂类型序列化、条件必填、时间窗口等以官方规则为准",
    "不会发起 API 请求"
  ]
}
