PearPear

Close Position

Close an open basket, at market or over time.

Close one basket with POST /trade/:positionId/close (SDK: sdk.core.trade.close), or close every open basket on the account with POST /trade/close-all. A close reduces each leg by the basket's share of that asset, not the asset's global total on the exchange.

You can close at market or spread the close over time (TWAP), set in the request body. The result arrives over the WebSocket as position.closed. Exact fields live in @pear-protocol/types and the API Specification.