Stop Market Order

This section documents the stop_market_order action

This action is used to create a Stop Market Order.

  • Order will be triggered at the specified price using a market order

  • This action can be used for both opening and closing positions (including adding/reducing size)


Example Request

This example will open a long position on BTC at a price of 100,000 using a size of $100 USD

{
  "action": "stop_market_order", 
  "coin": "BTC",
  "is_buy": true,
  "price": 100000,
  "size_usd": 100,
  "reduce_only": false,
  "bot_id": BOT_ID,
  "api_key": "API_KEY"
}

This example will close a long position on BTC at a price of 105,000 using 100% of current position size

{
  "action": "stop_market_order", 
  "coin": "BTC",
  "is_buy": false,
  "price": 105000,
  "size_pct": 1,
  "reduce_only": true,
  "bot_id": BOT_ID,
  "api_key": "API_KEY"
}

coin*

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

You can whitelist coins allowed for trading in your Bot Settings


is_buy*

This required parameter indicates the direction of the trade.

  • True can open a Long position or close a Short position

  • False can open a Short position or close a Long position


reduce_only*

This required parameter indicates whether the order is allowed to only reduce position size or not.

  • A value of true will only allow closing/reducing position

  • A value of false will allow both opening and closing position


price*

This required parameter indicates the price to trigger the order

  • A value of 105000 places a stop market order at the price 105,000

Price must be above current coin price for long positions, and below for short positions. To achieve this behavior you can use the Limit Order action instead.


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_usd

This parameter indicates a size in USD.

  • A value of 100 is equal to $100 USD

size_pct

This parameter indicates either a size in percentage of available balance when opening an order, or a size in percentage of current position when closing an order.

  • A value of 0.1 is equal to 10%

  • When opening an order (reduce_only=false), a size_pct of 0.1 means 10% of available account balance

  • When closing an order (reduce_only=true), a size_pct of 0.1 means 10% of current position size


slippage_pct

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

  • A value of 0.05 is equal to 5%

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

Last updated

Was this helpful?