tardis-dev
Version:
Convenient access to tick-level historical and real-time cryptocurrency market data via Node.js
35 lines • 1.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PoloniexRealTimeFeed = void 0;
const realtimefeed_1 = require("./realtimefeed");
class PoloniexRealTimeFeed extends realtimefeed_1.RealTimeFeedBase {
constructor() {
super(...arguments);
this.wssURL = 'wss://ws.poloniex.com/ws/public';
this.sendCustomPing = () => {
this.send({
event: 'ping'
});
};
}
mapToSubscribeMessages(filters) {
return filters.flatMap((filter) => {
if (!filter.symbols || filter.symbols.length === 0) {
throw new Error('PoloniexRealTimeFeed requires explicitly specified symbols when subscribing to live feed');
}
return {
event: 'subscribe',
channel: [filter.channel],
symbols: filter.symbols
};
});
}
messageIsHeartbeat(msg) {
return msg.event === 'pong';
}
messageIsError(message) {
return message.event === 'error';
}
}
exports.PoloniexRealTimeFeed = PoloniexRealTimeFeed;
//# sourceMappingURL=poloniex.js.map