WebSocket
Get Pair Size by Amount
Retrieves the size of a trading pair based on a specified amount.
Auth:API Key
Tags:
General Methods
Command Name
GetPairSizeByAmountCommand Arguments
| Field | Type | Required | Description |
|---|---|---|---|
ClientId | string | Required | Custom client ID for tracking (max 36 characters) Example: "my-client-123" |
Pair | string | Required | The trading pair to retrieve size for Example: "BTCUSDT" |
Side | string | Required | The side of the trade (buy/sell) Example: "buy" |
Amount | number | Required | The amount to base the size calculation on Example: 100 |
ClientIdRequired
Type:
string
Description:
Custom client ID for tracking (max 36 characters)
Example:
"my-client-123"PairRequired
Type:
string
Description:
The trading pair to retrieve size for
Example:
"BTCUSDT"SideRequired
Type:
string
Description:
The side of the trade (buy/sell)
Example:
"buy"AmountRequired
Type:
number
Description:
The amount to base the size calculation on
Example:
100Command Invocation
Command Arguments Example:
[
"my-client-123",
"BTCUSDT",
"buy",
100
]Invocation Example:
connection.invoke('GetPairSizeByAmount', ['my-client-123', 'BTCUSDT', 'buy', 100])Response Event
Event Name
executionEventsSubject
execution.pair.priceResponse containing the size of the trading pair based on the specified amount
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the size request |
pair | string | The trading pair |
price | number | The price of the trading pair |
size | number | The calculated size based on the amount |
timestamp | string | Timestamp of the response |
Example Response
{
"data": {
"id": "size-request-123",
"pair": "BTCUSDT",
"price": 50000,
"size": 0.002,
"timestamp": "2024-01-01T12:00:00Z"
}
}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('GetPairSizeByAmount', "my-client-123", "BTCUSDT", "buy", 100)
.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