PearPear
API IntegrationExecuting Trade

Basket Trade

Open a multi-leg basket in a single call.

A basket has one or more long legs and one or more short legs, each with a weight within its side. You open the whole basket with a single POST /trade/open, scoped to a connected trade account.

Each leg references an instrument on the trade account's exchange (resolve symbols with GET /instruments). Weights set each leg's share of its side; a basket's direction, not its absolute price, is what you trade.

With the SDK:

await sdk.core.trade.open(body); // body: HttpTypes.CreateTradeOpen

The call returns an execution acknowledgement; watch the WebSocket for the fill and the resulting position. Opening the same basket again adjusts the existing position rather than creating a second one.

The exact request shape (legs, weights, sizing, leverage, slippage, and execution style) is defined by @pear-protocol/types (CreateTradeOpen) and the API Specification.