UNPKG

tardis-dev

Version:

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

25 lines 1.05 kB
import { RealTimeFeedBase } from "./realtimefeed.js"; export class LighterRealTimeFeed extends RealTimeFeedBase { wssURL = 'wss://mainnet.zklighter.elliot.ai/stream'; mapToSubscribeMessages(filters) { return filters.flatMap((filter) => { if (filter.channel === 'market_stats') { return [{ type: 'subscribe', channel: 'market_stats/all' }]; } if (filter.channel === 'spot_market_stats') { return [{ type: 'subscribe', channel: 'spot_market_stats/all' }]; } if (!filter.symbols || filter.symbols.length === 0) { throw new Error('LighterRealTimeFeed requires explicitly specified symbols when subscribing to live feed'); } return filter.symbols.map((marketId) => ({ type: 'subscribe', channel: `${filter.channel}/${marketId}` })); }); } messageIsError(message) { return message.error !== undefined; } } //# sourceMappingURL=lighter.js.map