Private Channels

Authentication is required for the following channels.

Data

Channel

Event

Event Details

Orders

user_account_{funding_currency}_orders

Updated

  • User's order is created

  • User's order is cancelled

  • User's order is filled

  • Order's stop-loss or take profit is updated

Trades

user_account_{funding_currency}_trades

Updated

  • User's position is created

  • User's position is closed

Executions

user_executions_cash_{currency_pair_code}

Created

  • User's execution is created

/* javascript - using dedicated library */
const { TapClient } = require("liquid-tap");
var tap = new TapClient({
auth: { tokenId: token_id, tokenSecret: token_secret }
});
var protected_channel = tap.subscribe("user_account_usd_trades");
protected_channel.bind("updated", function(data) {
console.log("Trades Updated: ", data);
});
const pricebook_channel = tap.subscribe("price_ladders_cash_btcjpy");
const orders_channel = tap.subscribe("user_account_jpy_orders");
const trades_channel = tap.subscribe("user_account_usd_trades");
const executions_channel = tap.subscribe("user_executions_cash_btcjpy");
/* javascript - using raw websockets */
const jwt = require('jwt-simple');
var authPayload = {
token_id: 1234,
path: '/realtime',
nonce: Date.now()
};
var tokenSecret = '<token_secret>';
const authRequest = {
headers: {
'X-Quoine-Auth': jwt.encode(authPayload, tokenSecret)
},
path: '/realtime'
}
const ws = new WebSocket('wss://tap.liquid.com/app/LiquidTapClient');
ws.onmessage = (message) => {
const wsEvent = JSON.parse(message.data);
switch(wsEvent.event){
case 'pusher:connection_established':
console.log('Connected');
ws.send(JSON.stringify({ "event":"quoine:auth_request", "data": authRequest }));
break;
case 'quoine:auth_success':
console.log('Authenticated');
ws.send(JSON.stringify({"event":"pusher:subscribe","data":{"channel":"user_account_usd_trades"}}));
break;
case 'quoine:auth_failure':
console.log('Auth failed');
break;
case 'pusher_internal:subscription_succeeded':
console.log('Subscribed: ' + wsEvent.channel);
case 'updated':
console.log('Trades Updated: ', wsEvent.data);
}
}