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
| Tool | What it does |
|---|---|
get_strategy | The strategy: id, name, type, status, and canTrade (true only while it is LIVE). |
get_balance | The strategy's non-zero balances, free and locked in open orders. The balance is virtual. |
get_price | The last traded price of a symbol. |
get_candles | Candlesticks, oldest first. Intervals from 1m to 1M; up to 500 rows (default 100). |
get_order_book | Bids and asks, best first: 5, 10, 20, 50 or 100 levels per side (default 20). |
list_symbols | Every pair the strategy can trade, all quoted in USDT. search narrows the list, for example ETH. |
get_symbol_rules | Tick size, step size, minimum and maximum quantity, minimum order value, and the order types Wellat executes for the symbol. |
list_open_orders | Open orders, for one symbol or all. |
get_order | One order by orderId or clientOrderId, with its fills so far. |
get_trades | The strategy's fills on a symbol, with fees; up to 500 (default 50). |
place_order | Places an order; see the order types below. |
cancel_order | Cancels one open order by orderId or clientOrderId. |
cancel_all_orders | Cancels every open order on one symbol. |
Spot order types
| Type | Fields |
|---|---|
MARKET | quantity, or on a BUY quoteOrderQty (the amount to spend in the quote asset) |
LIMIT | quantity and price |
STOP_LOSS | quantity and stopPrice: a market order once the last price reaches stopPrice |
STOP_LOSS_LIMIT | quantity, 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.
| Tool | What it does |
|---|---|
get_strategy | Same as Spot. |
get_balance | Wallet, 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_price | Last, mark and index price, the funding rate and the next funding time. |
get_candles | Same as Spot. |
get_order_book | Same as Spot. |
list_symbols | Every USDT perpetual the strategy can trade. search narrows the list. Some contracts are rescaled: 1000PEPEUSDT trades 1,000 PEPE per unit. |
get_symbol_rules | Same as Spot, plus the maximum leverage. |
list_open_orders | Open orders and open take-profit / stop-loss orders, for one symbol or all. |
get_order | One order, plain or take-profit / stop-loss, by orderId or clientOrderId. |
get_trades | Fills with realized PnL and fees; up to 500 (default 50). |
place_order | Places an order; see the order types below. |
cancel_order | Cancels one open order, plain or take-profit / stop-loss. |
cancel_all_orders | Cancels every open order and take-profit / stop-loss order on one symbol. Positions stay open. |
set_leverage | Sets the leverage for one symbol, capped at its maximum. It can't change while a position on the symbol is open. |
Futures order types
| Type | Fields |
|---|---|
MARKET | quantity |
LIMIT | quantity and price |
STOP_MARKET, TAKE_PROFIT_MARKET | triggerPrice. 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:
takeProfitPriceandstopLossPrice: 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.
Updated 6 days ago
Did this page help you?