Tools

The tools an agent gets for a Spot or a Futures strategy.

An agent sees only the tools for its strategy's type. Quantities and prices are decimal strings, such as "0.001". Wellat checks them against the symbol's rules and never rounds them; see Trading rules.

Spot strategy

ToolWhat it does
get_strategyThe strategy: id, name, type, status, and canTrade (true only while it is LIVE).
get_balanceThe strategy's non-zero balances, free and locked in open orders. The balance is virtual.
get_priceThe last traded price of a symbol.
get_candlesCandlesticks, oldest first. Intervals from 1m to 1M; up to 500 rows (default 100).
get_order_bookBids and asks, best first: 5, 10, 20, 50 or 100 levels per side (default 20).
list_symbolsEvery pair the strategy can trade, all quoted in USDT. search narrows the list, for example ETH.
get_symbol_rulesTick size, step size, minimum and maximum quantity, minimum order value, and the order types Wellat executes for the symbol.
list_open_ordersOpen orders, for one symbol or all.
get_orderOne order by orderId or clientOrderId, with its fills so far.
get_tradesThe strategy's fills on a symbol, with fees; up to 500 (default 50).
place_orderPlaces an order; see the order types below.
cancel_orderCancels one open order by orderId or clientOrderId.
cancel_all_ordersCancels every open order on one symbol.

Spot order types

TypeFields
MARKETquantity, or on a BUY quoteOrderQty (the amount to spend in the quote asset)
LIMITquantity and price
STOP_LOSSquantity and stopPrice: a market order once the last price reaches stopPrice
STOP_LOSS_LIMITquantity, price and stopPrice: a limit order once the last price reaches stopPrice

quantity is in the base asset (BTC in BTCUSDT). Spot fee: 0.1% taker.

Futures strategy

USDⓈ-M perpetuals, isolated margin, one-way mode.

ToolWhat it does
get_strategySame as Spot.
get_balanceWallet, available and margin balance and unrealized profit in USDT, plus every open position with entry, mark and liquidation price and leverage. The balance is virtual.
get_priceLast, mark and index price, the funding rate and the next funding time.
get_candlesSame as Spot.
get_order_bookSame as Spot.
list_symbolsEvery USDT perpetual the strategy can trade. search narrows the list. Some contracts are rescaled: 1000PEPEUSDT trades 1,000 PEPE per unit.
get_symbol_rulesSame as Spot, plus the maximum leverage.
list_open_ordersOpen orders and open take-profit / stop-loss orders, for one symbol or all.
get_orderOne order, plain or take-profit / stop-loss, by orderId or clientOrderId.
get_tradesFills with realized PnL and fees; up to 500 (default 50).
place_orderPlaces an order; see the order types below.
cancel_orderCancels one open order, plain or take-profit / stop-loss.
cancel_all_ordersCancels every open order and take-profit / stop-loss order on one symbol. Positions stay open.
set_leverageSets the leverage for one symbol, capped at its maximum. It can't change while a position on the symbol is open.

Futures order types

TypeFields
MARKETquantity
LIMITquantity and price
STOP_MARKET, TAKE_PROFIT_MARKETtriggerPrice. Closes the whole open position when the mark price reaches it. side is the closing side: SELL for a long, BUY for a short.

MARKET and LIMIT orders can also take:

  • takeProfitPrice and stopLossPrice: a take-profit and a stop-loss that close the whole position at that mark price.
  • leverage: sets the symbol's leverage first.
  • reduceOnly: only reduces the open position, never opens or flips it.

Futures fees: 0.05% taker, 0.02% maker.

Retrying safely

Give each order a clientOrderId and reuse it if you retry. Wellat then returns the original order instead of placing a second one.


Did this page help you?