Private channel

Realtime API

Private channel

Data

Channel

Event

Event trigger

板情報

priceladders${code}_${currency_pair_code}

updated

板が更新された

注文情報

useraccount${funding_currency}_orders

updated

自身の注文情報が更新された

取引情報

useraccount${funding_currency}_trades

updated

自身の取引情報が更新された

約定情報

userexecutions_cash${currency_pair_code}

created

自身の約定情報が作成された

Javascript sample
Javascript sample
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");
rotected_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);
}
}