Skip to main content
POST
Close Position
Close an existing position using a reduce-only order. The router mirrors the behaviour of the open endpoint—scanning all supported venues for the best exit price unless you force a specific exchange.

Features

  • Reduce-only safety: Guarantees the API only decreases exposure
  • Smart venue selection: Routes exits to the venue with the best available price
  • Partial or full closes: Specify any size up to the total position
  • Consistent payloads: Response structure matches the open position endpoint for easy reconciliation

Use Cases

  • Automate take-profit or stop-loss workflows across multiple exchanges
  • Build UI flows for one-click position unwinds
  • Implement partial de-risking strategies using precise quantities
  • Maintain audit trails with routing and execution metadata in a single response

Request

  • Method: POST
  • Endpoint: /api/trade/position/close
  • Authentication: Required

Request Fields

The response mirrors the Open Position endpoint, returning execution, routing, and position data so you can reconcile final fills.

Usage Tips

  • Reduce-only semantics ensure the API never increases exposure while closing.
  • Provide credentials only for venues you wish to use; missing credentials remove that venue from routing consideration.
  • For partial closes, set size to the exact quantity you want to reduce.
Combine /api/trade/position/open and /api/trade/position/close in your workflow to ladder into and out of positions while keeping routing logic centralized.

Hyperliquid - Close Single Position

Close a specific open position for a given symbol on Hyperliquid.

Endpoint

POST /api/hyperliquid/:walletId/positions/close/:symbol

Path Parameters

Headers

Request Body

Request Parameters

Example Request

Success Response


Hyperliquid - Close All Positions

Close all open positions for the wallet on Hyperliquid.

Endpoint

POST /api/hyperliquid/:walletId/positions/close-all

Path Parameters

Headers

Request Body

Same schema as close-single-symbol.

Example Request

Success Response


Aster - Close Position

Close positions on Aster exchange with a single API call.

Endpoint

POST /api/aster/perp/:walletId/close-position

Path Parameters

Request Body

Optional - Close specific side:

Request Parameters

Example Request

Success Response


Avantis - Close Position (Client-Side Execution)

Avantis positions are closed client-side via on-chain transactions on the Base network. Like opening, closing is not routed through the Tide backend.
Avantis close execution uses client-side wallet signing via the useAvantisTrade React hook. Supports both full and partial closes.

Close by Pair and Trade Index

Close by Symbol and Direction

Request Parameters

Close by Symbol Parameters

The close operation uses initialPosToken (not positionSizeUSDC) for the collateral amount, read from TradingStorage.openTrades() on-chain.

Authorizations

X-API-KEY
string
header
required

API key for authentication. Also requires X-API-SECRET, X-API-TIMESTAMP, and X-API-SIGNATURE headers for private endpoints.

Body

application/json
symbol
string
required

Asset symbol being closed

direction
enum<string>
required
Available options:
LONG,
SHORT
size
string
required

Quantity to close

credentials
object
required
orderType
enum<string>
Available options:
LIMIT,
MARKET,
STOP_MARKET,
STOP_LIMIT
limitPrice
string

Required when orderType is LIMIT

preferredExchange
enum<string>
Available options:
hyperliquid,
aster,
lighter,
pacifica

Response

200 - application/json

Position closed successfully

success
boolean
data
object