Katoshi Docs
  • Welcome
  • APP
    • Bots
      • Bot Creation
      • Bot Activation
      • Bot Settings
    • Strategies
      • Strategy Creation
      • Strategy Overview
      • Strategy Settings
      • Strategy Monetization
    • Portfolio
    • Terminal
    • Pricing
    • Alerts
    • Settings
  • API
    • Getting Started
    • Actions
      • Open Position
      • Close Position
      • Market Order
      • Limit Order
      • Stop Market Order
      • Scale Order
      • Modify TP/SL
      • Cancel TP/SL
      • Cancel Order
      • Close All
      • Cancel All
      • Clear All
      • Sell All
      • Set Leverage
      • Start Bot
      • Stop Bot
  • MCP
    • Introduction
    • Quickstart
    • Tools
    • Katoshi Agent Bot
  • Integrations
    • TradingView
Powered by GitBook
On this page
  • Example Request
  • coin*
  • is_buy*
  • reduce_only*
  • price*
  • Sizes
  • size
  • size_usd
  • size_pct
  • Take Profit & Stop Loss
  • sl_pct
  • tp_pct
  • sl
  • tp
  • delay

Was this helpful?

  1. API
  2. Actions

Limit Order

This section documents the limit_order action

This action is used to create a Limit Order.

  • Order will be placed at a specified price using a limit order

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

  • Limit orders are using the ALO order type, ensuring all orders are resting in the order book (Maker fees)

  • Some parameters are only available for Perps


Example Request

This example will open a long position on BTC at a price of 100,000 using a size of $100 USD, with 1% stop-loss and 2% take-profit

{
  "action": "limit_order", 
  "coin": "BTC",
  "is_buy": true,
  "price": 100000,
  "size_usd": 100,
  "sl_pct": 0.01,
  "tp_pct": 0.02,
  "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": "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.

"coin": "BTC"

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

"is_buy": true

reduce_only*

This parameter is only available for Perps.

This required parameter indicates whether an order should only be used to close an existing position (true) or for both opening and closing/reducing positions. (false)

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

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

"reduce_ony": true

price*

This required parameter indicates the price to place the order

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

"price": 105000

Sizes

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

size

This parameter indicates a size in contracts to use for the trade.

  • A value of 0.005 is equal to 0.005 BTC (requested coin)

"size": 0.005

size_usd

This parameter indicates a size in USD to use for the trade

  • A value of 100 is equal to $100 USD

"size_usd": 100

size_pct

This parameter indicates either a size % of available balance to use when opening an order, or a size % of the current position when closing an order.

  • A value of 0.1 is equal to 10%

"size_pct": 0.1
  • 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


Take Profit & Stop Loss

Stop losses and take profits are only available for Perps.

Stop-loss and take-profit uses Stop Market orders that will trigger when reaching the specified price.

  • Setting TP/SL when adding size to an existing position will place additional Normal TP/SL orders. Normal TP/SL will close only the size that was added to the position when triggered.

sl_pct

This parameter indicates the % from entry to place your stop-loss.

  • A value of 0.01 is equal to a 1% stop-loss

"sl_pct": 0.01

tp_pct

This parameter indicates the % from entry to place your take-profit.

  • A value of 0.01 is equal to a 1% take-profit

"tp_pct": 0.01

sl

This parameter indicates a direct price to place your stop-loss.

"sl": 62500

tp

This parameter indicates a direct price to place your take-profit.

"tp": 72500

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
PreviousMarket OrderNextStop Market Order

Last updated 1 month ago

Was this helpful?

You can whitelist coins allowed for trading in your

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

Setting TP/SL when opening new positions (or switching direction) will create Main TP/SL that can be updated by using the action, or canceled using the action. Main TP/SL will close the entire position when triggered.

Bot Settings
Stop Market Order
Modify TP/SL
Cancel TP/SL