Skip to main content

Trade Tools

Tools for order management. Requires trade or full permission mode for write operations.

warning

Trade tools interact with real orders. Always test on testnet first.

Read-only

get_open_orders

Query unfilled or partially filled orders.

Parameters:

NameTypeRequiredDescription
categorystringYesspot, linear, inverse, option
symbolstringNoTrading pair
baseCoinstringNoBase coin (linear/inverse only)
orderIdstringNoOrder ID
orderLinkIdstringNoUser custom order ID
limitintNoMax 50, default 20
cursorstringNoPagination cursor

get_order_history

Query past order history.

Parameters:

NameTypeRequiredDescription
categorystringYesspot, linear, inverse, option
symbolstringNoTrading pair
orderIdstringNoOrder ID
orderLinkIdstringNoUser custom order ID
orderStatusstringNoNew, PartiallyFilled, Filled, Cancelled, etc.
limitintNoMax 50, default 20
cursorstringNoPagination cursor

get_trade_history

Query trade execution history.

Parameters:

NameTypeRequiredDescription
categorystringYesspot, linear, inverse, option
symbolstringNoTrading pair
orderIdstringNoOrder ID
startTimeintNoStart timestamp (ms)
endTimeintNoEnd timestamp (ms)
limitintNoMax 100, default 50
cursorstringNoPagination cursor

Write (requires confirmation)

The following tools use the confirmation flow: the server returns an order summary with a confirmation_id first. The AI must call confirm_order with that ID to execute.

place_order

Create a new order. HIGH risk — requires confirmation.

Parameters:

NameTypeRequiredDescription
categorystringYesspot, linear, inverse, option
symbolstringYesTrading pair (e.g. BTCUSDT)
sidestringYesBuy or Sell
orderTypestringYesMarket or Limit
qtystringYesOrder quantity
pricestringNoRequired for Limit orders
timeInForcestringNoGTC, IOC, FOK, PostOnly
orderLinkIdstringNoUser custom order ID
reduceOnlyboolNotrue = close position only
takeProfitstringNoTake profit price
stopLossstringNoStop loss price

Example prompt: "Buy 0.01 BTC at market price"


amend_order

Modify an existing order. HIGH risk — requires confirmation.

Parameters:

NameTypeRequiredDescription
categorystringYesProduct type
symbolstringYesTrading pair
orderIdstringNoOrder ID (either this or orderLinkId)
orderLinkIdstringNoUser custom order ID
qtystringNoNew quantity
pricestringNoNew price
triggerPricestringNoNew trigger price
takeProfitstringNoNew take profit price
stopLossstringNoNew stop loss price

cancel_all_orders

Cancel all open orders for a category. HIGH risk — requires confirmation.

Parameters:

NameTypeRequiredDescription
categorystringYesProduct type
symbolstringNoSpecific symbol (cancels all if omitted)
baseCoinstringNoBase coin
settleCoinstringNoSettle coin

Write (no confirmation)

cancel_order

Cancel a single order. MEDIUM risk — no confirmation required.

Parameters:

NameTypeRequiredDescription
categorystringYesProduct type
symbolstringYesTrading pair
orderIdstringNoOrder ID (either this or orderLinkId)
orderLinkIdstringNoUser custom order ID

confirm_order

Execute a previously confirmed order. This is a cross-cutting tool registered at the server level.

Parameters:

NameTypeRequiredDescription
confirmation_idstringYesUUID returned from a HIGH-risk tool

Confirmations expire after 5 minutes.