WebSocket
Get Balances
Returns information about the user allocated and available balances.
Auth:API Key
Tags:
Funding
Account
Command Name
GetBalancesCommand Arguments
| Field | Type | Required | Description |
|---|---|---|---|
ClientId | string | Required | Custom client ID for tracking (max 36 characters) Example: "my-client-123" |
ClientIdRequired
Type:
string
Description:
Custom client ID for tracking (max 36 characters)
Example:
"my-client-123"Command Invocation
Command Arguments Example:
[
"my-client-123"
]Invocation Example:
connection.invoke('GetBalances', 'my-client-123')Response Event
Event Name
executionEventsSubject
account.balances.snapshotBalances snapshot response containing user balance information
| Field | Type | Description |
|---|---|---|
userId | string | User ID |
sequence | number | Sequential number for tracking balance updates |
assets | array | Array of asset balance objects |
assets[].name | string | Asset name/symbol (e.g., BTC, ETH, USDT) |
assets[].available | number | Available balance for the asset |
assets[].allocated | number | Allocated balance for the asset |
assets[].currentExposure | number | Current exposure for the asset |
assets[].maxExposure | number | Maximum allowed exposure for the asset |
baseCurrency | string | Base currency for exposure calculations |
totalCurrentExposure | number | Total current exposure across all assets |
totalMaxExposure | number | Total maximum exposure limit |
deleted | boolean | Deleted flag |
Example Response
{
"data": {
"userId": "user-123",
"sequence": 123,
"assets": [
{
"name": "BTC",
"available": 0.5,
"allocated": 0,
"currentExposure": 0,
"maxExposure": 1500
},
{
"name": "ETH",
"available": 5,
"allocated": 0,
"currentExposure": 0,
"maxExposure": 1500
},
{
"name": "USDT",
"available": 1000,
"allocated": 250,
"currentExposure": 0,
"maxExposure": 1500
}
],
"baseCurrency": "EUR",
"totalCurrentExposure": 1430,
"totalMaxExposure": 1500,
"deleted": false
}
}Code Examples
const signalR = require('@microsoft/signalr');
const apiKey = 'YOUR_API_KEY_HERE';
const connection = new signalR.HubConnectionBuilder()
.withUrl('https://publicapi.sandbox.hercle.financial/ExecutionLiveServer/v1', {
accessTokenFactory: () => apiKey,
})
.build();
connection.start()
.then(() => {
console.log('Connected to WebSocket');
// Invoke command
connection.invoke('GetBalances', "my-client-123")
.then(() => {
console.log('Command sent successfully');
})
.catch(err => {
console.error('Command failed:', err);
});
})
.catch(err => {
console.error('Connection failed:', err);
});
// Listen for events
connection.on('executionEvents', (data) => {
console.log('Received event:', data);
});SignalR API Tester
Test this command in the sandbox environment
Disconnected
Your API key is only used locally and never stored