Stop Orders

Set a stop order for a particular position defined by market and direction. Optionally pass builderCode to attribute the eventual triggered close to a builder for commission. For how stop orders work, see Take profit and stop loss.

post/v1/perps/stop_order

Request

  • Base URL
    https://api.ondoperps.xyz
  • URL
    https://api.ondoperps.xyz/v1/perps/stop_order
  • Auth
    • HTTP bearer
    • or API key in header ONDO-KEY-ID

Request body

marketstring required

Perps market

positionDirection'long' | 'short' required

Position direction this stop order watches

type'stopLoss' | 'takeProfit' required

The type of stop order to set

triggerPricestring required

The trigger price

quantitystring

Optional. Sets a partial stop order for this quantity of the position instead of the full position. Omit to close the full position when triggered.

Example request

{
  "market": "AAPL-USD.P",
  "positionDirection": "long",
  "type": "stopLoss",
  "triggerPrice": "9.00",
  "quantity": "0.5",
  "builderCode": {
    "code": "yourCode",
    "feeRateBps": 5,
    "feeRateBpsFractional": 2.5
  }
}

Response

Updated stop orders for the market

successboolean required

Whether the request was successful

errorstring

Error message, present only on failure

error_codestring

Semantic error code. See each endpoint's error responses for the specific codes it can return.

deprecatedstring

Deprecation notice, if applicable

Example response

{
  "success": true,
  "result": {
    "market": "AAPL-USD.P",
    "positionDirection": "long",
    "stopLoss": "8.00",
    "takeProfit": "9.00"
  }
}

Changes

    • info

      added the new optional request property

    • info

      added the new optional request property