PearPear

Market Order

Open a basket immediately at market.

A market order opens the basket now, at the current market price, across every leg.

Use POST /trade/open with type: "MARKET".

Request

{
  "type": "MARKET",
  "legs": [
    { "symbol": "0", "side": "BUY",  "mode": "USD", "amount": "500" },
    { "symbol": "1", "side": "SELL", "mode": "USD", "amount": "500" }
  ],
  "clientId": "your-client-id"
}

With the SDK:

await sdk.core.trade.open({
  type: 'MARKET',
  legs: [
    { symbol: '0', side: 'BUY', mode: 'USD', amount: '500' },
    { symbol: '1', side: 'SELL', mode: 'USD', amount: '500' },
  ],
});

symbol is the instrument ID, not the ticker. See Instrument ID.

Sizing a leg

mode decides how the gateway reads amount:

modeamount meansUse it when
USDNotional in USD. Pear converts it to a quantity at execution time.You size the basket in dollars.
QUANTITYA quantity of the base asset.You size in coins, or you match an exact exposure.

Both take an unsigned decimal string. side sets the direction.

Size every leg above the venue's minimum order notional. Read that floor from GET /instruments as precision.notional.min. A USD leg is converted to a quantity at execution time, so a leg near the floor can still fall under it once converted.

Response

202 Accepted returns an execution with status IDLE:

{
  "execution": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "connector": "hyperliquid",
    "intent": "OPEN",
    "orderType": "MARKET",
    "status": "IDLE",
    "legs": [
      { "symbol": "0", "side": "BUY",  "mode": "USD", "amount": "500", "reduceOnly": false },
      { "symbol": "1", "side": "SELL", "mode": "USD", "amount": "500", "reduceOnly": false }
    ],
    "createdAt": "2026-01-01T00:00:00.000Z",
    "updatedAt": "2026-01-01T00:00:00.000Z"
  }
}
FieldMeaning
idExecution UUID. Use it with GET /executions/{id}.
intentOPEN for a new position, ADJUST when a position for these instruments already exists.
statusStarts at IDLE, then ACTIVE, then COMPLETED, FAILED, or CANCELLED.
legsThe legs you sent, with reduceOnly: false added.

There is no orders array in this response. No venue order exists yet. Orders appear on a later GET /executions/{id}, each with its own status, price, and filledQuantity.

If a position for the same instruments is already open, the response comes back with intent: "ADJUST" and an extra position object. See Basket Trade for that shape.

The fill and resulting position arrive over the WebSocket as execution.completed, then position.created. Poll GET /executions/{id} if you cannot hold a socket open.

To set leverage before you open, call PUT /leverage for each instrument. Leverage is an account setting, not a field on the trade. Every connector except Bybit requires marginMode in that body, see Set leverage.

On this page