UNPKG

tardis-dev

Version:

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

36 lines 1.43 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BinanceEuropeanOptionsRealTimeFeed = void 0; const realtimefeed_1 = require("./realtimefeed"); class BinanceEuropeanOptionsRealTimeFeed extends realtimefeed_1.RealTimeFeedBase { constructor() { super(...arguments); this.wssURL = 'wss://nbstream.binance.com/eoptions/stream'; } mapToSubscribeMessages(filters) { const payload = filters.map((filter, index) => { if (!filter.symbols || filter.symbols.length === 0) { throw new Error('BinanceEuropeanOptionsRealTimeFeed requires explicitly specified symbols when subscribing to live feed'); } return { method: 'SUBSCRIBE', params: filter.symbols.map((symbol) => { if (filter.channel === 'depth100') { return `${symbol}@${filter.channel}@100ms`; } return `${symbol}@${filter.channel}`; }), id: index + 1 }; }); return payload; } messageIsError(message) { if (message.data !== undefined && message.data.e === 'error') { return true; } return false; } } exports.BinanceEuropeanOptionsRealTimeFeed = BinanceEuropeanOptionsRealTimeFeed; //# sourceMappingURL=binanceeuropeanoptions.js.map