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*
  • Sizes
  • size
  • size_usd
  • size_pct
  • Take Profit & Stop Loss
  • sl_pct
  • tp_pct
  • sl
  • tp
  • slippage_pct
  • delay

Was this helpful?

  1. API
  2. Actions

Open Position

This section documents the open_position action

This action is used to open new positions.

  • Positions will be opened immediately with a Market Order

  • This action can only be used to open a new position or to switch direction (can't be used for adding/reducing size)

  • This action will close previous positions automatically when switching direction (long>short | short>long)


Example Request

This example opens a long position on BTC using a size of 10% of available balance, with 1% stop-loss and 2% take-profit.

{
  "action": "open_position", 
  "coin": "BTC",
  "is_buy": true,
  "size_pct": 0.1,
  "sl_pct": 0.01,
  "tp_pct": 0.02,
  "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 to open the trade.

  • True will open a Long position

  • False will open a Short position

"is_buy": true

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 a size % of available balance to use when opening an order

  • A value of 0.1 is equal to 10% of account balance

"size_pct": 0.1

i.e. You have $1,000 USD in your account and open a position with 10% of your balance:

  • A new position will be opened with a size of $100 USD

  • This size is not affected by leverage, the position size will be $100 for both 1x or 10x leverage

  • Leverage only changes the % of margin used, not the position size.

  • *At 10x leverage, you can send a max. size_pct of 10 (1000%), which in this example would result in a total position size of $10,000 USD


Take Profit & Stop Loss

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

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

Default slippage is set at 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
PreviousActionsNextClose Position

Last updated 1 month ago

Was this helpful?

You can whitelist coins allowed for trading in your

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
Modify TP/SL
Cancel TP/SL