Private channel
Realtime API

Private channel

Data
Channel
Event
Event trigger
板情報
price_ladders_${code}_${currency_pair_code}
updated
板が更新された
注文情報
user_account_${funding_currency}_orders
updated
自身の注文情報が更新された
取引情報
user_account_${funding_currency}_trades
updated
自身の取引情報が更新された
約定情報
user_executions_cash_${currency_pair_code}
created
自身の約定情報が作成された
Javascript sample
1
const { TapClient } = require("liquid-tap");
2
var tap = new TapClient({
3
auth: { tokenId: token_id, tokenSecret: token_secret }
4
});
5
var protected_channel = tap.subscribe("user_account_usd_trades");
6
rotected_channel.bind("updated", function(data) {
7
console.log("Trades Updated: ", data);
8
});
9
10
const pricebook_channel = tap.subscribe("price_ladders_cash_btcjpy");
11
const orders_channel = tap.subscribe("user_account_jpy_orders");
12
const trades_channel = tap.subscribe("user_account_usd_trades");
13
const executions_channel = tap.subscribe("user_executions_cash_btcjpy");
14
15
16
/* javascript - using raw websockets */
17
const jwt = require('jwt-simple');
18
var authPayload = {
19
token_id: 1234,
20
path: '/realtime',
21
nonce: Date.now()
22
};
23
var tokenSecret = '<token_secret>';
24
const authRequest = {
25
headers: {
26
'X-Quoine-Auth': jwt.encode(authPayload, tokenSecret)
27
},
28
path: '/realtime'
29
}
30
const ws = new WebSocket('wss://tap.liquid.com/app/LiquidTapClient');
31
ws.onmessage = (message) => {
32
const wsEvent = JSON.parse(message.data);
33
switch(wsEvent.event){
34
case 'pusher:connection_established':
35
console.log('Connected');
36
ws.send(JSON.stringify({ "event":"quoine:auth_request", "data": authRequest }));
37
break;
38
case 'quoine:auth_success':
39
console.log('Authenticated');
40
ws.send(JSON.stringify({"event":"pusher:subscribe","data":{"channel":"user_account_usd_trades"}}));
41
break;
42
case 'quoine:auth_failure':
43
console.log('Auth failed');
44
break;
45
case 'pusher_internal:subscription_succeeded':
46
console.log('Subscribed: ' + wsEvent.channel);
47
case 'updated':
48
console.log('Trades Updated: ', wsEvent.data);
49
}
50
}
Copied!
リンクのコピー