tardis-dev
Version:
Convenient access to tick-level historical and real-time cryptocurrency market data via Node.js
25 lines • 936 B
JavaScript
import { RealTimeFeedBase } from "./realtimefeed.js";
export class CryptofacilitiesRealTimeFeed extends RealTimeFeedBase {
wssURL = 'wss://futures.kraken.com/ws/v1';
mapToSubscribeMessages(filters) {
return filters
.filter((filter) => filter.channel.endsWith('_snapshot') === false)
.map((filter) => {
if (!filter.symbols || filter.symbols.length === 0) {
throw new Error('CryptofacilitiesRealTimeFeed requires explicitly specified symbols when subscribing to live feed');
}
return {
event: 'subscribe',
product_ids: filter.symbols,
feed: filter.channel
};
});
}
messageIsError(message) {
return message.event === 'error';
}
messageIsHeartbeat(message) {
return message.feed === 'heartbeat';
}
}
//# sourceMappingURL=cryptofacilities.js.map