tardis-dev
Version:
Convenient access to tick-level historical and real-time cryptocurrency market data via Node.js
33 lines • 1.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpbitRealTimeFeed = void 0;
const realtimefeed_1 = require("./realtimefeed");
class UpbitRealTimeFeed extends realtimefeed_1.RealTimeFeedBase {
wssURL = 'wss://api.upbit.com/websocket/v1';
mapToSubscribeMessages(filters) {
const subs = filters.map((filter) => {
if (!filter.symbols || filter.symbols.length === 0) {
throw new Error('UpbitRealTimeFeed requires explicitly specified symbols when subscribing to live feed');
}
return {
type: filter.channel,
codes: filter.symbols,
isOnlyRealtime: true
};
});
const payload = [
[
{
ticket: new Date().valueOf().toString()
},
...subs
]
];
return payload;
}
messageIsError(message) {
return message.type === 'error';
}
}
exports.UpbitRealTimeFeed = UpbitRealTimeFeed;
//# sourceMappingURL=upbit.js.map