WebSocket Subscription
Pair Price Stream
Subscribe to the real-time feed of price updates of a pair with the selected size.
Receive continuous price updates including buy price and sell price for the specified trading pair.
Auth:API Key
Tags:
Subscriptions
Market Data
Subscribe
Command Name
SubscribePairPriceChannelArguments
| Field | Type | Required | Description |
|---|---|---|---|
ClientId | string | Required | Custom client ID (max 36 characters) Example: "my-client-123" |
PairName | string | Required | Pair name without separators (e.g.: BTCUSDT) Example: "BTCUSDT" |
Size | number | Required | Selected size Example: 1 |
ClientIdRequired
Type:
string
Description:
Custom client ID (max 36 characters)
Example:
"my-client-123"PairNameRequired
Type:
string
Description:
Pair name without separators (e.g.: BTCUSDT)
Example:
"BTCUSDT"SizeRequired
Type:
number
Description:
Selected size
Example:
1Invocation Example:
connection.invoke('SubscribePairPriceChannel', 'my-client-123', 'BTCUSDT', 1.0)Unsubscribe
Command Name
UnsubscribePairPriceChannelArguments
| Field | Type | Required | Description |
|---|---|---|---|
ClientId | string | Required | Custom client ID (max 36 characters) Example: "my-client-123" |
PairName | string | Required | Pair name without separators (e.g.: BTCUSDT) Example: "BTCUSDT" |
Size | number | Required | Selected size Example: 1 |
ClientIdRequired
Type:
string
Description:
Custom client ID (max 36 characters)
Example:
"my-client-123"PairNameRequired
Type:
string
Description:
Pair name without separators (e.g.: BTCUSDT)
Example:
"BTCUSDT"SizeRequired
Type:
number
Description:
Selected size
Example:
1Invocation Example:
connection.invoke('UnsubscribePairPriceChannel', 'my-client-123', 'BTCUSDT', 1.0)Subscription Events
Event Name
subscriptionsSubject
execution.feeds.priceUpdateReal-time price update event
Event Data Fields
| Field | Type | Description |
|---|---|---|
id | string | Price update ID |
buyPrice | number | Best buy price of pair with selected quantity |
sellPrice | number | Best sell price of pair with selected quantity |
size | number | Selected size |
pair | string | Pair name |
markPrice | number | Mark price of pair with selected quantity |
timestamp | string | Datetime of price update |
Example Event
{
"data": {
"id": "xxxx",
"buyPrice": 26798.5,
"sellPrice": 26790.5,
"size": 1,
"pair": "BTCUSDT",
"markPrice": 26794.575,
"timestamp": "2023-10-11T23:00:57.93094Z"
}
}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('SubscribePairPriceChannel', "my-client-123", "BTCUSDT", 1)
.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