Skip to main content
Glama

Close a position

close_position

Close all or part of an open perpetual position with a reduce-only MARKET order. Reads the current position, flips the side automatically (LONG→SELL, SHORT→BUY) and sizes the close. percent defaults to 100 (full close); a partial close is floored to the market step size. The close is bounded at oracle ± slippageBps mirrored by side (closing a SHORT buys up to oracle×(1+slip), closing a LONG sells down to oracle×(1−slip); default 500 bps = 5%). Returns the verified confirmation outcome — if it is unfilled or partially_filled, the book was thinner than the cap: re-run with a larger slippageBps to sweep deeper. Errors NOT_FOUND if there is no open position in the market.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
marketYesMarket ticker, e.g. BTC-USD
confirmNo
percentNoPortion of the position to close (default 100).
slippageBpsNoMax slippage vs oracle, in bps (default 500). Raise to sweep a thin book.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / market / pattern
      Added value: +"^[A-Z0-9]{1,20}-[A-Z0-9]{1,20}$"
  2. Changed1 schema field changed
    • changedInput schema / properties / slippageBps / description
      Previous value: -"Max slippage vs oracle, in bps"New value: +"Max slippage vs oracle, in bps (default 500). Raise to sweep a thin book."
  3. Added

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources