OstiumBuilder Service
API ReferenceWebSocket APITrade Actions

WS Action: Margin

Update isolated margin via WebSocket.

Alpha Version

The Ostium Builder Service is in Alpha. API endpoints, specifications, and builder URLs may change without notice. Use with caution in production environments.

Action: margin

Adjust isolated margin on an open position. The payload mirrors POST /v1/exchange/margin.

Headers (in envelope)

HeaderRequiredDescription
X-Trader-AddressYesTrader wallet address.
X-API-KeyNoDelegated mode (delegate wallet must be verified).

Payload

FieldTypeRequiredDescription
anumberYesPair index.
inumberYesTrade index.
amountstringYesUSD amount (positive adds, negative removes). Must be non-zero.

Constraints

  • amount must be non-zero.
  • Delegated mode supports one margin update per request.

Success Data (unsigned)

FieldTypeRequiredDescription
transactionsUnsignedTransaction[]YesOne unsigned transaction.

Delegated mode returns { "txHash", "smartAccountAddress" } as described in /docs/websocket/trade-actions.

Example

{
  "id": "5",
  "action": "margin",
  "headers": { "X-Trader-Address": "0xYourWallet" },
  "payload": { "a": 0, "i": 0, "amount": "50" }
}

Success Response (unsigned)

{
  "id": "5",
  "ok": true,
  "data": {
    "transactions": [
      { "to": "0x...", "data": "0x...", "value": "0", "from": "0xYourWallet" }
    ]
  }
}

See /docs/http/exchange/margin for HTTP details.

On this page