UNPKG

tardis-dev

Version:

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

36 lines 1.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HyperliquidRealTimeFeed = void 0; const realtimefeed_1 = require("./realtimefeed"); class HyperliquidRealTimeFeed extends realtimefeed_1.RealTimeFeedBase { wssURL = 'wss://api.hyperliquid.xyz/ws'; 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'; } sendCustomPing = () => { this.send({ method: 'ping' }); }; } exports.HyperliquidRealTimeFeed = HyperliquidRealTimeFeed; //# sourceMappingURL=hyperliquid.js.map