WhiteBIT · AsyncAPI Specification

WhiteBit Place Margin Market Order

Version 1.0.0

Place a margin or futures market order over the WebSocket connection. The order opens, extends, reduces, or closes a position at the order book price. Sending the position size on the opposite side is the usual way to flatten a position. No money-denominated variant exists. Unlike spot, `amount` is [stock](/glossary#stock) on both sides, so a separate stock method is unnecessary.

View Spec View on GitHub CompanyCryptocurrencyExchangeTradingWebSocketAsyncAPIEventsWebSockets

Channels

/ws
Margin and futures market order placement channel

Messages

✉
collateralOrderMarketPlaceRequest
Place margin market order
Place a margin or futures market order
✉
collateralOrderMarketPlaceResponse
Place Margin Market Order Response
Executed order object (status FILLED)

Servers

wss
production
WhiteBIT Global Server
wss
eu
WhiteBIT EU Server

AsyncAPI Specification

Raw ↑
asyncapi: 3.0.0
info:
  title: WhiteBit Place Margin Market Order
  version: 1.0.0
  description: |
    Place a margin or futures market order over the WebSocket connection.

    The order opens, extends, reduces, or closes a position at the order book price. Sending
    the position size on the opposite side is the usual way to flatten a position.

    No money-denominated variant exists. Unlike spot, `amount` is [stock](/glossary#stock) on
    both sides, so a separate stock method is unnecessary.
  x-auth-required: true
  x-rate-limits:
    connections-per-minute: 1000
    order-placements-per-10-seconds: 10000
  x-error-codes:
    - code: 19
      message: market is not margin market
      description: "The method was called on a spot-only market. Use the spot `order_*` equivalent there."
    - code: 17
      message: user margin balance not enough
      description: "The collateral balance does not cover the order."
    - code: 12
      message: not enough traders
      description: "The order book is empty or too thin to execute any part of the order."
    - code: 42
      message: order slippage threshold
      description: "The slippage guard stopped the order before it consumed the book further."
    - code: 115
      message: order would result in a new position in the opposite direction
      description: "A reduce-only order would flip the position instead of shrinking it."
    - code: 116
      message: margin order with reduce only is rejected
      description: "The order carries `reduce_only` but nothing is open on that side."
    - code: 111
      message: margin position is too big
      description: "The resulting position would exceed the size cap for the market."
    - code: 114
      message: order's position side does not match user's setting
      description: "`position_side` was sent (as non-`BOTH`) without hedge mode enabled, or was omitted or sent as `BOTH` while hedge mode is enabled, or otherwise does not match the account setting."

servers:
  production:
    host: wss.whitebit.com
    protocol: wss
    description: WhiteBIT Global Server
  eu:
    host: api.whitebit.eu
    protocol: wss
    description: WhiteBIT EU Server

channels:
  /ws:
    address: /ws
    description: Margin and futures market order placement channel
    messages:
      collateralOrderMarketPlaceRequest:
        $ref: '#/components/messages/collateralOrderMarketPlaceRequest'
      collateralOrderMarketPlaceResponse:
        $ref: '#/components/messages/collateralOrderMarketPlaceResponse'

operations:
  sendCollateralOrderMarketPlaceRequest:
    action: receive
    channel:
      $ref: '#/channels/~1ws'
    messages:
      - $ref: '#/channels/~1ws/messages/collateralOrderMarketPlaceRequest'

  receiveCollateralOrderMarketPlaceResponse:
    action: send
    channel:
      $ref: '#/channels/~1ws'
    messages:
      - $ref: '#/channels/~1ws/messages/collateralOrderMarketPlaceResponse'

components:
  messages:
    collateralOrderMarketPlaceRequest:
      name: CollateralOrderMarketPlaceRequest
      title: Place margin market order
      summary: Place a margin or futures market order
      payload:
        $ref: '#/components/schemas/CollateralOrderMarketPlaceRequest'
      examples:
        - name: collateralOrderMarketPlaceSell
          summary: |
            Place a sell market order with parameters:
            - params[0]: order object with market, side, and amount in stock
          payload:
            id: 500011
            method: collateral_order_market_place
            params:
              - market: BTC_PERP
                side: sell
                amount: "0.001"
                stp: "no"

    collateralOrderMarketPlaceResponse:
      name: CollateralOrderMarketPlaceResponse
      title: Place Margin Market Order Response
      summary: Executed order object (status FILLED)
      payload:
        $ref: '#/components/schemas/CollateralOrderMarketPlaceResponse'
      examples:
        - name: collateralOrderMarketPlaceFilled
          summary: Order matched in full on arrival
          payload:
            id: 500011
            result:
              id: 2423735883079
              market: BTC_PERP
              type: 8
              side: 1
              post_only: false
              ioc: false
              reduce_only: false
              position_side: BOTH
              ctime: 1786452691.7653911
              mtime: 1786452691.7653911
              price: "0"
              amount: "0.001"
              left: "0"
              deal_stock: "0.001"
              deal_money: "64.33338"
              deal_fee: "0.0218733492"
              client_order_id: ""
              stp: "no"
              status: FILLED
            error: null

  schemas:
    CollateralOrderMarketPlaceRequest:
      type: object
      required:
        - id
        - method
        - params
      properties:
        id:
          type: integer
          description: Unique request identifier. The response echoes this value.
        method:
          type: string
          const: collateral_order_market_place
          description: "Method name. Fixed value: `collateral_order_market_place`."
        params:
          type: array
          minItems: 1
          maxItems: 1
          items:
            $ref: '#/components/schemas/CollateralOrderMarketPlaceParams'
          description: Array containing exactly one order parameter object

    CollateralOrderMarketPlaceParams:
      type: object
      required:
        - market
        - side
        - amount
      properties:
        market:
          type: string
          description: "Margin or futures market name. A spot-only market is rejected with error `19`."
          example: BTC_PERP
        side:
          type: string
          enum: ["buy", "sell"]
          description: "Order side. The response reports the side numerically: `1` for sell, `2` for buy."
        amount:
          type: string
          description: "Order size in stock on both sides, at the market stock precision."
          example: "0.001"
        reduce_only:
          type: boolean
          description: "Restrict the order to shrinking an existing position. Set it when closing, so a stale size cannot flip the position."
        position_side:
          type: string
          enum: ["BOTH", "LONG", "SHORT"]
          description: "Position leg in hedge mode; futures markets only. `BOTH` in one-way mode. Optional at the request layer but functionally required in hedge mode — omitting it, or sending `BOTH`, is rejected with error `114`."
        client_order_id:
          type: string
          description: "Custom client order id, echoed on the response. Must be unique among active orders — a collision returns error `43`."
        stp:
          type: string
          enum: ["no", "co", "cn", "cb"]
          description: "Self-trade prevention mode: `no`=No Prevention, `co`=Cancel Oldest, `cn`=Cancel Newest, `cb`=Cancel Both. Defaults to `no` when omitted."

    CollateralOrderMarketPlaceResponse:
      type: object
      required:
        - id
        - result
        - error
      properties:
        id:
          type: integer
          description: Request identifier matching the request
        result:
          type: object
          description: "Executed order with `price` `\"0\"`, because a market order carries no limit price. A margin market order reports `type` `8`."
        error:
          type: "null"
          description: Error object (null on success)

Work with this as data

Every AsyncAPI spec here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for asyncapi

4 MCP tools reach this
  • find_asyncapisBrowse and filter every AsyncAPI spec in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This AsyncAPI spec
curl "https://apis.io/api/v1/asyncapis/whitebit-private-collateral-order-market-place-asyncapi"
All asyncapi
curl "https://apis.io/api/v1/asyncapis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.