> ## Documentation Index
> Fetch the complete documentation index at: https://developer.woox.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Place algo order

> post algo order

**Limit: 2 requests per 1 second per symbol**\
Supported algo orders include STOP, OCO, TRAILING\_STOP, POSITIONAL\_TP\_SL, TP\_SL, BRACKET and STOP\_BRACKET orders.

clientAlgoOrderId behavior: needs to be unique among open algo orders. Orders with the same clientAlgoOrderId can be accepted only when the previous one is completed, otherwise the order would be rejected.  Note that it’s treated separately from the clientOrderId for ordinary orders.

visibleQuantity behavior: it sets the maximum quantity to be shown on orderbook. By default, it is equal to quantity.  If it’s set to 0, the order would be hidden from the orderbook.

Open algo order limit:

* a maximum of 100 open algo orders is allowed on a per instrument basis

* a maximum of 10 open TP\_SL orders are permitted per instrument - this is inclusive of the TP\_SL orders that are still attached to BRACKET or STOP\_BRACKET order

* a maximum of 1 open POSITIONAL\_TP\_SL is allowed per instrument per side - when a second POSITIONAL\_TP\_SL order gets activated that’s associated with a BRACKET or a STOP\_BRACKET order, this new POSITIONAL\_TP\_SL order will replace the previous POSITIONAL\_TP\_SL order

<ResponseExample>
  ```bash theme={null}
  // STOP, OCO, TRAILING_STOP
  {
    "success": true,
    "data": {
      "rows": [
        {
          "algoType": "string",
          "clientAlgoOrderId": 0,
          "algoOrderId": 0,
          "quantity": "0"
        }
      ]
    },
    "timestamp": 1676283560233
  }
  // POSITIONAL_TP_SL, TP_SL
  {
      "success": true,
      "data": {
          "rows": [
              {
                  "algoOrderId": 432132,
                  "clientAlgoOrderId": 0,
                  "algoType": "TAKE_PROFIT",
                  "quantity": "0"
              },
              {
                  "algoOrderId": 432133,
                  "clientAlgoOrderId": 0,
                  "algoType": "STOP_LOSS",
                  "quantity": "0"
              },
              {
                  "algoOrderId": 432131,
                  "clientAlgoOrderId": 0,
                  "algoType": "string",
                  "quantity": "0"
              }
          ]
      },
      "timestamp": 1676283560233
  }
  // BRACKET, STOP_BRACKET
  {
      "success": true,
      "data": {
          "rows": [
              {
                  "algoOrderId": 432132,
                  "clientAlgoOrderId": 0,
                  "algoType": "TAKE_PROFIT",
                  "quantity": "0"
              },
              {
                  "algoOrderId": 432133,
                  "clientAlgoOrderId": 0,
                  "algoType": "STOP_LOSS",
                  "quantity": "0"
              },
              {
                  "orderId": 432131,
                  "clientAlgoOrderId": 0,
                  "algoType": "POSITIONAL_TP_SL",
                  "quantity": "0"
              },
              {
                  "algoOrderId": 432130,
                  "clientAlgoOrderId": 0,
                  "algoType": "BRACKET",
                  "quantity": "10"
              }
          ]
      },
      "timestamp": 1676283560233
  }
  ```
</ResponseExample>


## OpenAPI

