API Integration
Executing Trade
Open pair and basket trades across venues, and choose how they execute.
A trade on Pear is a basket: one or more long legs and one or more short legs, each with a weight. You open the whole basket in a single call, scoped to a connected trade account.
Open a trade
POST /trade/open opens (or adjusts) a basket. With the SDK:
await sdk.core.trade.open(body); // returns an execution acknowledgementOpening the same basket again adjusts the existing position rather than creating a second one.
Execution is asynchronous
/trade/open returns immediately with an execution whose status starts at IDLE. The fill and resulting position arrive over the WebSocket (execution.completed, then position.created / position.updated), not in the HTTP response. See Error Handling.
Execution styles
Choose how the basket fills:
| Style | Endpoint | Behaviour |
|---|---|---|
| Market | POST /trade/open | Fill now, at market. |
| Trigger | POST /triggers/open | Open when a price or ratio condition is met. |
| TWAP | POST /schedules | Split the order into timed chunks. |
| Ladder | POST /ladders | Stagger entries across a ratio range. |
Once open, see Managing Open Position and Managing Open Order.