Close All

This section documents the close_all action

This action is used to close all open Perps positions in your account.

  • Only whitelisted coins (if any) in your bot settings will be affected.

  • This action will not sell Spot coins, use the Sell All action instead


Example Request

This example closes all open positions.

{
  "action": "close_all",
  "bot_id": BOT_ID,
  "api_key": "API_KEY"
}

is_buy

This parameter indicates the position's direction to close.

  • True will close only Long positions

  • False will close only Short positions

"is_buy": true

Defaults to closing both long and short positions when not specified


coins

This parameter indicates a list of coins to use for the action.

"coins": ["BTC", "ETH", "HYPE", "xyz:XYZ100"]

Omitting this field will apply the action to all coins


size_pct

This parameter indicates the position's size percentage to close.

  • A value of 0.5 is equal to 50% of every position size

  • Max. allowed value is 1 (100% of position size)

"size_pct": 0.5

Defaults to 1 when not specified


dexs

This parameter indicates which dexs to use for the action.

  • e.g targeting the xyz dex:

"dexs": ["xyz"]
  • e.g targeting both hyperliquid and xyz dexs:

"dexs": ["hyperliquid","xyz"]

Omitting this field will apply the action to all available dexs


slippage_pct

This parameter indicates the Max. % slippage allowed for the trade to execute.

  • A value of 0.05 is equal to 5%

"slippage_pct": 0.05

Defaults to 5% when not specified


delay

This parameter indicates a number of seconds to wait before triggering the action.

  • A value of 5 is equal to a 5 seconds delay

  • Max. allowed delay is 10 seconds

"delay": 5

Last updated

Was this helpful?