Appearance
Account Channel
wss://api.valr.com/ws/accountThe Account WebSocket channel provides real-time updates about your VALR account and supports low-latency order placement commands.
Authentication
The Account channel requires authentication. You can authenticate using either method:
Connection Headers
Authentication is performed by passing HTTP headers during the WebSocket handshake. The following headers are required:
| Header | Description |
|---|---|
X-VALR-API-KEY | Your API key |
X-VALR-SIGNATURE | HMAC-SHA512 signature (see below) |
X-VALR-TIMESTAMP | Current Unix timestamp in milliseconds |
The signature is computed as:
Signature = HMAC-SHA512(API_SECRET, TIMESTAMP + "GET" + "/ws/account")Connection example:
javascript
const WebSocket = require('ws');
const headers = {
'X-VALR-API-KEY': 'YOUR_API_KEY',
'X-VALR-SIGNATURE': 'COMPUTED_SIGNATURE',
'X-VALR-TIMESTAMP': Date.now().toString()
};
const ws = new WebSocket('wss://api.valr.com/ws/account', { headers });In-band Authentication
Connect first, then send an AUTHENTICATE message:
json
{
"type": "AUTHENTICATE",
"payload": {
"apiKey": "YOUR_API_KEY",
"signature": "SIGNATURE",
"timestamp": 1234567890123
}
}Events (Server to Client)
The following events are sent from the server to your client. Some are delivered automatically upon connection, while others require an explicit subscription.
Auto-subscribed Events
These events are sent automatically once you are authenticated:
| Event | Description |
|---|---|
BALANCE_UPDATE | Balance changes for any currency |
OPEN_ORDERS_UPDATE | Changes to your open orders |
ORDER_PROCESSED | Order processing results |
FAILED_ORDER | Failed order placement |
FAILED_CANCEL_ORDER | Failed order cancellation |
NEW_ACCOUNT_TRADE | Trades on your account (order book only) |
NEW_ACCOUNT_HISTORY_RECORD | Transaction history records |
INSTANT_ORDER_COMPLETED | Completed simple buy/sell orders |
NEW_PENDING_RECEIVE | Pending cryptocurrency deposits |
NEW_PENDING_SEND | Pending cryptocurrency withdrawals |
SEND_STATUS_UPDATE | Withdrawal status updates |
Subscription-required Events
These events must be explicitly subscribed to:
| Event | Description |
|---|---|
ORDER_STATUS_UPDATE | Order status change notifications |
To subscribe:
json
{
"type": "SUBSCRIBE",
"subscriptions": [
{ "event": "ORDER_STATUS_UPDATE" }
]
}Commands (Client to Server)
You can send the following commands through the WebSocket connection for lower-latency order management:
| Command | Description |
|---|---|
PLACE_LIMIT_ORDER | Place a limit order |
PLACE_MARKET_ORDER | Place a market order |
CANCEL_ORDER | Cancel an open order |
MODIFY_ORDER | Modify an existing order |
PLACE_BATCH_ORDERS | Place multiple orders in a batch |
All commands follow this request format:
json
{
"type": "COMMAND_TYPE",
"clientMsgId": "unique-correlation-id",
"payload": { ... }
}The clientMsgId field is optional but recommended for correlating responses to requests.
Message Format
All server-to-client messages use this envelope structure:
json
{
"type": "EVENT_TYPE",
"data": { ... }
}For full payload schemas, see the individual operation pages in the sidebar.