Liquid API
Search…
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
user_executions_cash_{currency_pair_code}
Created
    User's execution is created
Account
user_account_{currency}
Updated
    User's account balance update
Trades & Orders
user
Updated
    User's order
    User's positions
user_#{user_id}_balance_history
Updatedd
    User's transactions
1
/* javascript - using dedicated library */
2
const { TapClient } = require("liquid-tap");
3
var tap = new TapClient({
4
auth: { tokenId: token_id, tokenSecret: token_secret }
5
});
6
var protected_channel = tap.subscribe("user_account_usd_trades");
7
protected_channel.bind("updated", function(data) {
8
console.log("Trades Updated: ", data);
9
});
10
11
const pricebook_channel = tap.subscribe("price_ladders_cash_btcjpy");
12
const orders_channel = tap.subscribe("user_account_jpy_orders");
13
const trades_channel = tap.subscribe("user_account_usd_trades");
14
const executions_channel = tap.subscribe("user_executions_cash_btcjpy");
15
16
17
/* javascript - using raw websockets */
18
const jwt = require('jwt-simple');
19
var authPayload = {
20
token_id: 1234,
21
path: '/realtime',
22
nonce: Date.now()
23
};
24
var tokenSecret = '<token_secret>';
25
const authRequest = {
26
headers: {
27
'X-Quoine-Auth': jwt.encode(authPayload, tokenSecret)
28
},
29
path: '/realtime'
30
}
31
const ws = new WebSocket('wss://tap.liquid.com/app/LiquidTapClient');
32
ws.onmessage = (message) => {
33
const wsEvent = JSON.parse(message.data);
34
switch(wsEvent.event){
35
case 'pusher:connection_established':
36
console.log('Connected');
37
ws.send(JSON.stringify({ "event":"quoine:auth_request", "data": authRequest }));
38
break;
39
case 'quoine:auth_success':
40
console.log('Authenticated');
41
ws.send(JSON.stringify({"event":"pusher:subscribe","data":{"channel":"user_account_usd_trades"}}));
42
break;
43
case 'quoine:auth_failure':
44
console.log('Auth failed');
45
break;
46
case 'pusher_internal:subscription_succeeded':
47
console.log('Subscribed: ' + wsEvent.channel);
48
case 'updated':
49
console.log('Trades Updated: ', wsEvent.data);
50
}
51
}
Copied!
Last modified 2d ago
Copy link