Hercle
WebSocket

Create RFQ

Create a Request For Quote (RFQ) to receive price quotes for a specific trading pair and quantity. Has to be accepted within the time limit through AcceptRequestForQuote.

Auth:API Key
Tags:
Trading
Command Name
CreateRequestForQuote

Command Arguments

ClientId
Required
Type:
string
Description:

Custom client ID for tracking (max 36 characters)

Example: "my-client-456"
PairName
Required
Type:
string
Description:

Trading pair (e.g., BTCUSDT)

Example: "BTCUSDT"
Side
Required
Type:
string
Description:

RFQ side ("buy" or "sell")

Example: "buy"
Size
Required
Type:
number
Description:

Quantity for the RFQ

Example: 0.5
Amount
Required
Type:
number
Description:

Total amount for the RFQ (optional)

Example: 15000

Command Invocation

Command Arguments Example:
[
  "my-client-456",
  "BTCUSDT",
  "buy",
  0.5,
  15000
]
Invocation Example:
connection.invoke('CreateRequestForQuote', 'my-client-456', 'BTCUSDT', 'buy', 0.5, 15000)

Response Event

Event Name
executionEvents
Subject
account.requestForQuote.created
FieldTypeDescription
requestForQuoteIdstringUnique RFQ identifier
userIdstringUnique user identifier
instrumentstringTrading pair (e.g., BTCUSDT)
baseCurrencystringBase currency of the trading pair
quoteCurrencystringQuote currency of the trading pair
sidestring
RFQ side
buyBuy
sellSell
sizenumberQuantity for the RFQ
pricenumberQuoted price for the RFQ
amountnumberTotal amount for the RFQ
statusnumber
RFQ status
0Created
1Executed
2Cancelled
3Pending
requestDateTimestringTimestamp when the RFQ was created
expireDateTimestringTimestamp when the RFQ expires

Example Response

{
  "data": {
    "requestForQuoteId": "rfq-789",
    "userId": "user-123",
    "instrument": "BTCUSDT",
    "baseCurrency": "BTC",
    "quoteCurrency": "USDT",
    "side": "buy",
    "size": 0.5,
    "price": 30000,
    "amount": 15000,
    "status": 0,
    "requestDateTime": "2024-01-01T12:00:00Z",
    "expireDateTime": "2024-01-01T12:05: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('CreateRequestForQuote', "my-client-456", "BTCUSDT", "buy", 0.5, 15000)
      .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

Event Log

No events yet. Connect and invoke a command to see events.