UNPKG

tardis-dev

Version:

Convenient access to tick-level historical and real-time cryptocurrency market data via Node.js

39 lines 1.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HyperliquidRealTimeFeed = void 0; const realtimefeed_1 = require("./realtimefeed"); class HyperliquidRealTimeFeed extends realtimefeed_1.RealTimeFeedBase { constructor() { super(...arguments); this.wssURL = 'wss://api.hyperliquid.xyz/ws'; this.sendCustomPing = () => { this.send({ method: 'ping' }); }; } mapToSubscribeMessages(filters) { return filters .map((filter) => { if (!filter.symbols || filter.symbols.length === 0) { throw new Error('HyperliquidRealTimeFeed requires explicitly specified symbols when subscribing to live feed'); } return filter.symbols.map((symbol) => { return { method: 'subscribe', subscription: { coin: symbol, type: filter.channel } }; }); }) .flatMap((f) => f); } messageIsError(message) { return message.channel === 'error'; } messageIsHeartbeat(message) { return message.channel === 'pong'; } } exports.HyperliquidRealTimeFeed = HyperliquidRealTimeFeed; //# sourceMappingURL=hyperliquid.js.map