WebSocket API
WebSocket API for real-time trading operations and execution reports.
Connection Endpoint
Testnet: wss://api.app.hello.trade/ws
Mainnet: N/A
Message Format
All messages use JSON with a type field discriminator.
Request:
{
"type": "authenticate",
...
}Response:
{
"type": "authenticateSuccess",
...
}Connection Flow
Connect to WebSocket endpoint
Authenticate with EIP-191 signature
Subscribe to trading stream (optional, required for execution reports)
Trade (place, cancel, replace orders)
Logout or disconnect when done
Authentication
Connections must authenticate before performing trading operations. See Authentication & Account Model for details.
Request:
Success Response:
For signature construction, see Signatures - EIP-191 Operations.
Connection Limits
Max connections per account
8
Idle timeout
30 seconds
Ping interval
15 seconds
Connections exceeding idle timeout are automatically disconnected. Maintain connection by:
Responding to ping frames
Sending requests
Rate Limiting
Maximum request rate: 20 requests/second per wallet (rolling 1-second window, orders included). Applies to wallet-authenticated requests; unauthenticated reads are limited per client IP — see Nonce & Rate Limits.
See Nonce & Rate Limits for details.
Error Responses
All errors use the same format:
For complete error code reference, see Error Codes.
Message Types
Connection Management
authenticate
Authenticate connection with wallet
No
logout
Clear authentication state
Yes
subscribeTrading
Subscribe to execution reports
Yes
See Connection Management for details.
Trading Operations
placeOrder
Place new order
Yes
replaceOrder
Atomically replace existing order
Yes
cancelOrder
Cancel order by ID
Yes
cancelAll
Cancel all orders (optionally by instrument)
Yes
transferMargin
Transfer collateral between cross and isolated margin
Yes
See Trading Operations for details.
Execution Reports
After subscribing to the trading stream, execution reports are automatically pushed for:
Order status changes (new, filled, cancelled, etc.)
Trade executions
Account events (deposits, withdrawals, margin transfers, leverage updates, liquidations)
See Execution Reports for details.
Liquidation Auction
manualLiquidationOffer
Gateway → Client
Broadcast of a position open for claim during liquidation
Yes (subscribed)
claimLiquidation
Client → Gateway
Claim an open offer with a signed order
Yes
claimLiquidationAccepted
Gateway → Client
Ack that a claim entered the auction
Yes
claimLiquidationResult
Gateway → Client
Terminal win/lose outcome sent to each accepted claimant after the auction resolves
Yes
See Liquidation Auction for details.
Account Summary Stream
subscribeAccountSummary
Client → Gateway
Subscribe to account summary updates (margin, positions, withdrawable)
Yes
unsubscribeAccountSummary
Client → Gateway
Stop receiving account summary updates
Yes
accountSummary
Gateway → Client
Snapshot (on subscribe), then a full snapshot on each position/margin/balance change (fills, busts, liquidations, funding, leverage, deposit/withdraw)
Yes (subscribed)
Independent of subscribeTrading. See Account Summary Stream for details.
WebSocket vs REST
Place/Cancel/Replace Orders
✓
-
Real-time Execution Reports
✓
-
Deposit/Withdraw Margin
-
✓
Update Leverage
-
✓
Account Summary
✓ (stream)
✓ (snapshot)
Historical Orders/Trades
-
✓
For REST API operations, see REST API.
Last updated