````yaml POST /v3/trade/algoOrder
openapi: 3.0.2
info:
  title: Swagger Petstore - OpenAPI 3.0
  description: >-
    This is a sample Pet Store Server based on the OpenAPI 3.0 specification. 
    You can find out more about

    Swagger at [http://swagger.io](http://swagger.io). In the third iteration of
    the pet store, we've switched to the design first approach!

    You can now help us improve the API whether it's by making changes to the
    definition itself or to the code.

    That way, with time, we can improve the API in general, and expose some of
    the new features in OAS3.


    Some useful links:

    - [The Pet Store
    repository](https://github.com/swagger-api/swagger-petstore)

    - [The source API definition for the Pet
    Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)
  termsOfService: http://swagger.io/terms/
  contact:
    name: API Team
    email: apiteam@swagger.io
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.0.19
servers:
  - url: https://api.woox.io/
security: []
externalDocs:
  description: Find out more about Swagger
  url: http://swagger.io
paths:
  /v3/trade/algoOrder:
    post:
      description: post algo order
      parameters:
        - $ref: '#/components/parameters/ApiKeyHeader'
        - $ref: '#/components/parameters/SignatureHeader'
        - $ref: '#/components/parameters/TimestampHeader'
      requestBody:
        description: ''
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/stop_order_stop_order'
                - $ref: '#/components/schemas/oco_order_oco_order'
                - $ref: '#/components/schemas/trailing_stop_trailing_stop'
                - $ref: '#/components/schemas/positional_tp_sl_positional_tp_sl'
                - $ref: '#/components/schemas/tp_sl_tp_sl'
                - $ref: '#/components/schemas/bracket_bracket'
                - $ref: '#/components/schemas/stop_bracket_stop_bracket'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/StopResponse'
      security: []
components:
  parameters:
    ApiKeyHeader:
      name: x-api-key
      in: header
      required: true
      schema:
        type: string
        example: abcdef123456
      description: api-key
    SignatureHeader:
      name: x-api-signature
      in: header
      required: true
      schema:
        type: string
        example: signaturestring
      description: api-signature
    TimestampHeader:
      name: x-api-timestamp
      in: header
      required: true
      schema:
        type: string
        example: '1718943200000'
      description: api-timestamp
  schemas:
    stop_order_stop_order:
      description: ''
      title: Stop
      allOf:
        - $ref: '#/components/schemas/common_algo_common_algo'
        - type: object
          properties:
            algoType:
              type: string
              description: 'STOP: stop market / stop limit order'
            triggerPrice:
              type: string
              description: Only support LIMIT
            triggerPriceType:
              type: string
              description: >-
                Trigger price type, currently only support MARKET_PRICE (i.e.
                last price)
            type:
              type: string
              description: Trigger price, only support LIMIT
            price:
              type: string
              description: Order price, only applicable to LIMIT type
            reduceOnly:
              type: boolean
              description: >-
                Only applicable to perpetual instruments; whether the order can
                only reduce in position size; valid options are true/false
    oco_order_oco_order:
      description: ''
      title: OCO
      allOf:
        - $ref: '#/components/schemas/common_algo_common_algo'
        - type: object
          required:
            - type
            - price
            - childOrders
          properties:
            algoType:
              type: string
              description: 'OCO: one-cancels-the-other order'
            type:
              type: string
              description: Trigger price, only support LIMIT
            price:
              type: string
              description: Order price, only applicable to LIMIT type
            reduceOnly:
              type: boolean
              description: >-
                Only applicable to perpetual instruments; whether the order can
                only reduce in position size; valid options are true/false
            childOrders:
              type: array
              description: Details of the other order (i.e. the trigger order)
              items:
                type: object
                properties:
                  algoType:
                    type: string
                    description: Only support STOP
                  side:
                    type: string
                    description: >-
                      BUY/SELL; required to be the same as the side of the LIMIT
                      order
                  triggerPrice:
                    type: string
                    description: Trigger price
                  triggerPriceType:
                    type: string
                    description: >-
                      Trigger price type, currently only support MARKET_PRICE
                      (i.e. last price)
                  type:
                    type: string
                    description: Order type of the trigger order, LIMIT/MARKET
                  price:
                    type: string
                    description: >-
                      Order price of the trigger order, only applicable if it's
                      a LIMIT order
                required:
                  - algoType
                  - side
                  - triggerPrice
                  - type
    trailing_stop_trailing_stop:
      description: ''
      title: Trailing stop
      allOf:
        - $ref: '#/components/schemas/common_algo_common_algo'
        - type: object
          properties:
            algoType:
              type: string
              description: 'TRAILING_STOP: trailing stop order '
            type:
              type: string
              description: Trigger price, only support LIMIT
            activatedPrice:
              type: string
              description: Activated price
            callbackRate:
              type: string
              description: >-
                Either callbackValue or callbackRate is required;  If both are
                passed, the request will be rejected
            callbackValue:
              type: string
              description: >-
                Either callbackValue or callbackRate is required;  If both are
                passed, the request will be rejected
            reduceOnly:
              type: boolean
              description: >-
                Only applicable to perpetual instruments; whether the order can
                only reduce in position size; valid options are true/false
    positional_tp_sl_positional_tp_sl:
      description: ''
      title: Positional TP/SL
      allOf:
        - $ref: '#/components/schemas/common_algo_common_algo'
        - type: object
          required:
            - childOrders
          properties:
            algoType:
              type: string
              description: 'POSITIONAL_TP_SL: TP/SL that closes the full position'
            childOrders:
              type: array
              description: >-
                Details of the positional TP/SL information, can contain at most
                1 TAKE_PROFIT and 1 STOP_LOSS
              items:
                type: object
                properties:
                  algoType:
                    type: string
                    description: TAKE_PROFIT/STOP_LOSS
                  side:
                    type: string
                    description: BUY/SELL
                  triggerPrice:
                    type: string
                    description: Trigger price
                  triggerPriceType:
                    type: string
                    description: >-
                      Trigger price type, currently only support MARKET_PRICE
                      (i.e. last price)
                  type:
                    type: string
                    description: Only support CLOSE_POSITION
                required:
                  - algoType
                  - side
                  - triggerPrice
                  - type
    tp_sl_tp_sl:
      description: ''
      title: TP/SL
      allOf:
        - $ref: '#/components/schemas/common_algo_common_algo'
        - type: object
          required:
            - childOrders
          properties:
            algoType:
              type: string
              description: 'TP_SL: TP/SL that closes a specified quantity'
            childOrders:
              type: array
              description: >-
                Details of the TP/SL information, can contain at most 1
                TAKE_PROFIT and 1 STOP_LOSS
              items:
                type: object
                properties:
                  algoType:
                    type: string
                    description: TAKE_PROFIT/STOP_LOSS
                  side:
                    type: string
                    description: BUY/SELL
                  triggerPrice:
                    type: string
                    description: Trigger price
                  triggerPriceType:
                    type: string
                    description: >-
                      Trigger price type, currently only support MARKET_PRICE
                      (i.e. last price)
                  type:
                    type: string
                    description: Only support MARKET
                required:
                  - algoType
                  - side
                  - triggerPrice
                  - type
    bracket_bracket:
      description: ''
      title: Bracket
      allOf:
        - $ref: '#/components/schemas/common_algo_common_algo'
        - type: object
          required:
            - type
            - price
            - childOrders
          properties:
            algoType:
              type: string
              description: >-
                BRACKET: bracket order with limit or market order as the initial
                order and an attached POSITIONAL_TP_SL or TP_SL order
            type:
              type: string
              description: LIMIT/MARKET
            price:
              type: string
              description: Order price, only applicable if LIMIT order
            reduceOnly:
              type: boolean
              description: >-
                Only applicable to perpetual instruments; whether the
                LIMIT/MARKET order can only reduce in position size; only
                support false for BRACKET orders
            childOrders:
              type: array
              description: >-
                Attached TP/SL orders, only support 1 set of POSITIONAL_TP_SL or
                TP_SL
              items:
                type: object
                properties:
                  algoType:
                    type: string
                    description: TAKE_PROFIT/STOP_LOSS
                  side:
                    type: string
                    description: >-
                      Required to be SELL if side of the initial order is BUY; 
                      Required to be BUY if side of the initial order is SELL
                  triggerPrice:
                    type: string
                    description: Trigger price of the TP/SL
                  triggerPriceType:
                    type: string
                    description: >-
                      Trigger price type, currently only support MARKET_PRICE
                      (i.e. last price)
                  type:
                    type: string
                    description: CLOSE_POSITION for POSITIONAL_TP_SL; MARKET for TP_SL
                required:
                  - algoType
                  - side
                  - triggerPrice
                  - type
    stop_bracket_stop_bracket:
      description: ''
      title: Stop bracket
      allOf:
        - $ref: '#/components/schemas/common_algo_common_algo'
        - type: object
          required:
            - type
            - price
            - childOrders
          properties:
            algoType:
              type: string
              description: >-
                STOP_BRACKET: bracket order with stop market or stop limit order
                as the initial order and an attached POSITIONAL_TP_SL or TP_SL
                order
            type:
              type: string
              description: LIMIT/MARKET
            price:
              type: string
              description: Order price, only applicable if LIMIT order
            reduceOnly:
              type: boolean
              description: >-
                Only applicable to perpetual instruments; whether the
                LIMIT/MARKET order can only reduce in position size; only
                support false for STOP_BRACKET orders
            triggerPrice:
              type: string
              description: Trigger price of the initial stop order
            triggerPriceType:
              type: string
              description: >-
                Trigger price type of the initial stop order, currently only
                support MARKET_PRICE (i.e. last price)
            childOrders:
              type: array
              description: >-
                Attached TP/SL orders, only support 1 set of POSITIONAL_TP_SL or
                TP_SL
              items:
                type: object
                properties:
                  algoType:
                    type: string
                    description: POSITIONAL_TP_SL/TP_SL
                  childOrders:
                    type: array
                    description: >-
                      Details of the TP/SL information, can contain at most 1
                      TAKE_PROFIT and 1 STOP_LOSS
                    items:
                      type: object
                      properties:
                        algoType:
                          type: string
                          description: TAKE_PROFIT/STOP_LOSS
                        side:
                          type: string
                          description: >-
                            Required to be SELL if side of the initial order is
                            BUY;  Required to be BUY if side of the initial
                            order is SELL
                        triggerPrice:
                          type: string
                          description: Trigger price of the TP/SL
                        triggerPriceType:
                          type: string
                          description: >-
                            Trigger price type, currently only support
                            MARKET_PRICE (i.e. last price)
                        type:
                          type: string
                          description: >-
                            CLOSE_POSITION for POSITIONAL_TP_SL; MARKET for
                            TP_SL
                      required:
                        - algoType
                        - side
                        - triggerPrice
                        - type
                required:
                  - algoType
                  - childOrders
    StopResponse:
      allOf:
        - $ref: '#/components/schemas/CommonResponse'
        - type: object
          properties:
            data:
              type: object
              properties:
                rows:
                  type: array
                  items:
                    $ref: '#/components/schemas/AlgoBaseResponse'
                  description: ''
    common_algo_common_algo:
      type: object
      required:
        - symbol
        - algoType
      properties:
        symbol:
          type: string
          description: Symbol name
        clientAlgoOrderId:
          type: integer
          description: Client algo order Id as assigned by the user
        algoOrderTag:
          type: string
          description: 'An optional tag for this order, max string length: 64'
        side:
          type: string
          description: BUY/SELL, not required for POSITIONAL_TP_SL or TP_SL order
        positionSide:
          type: string
          description: >-
            BOTH for one way mode; LONG or SHORT for hedge mode;  Only
            applicable to perpetual instruments
        quantity:
          type: string
          description: Order quantity, not required for POSITIONAL_TP_SL order
        visibleQuantity:
          type: string
          description: >-
            The order quantity shown on orderbook;  for POSITIONAL_TP_SL order,
            visibleQuantity applies directly to the child orders
        marginMode:
          type: string
          description: CROSS / ISOLATED
    CommonResponse:
      type: object
      properties:
        success:
          type: boolean
          description: 'true'
        timestamp:
          type: integer
          description: timestamp
    AlgoBaseResponse:
      type: object
      properties:
        algoOrderId:
          type: integer
          description: algoOrderId
        clientAlgoOrderId:
          type: integer
          description: clientAlgoOrderId
        algoType:
          type: string
          description: ALGO_TYPE
          enum:
            - STOP
            - OCO
            - TRAILING_STOP
            - POSITIONAL_TP_SL
            - TP_SL
            - BRACKET
            - STOP_BRACKET
        quantity:
          type: string
          description: quantity

````