Open Position
This section documents the open_position action
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.
is_buy*
This required parameter indicates the direction to open the trade.
Truewill open a Long positionFalsewill open a Short position
Sizes*
size
This parameter indicates a size in contracts.
A value of
0.005is equal to0.005 BTC
size_usd
This parameter indicates a size in USD.
A value of
100is equal to$100 USD
size_pct
This parameter indicates a size in percentage of available balance.
A value of
0.1is equal to10%of account balance
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
These parameters allows you to add position take-profit and stop-loss orders.
sl_pct
This parameter indicates the % from entry to place your stop-loss.
A value of
0.01is equal to a1% stop-loss
tp_pct
This parameter indicates the % from entry to place your take-profit.
A value of
0.01is equal to a1% take-profit
sl
This parameter indicates a direct price to place your stop-loss.
tp
This parameter indicates a direct price to place your take-profit.
Multiple Take-Profit & Stop-Loss
These parameters allows you to place multiple take-profit and stop-loss orders.
tps
This parameter allows you to place multiple take-profit orders.
You can specify TPs using a percentage from entry or a direct price:
A
tp_pctvalue of0.01is equal to a1% take-profitA
tpvalue of120500indicates adirect priceto place your take-profit.
A
size_pctvalue of0.5will close50%of your order
sls
This parameter allows you to place multiple stop-loss orders.
You can specify SLs using a percentage from entry or a direct price:
A
sl_pctvalue of0.01is equal to a1% stop-lossA
slvalue of120500indicates adirect priceto place your stop-loss.
A
size_pctvalue of1will close100%of your order
slippage_pct
This parameter indicates the Max. % slippage allowed for the trade to execute.
A value of
0.05is equal to5%
delay
This parameter indicates a number of seconds to wait before triggering the action.
A value of
5is equal to a5 secondsdelayMax. allowed delay is
10 seconds
Last updated
Was this helpful?