UNPKG

tardis-dev

Version:

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

34 lines 1.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BinanceOptionsRealTimeFeed = void 0; const realtimefeed_1 = require("./realtimefeed"); class BinanceOptionsRealTimeFeed extends realtimefeed_1.RealTimeFeedBase { wssURL = 'wss://vstream.binance.com/stream'; httpURL = 'https://vapi.binance.com/vapi/v1'; mapToSubscribeMessages(filters) { const payload = filters.map((filter, index) => { if (!filter.symbols || filter.symbols.length === 0) { throw new Error('BinanceOptionsRealTimeFeed requires explicitly specified symbols when subscribing to live feed'); } return { method: 'SUBSCRIBE', params: filter.symbols.map((symbol) => `${symbol}@${filter.channel}`), id: index + 1 }; }); const noBinary = { method: 'BINARY', params: ['false'], id: 0 }; return [noBinary, ...payload]; } messageIsError(message) { if (message.data !== undefined && message.data.e === 'error') { return true; } return false; } } exports.BinanceOptionsRealTimeFeed = BinanceOptionsRealTimeFeed; //# sourceMappingURL=binanceoptions.js.map