Reference: Book (Level 2)
import { publicWsSubscription } from 'ts-kraken'; publicWsSubscription({ channel: 'book', params: { symbol: ['BTC/USD'] , depth: 10, } }).subscribe(({ data: [{ symbol, bids, asks }] }) => { console.log({ symbol, lastBid: bids[0]?.price, lastAsk: asks[0]?.price }); }); Copy
import { publicWsSubscription } from 'ts-kraken'; publicWsSubscription({ channel: 'book', params: { symbol: ['BTC/USD'] , depth: 10, } }).subscribe(({ data: [{ symbol, bids, asks }] }) => { console.log({ symbol, lastBid: bids[0]?.price, lastAsk: asks[0]?.price }); });
Reference: Book (Level 2)
Example