WebSocket
Get Trades Paginated
Retrieves a paginated list of trades within a 7 days range.
Auth:API Key
Tags:
Trading
Command Name
GetTradesPaginatedCommand Arguments
| Field | Type | Required | Description |
|---|---|---|---|
ClientId | string | Required | Custom client ID for tracking (max 36 characters) Example: "my-order-123" |
StartDate | string | Required | Start date for the orders retrieval (ISO 8601 format) Example: "2024-04-20T00:00:00Z" |
EndDate | string | Required | End date for the orders retrieval (ISO 8601 format) Example: "2024-04-27T00:00:00Z" |
Page | number | Required | Page number for pagination (starting from 0)0 |
PageSize | number | Required | Number of orders per page for pagination (min: 5, max: 50) Example: 5 |
ClientIdRequired
Type:
string
Description:
Custom client ID for tracking (max 36 characters)
Example:
"my-order-123"StartDateRequired
Type:
string
Description:
Start date for the orders retrieval (ISO 8601 format)
Example:
"2024-04-20T00:00:00Z"EndDateRequired
Type:
string
Description:
End date for the orders retrieval (ISO 8601 format)
Example:
"2024-04-27T00:00:00Z"PageRequired
Type:
number
Description:
Page number for pagination (starting from 0)
0PageSizeRequired
Type:
number
Description:
Number of orders per page for pagination (min: 5, max: 50)
Example:
5Command Invocation
Command Arguments Example:
[
"my-client-123",
"2024-04-20T00:00:00Z",
"2024-04-27T00:00:00Z",
0,
5
]Invocation Example:
connection.invoke('GetTradesPaginated', 'my-client-123', '2024-04-20T00:00:00Z', '2024-04-27T00:00:00Z', 0, 5)Response Event
Event Name
executionEventsSubject
account.trades.snapshotSnapshot of trades within the specified date range
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the transaction |
userId | string | Identifier of the user associated with the transaction |
clientId | string | Client ID provided during the request |
instrument | string | Trading pair or instrument identifier |
side | string | Trade side buy→ Buysell→ Sell |
price | number | Price at which the trade was executed |
quantityFilled | number | Quantity of the asset that was traded |
timestamp | string | Timestamp of when the trade occurred (ISO 8601 format) |
email | string | Email associated with the user account |
Example Response
{
"data": [
{
"id": "trade_123456789",
"userId": "user_987654321",
"clientId": "my-client-123",
"instrument": "BTC-USD",
"side": "buy",
"price": 30000.5,
"quantityFilled": 0.1,
"timestamp": "2024-04-21T15:30:00Z",
"email": "user@example.com"
}
]
}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('GetTradesPaginated', "my-client-123", "2024-04-20T00:00:00Z", "2024-04-27T00:00:00Z", 0, 5)
.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