Close Position

This section documents the close_position action

This action is used to close positions.

  • Positions will be closed immediately with a Market Order


Example Request

This example partially closes a long position on BTC using 50% of the current position size.

{
  "action": "close_position",
  "coin": "BTC",
  "is_buy": true,
  "size_pct": 0.5,
  "bot_id": BOT_ID,
  "api_key": "API_KEY"
}

coin*

This required parameter indicates which coin to use for the action.

"coin": "BTC"

You can whitelist coins allowed for trading in your Bot Settings


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


Sizes

3 size types are available to use: size, size_pct, size_usd.

size

This parameter indicates a size in contracts.

  • A value of 0.005 is equal to 0.005 BTC

"size": 0.005

size_usd

This parameter indicates a size in USD.

  • A value of 100 is equal to $100 USD

"size_usd": 100

size_pct

This parameter indicates a size in percentage of current position.

  • A value of 0.1 is equal to 10% of current position size

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

"size_pct": 0.1

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?