Quoinex WebSocket(含Pusher)实现方案求助及支持性确认
Hey there, let’s break down your questions clearly— I’ve dug into this before, so here’s what you need to know:
1. Does Quoinex Support Pusher?
First, the straight answer: Quoinex (now part of the Liquid Group) did support Pusher for real-time data in the past, but it’s no longer the recommended or actively maintained approach. Legacy codebases might still reference Pusher integrations, but the platform has shifted entirely to its native WebSocket API for better reliability and control. You could technically try connecting to the old Pusher endpoint (app key quoine), but you’ll likely run into connectivity issues or limited data support these days.
2. Feasible Native WebSocket Implementation
The best way to integrate real-time data from Quoinex is using their official WebSocket API. Here’s a step-by-step guide with a working code example:
Prerequisites
- A valid Quoinex/Liquid API key and secret (generate this from your account settings)
- A WebSocket client library (we’ll use
wsfor Node.js here, but similar logic applies to other languages like Python or Java)
Step-by-Step Implementation
a. Connect to the Official Endpoint
The current active WebSocket endpoint is wss://api.liquid.com/ws (note: this replaced the old api.quoine.com endpoint post-merger with Liquid).
b. Handle Authentication (For Private Channels)
Private channels (like user orders, account balances) require a signed token. Here’s how to generate it:
- Create a timestamp (Unix time in milliseconds, as a string)
- Sign the timestamp with your API secret using HMAC-SHA256
- Format the token as
{API_KEY}:{TIMESTAMP}:{SIGNATURE}
c. Subscribe to Channels
Public channels (tickers, order books) don’t need auth. Common channel formats:
- Ticker:
product_cash_{BASE}_{QUOTE}_ticker(e.g.,product_cash_btc_jpy_tickerfor BTC/JPY spot) - Order Book:
product_cash_{BASE}_{QUOTE}_order_book - Private User Orders:
user_order
Working Node.js Example
const WebSocket = require('ws'); const crypto = require('crypto'); // Replace with your actual credentials const API_KEY = 'your_quoinex_api_key'; const API_SECRET = 'your_quoinex_api_secret'; // Generate authentication token for private channels const generateAuthToken = () => { const timestamp = Date.now().toString(); const signature = crypto .createHmac('sha256', API_SECRET) .update(timestamp) .digest('hex'); return `${API_KEY}:${timestamp}:${signature}`; }; // Initialize WebSocket connection const ws = new WebSocket('wss://api.liquid.com/ws'); ws.on('open', () => { console.log('Successfully connected to Quoinex WebSocket!'); // Subscribe to public BTC/JPY ticker (no auth required) ws.send(JSON.stringify({ event: 'subscribe', channel: 'product_cash_btc_jpy_ticker' })); // Subscribe to private user order channel (requires auth) ws.send(JSON.stringify({ event: 'subscribe', channel: 'user_order', token: generateAuthToken() })); }); ws.on('message', (data) => { const payload = JSON.parse(data); console.log('Received real-time data:', payload); }); ws.on('error', (err) => { console.error('WebSocket error:', err); }); ws.on('close', () => { console.log('Disconnected from WebSocket. Attempting to reconnect...'); // Add auto-reconnect logic here (e.g., set a timeout to reinitialize the connection) });
Key Notes
- Auto-Reconnect: Always implement reconnection logic, as WebSocket connections can drop unexpectedly. A simple timeout to reinitialize the connection works well.
- Channel Naming: Double-check channel names—they’re case-sensitive and follow the
product_{TYPE}_{BASE}_{QUOTE}_{CHANNEL}format (TYPE can becashfor spot,futurefor derivatives). - Rate Limits: Quoinex has rate limits for WebSocket subscriptions; avoid subscribing to more channels than necessary to avoid being throttled.
Final Recommendation
Stick with the native WebSocket API—it’s actively supported, more reliable, and gives you full access to all real-time data feeds. Pusher is a legacy option at this point, so it’s not worth investing time in unless you’re maintaining an older codebase.
内容的提问来源于stack exchange,提问作者saurshaz

