API ReferenceWebSocket APITrade Actions
WS Action: Open
Open positions 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: open
Open new positions. The payload mirrors POST /v1/exchange/open.
Headers (in envelope)
| Header | Required | Description |
|---|---|---|
X-Trader-Address | Yes | Trader wallet address. |
X-API-Key | No | Delegated mode (delegate wallet must be verified). |
Payload
| Field | Type | Required | Description |
|---|---|---|---|
open | Open | Yes | The open action. |
sp | number | No | Slippage percentage (0-100). Default 0.25. Only applies to market orders — ignored for limit and stop (hardcoded to 0). |
bd | BuilderConfig | No | Optional builder fee configuration. |
Open
| Field | Type | Required | Description |
|---|---|---|---|
a | number | Yes | Pair index. |
b | boolean | Yes | Direction: true = long, false = short. |
t | string | Yes | Open type: market, limit, stop. |
p | string | Yes | Price as numeric string (> 0). |
s | string | Yes | Collateral in USD (min 5). |
l | string | Yes | Leverage as numeric string (>= 1). |
tp | string | No | Take-profit price ("0" resets to default). |
sl | string | No | Stop-loss price ("0" resets to default). |
BuilderConfig
| Field | Type | Required | Description |
|---|---|---|---|
b | string | Yes | Builder address (0x...). |
f | number | Yes | Fee percentage (0-0.5). |
Constraints
- Same as POST /v1/exchange/open.
Success Data (unsigned)
| Field | Type | Required | Description |
|---|---|---|---|
transactions | UnsignedTransaction[] | Yes | One unsigned transaction. |
Delegated mode returns { "txHash", "smartAccountAddress" } as described in
/docs/websocket/trade-actions.
Example
{
"id": "1",
"action": "open",
"headers": { "X-Trader-Address": "0xYourWallet" },
"payload": {
"open": {"a":0,"b":true,"p":"42500","s":"100","l":"10","t":"market"},
"sp": 0.25
}
}Success Response (unsigned)
{
"id": "1",
"ok": true,
"data": {
"transactions": [
{ "to": "0x...", "data": "0x...", "value": "0", "from": "0xYourWallet" }
]
}
}Related
See /docs/http/exchange/open for HTTP details.