tardis-dev
Version:
Convenient access to tick-level historical and real-time cryptocurrency market data via Node.js
29 lines • 938 B
JavaScript
import { RealTimeFeedBase } from "./realtimefeed.js";
export class UpbitRealTimeFeed extends 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';
}
}
//# sourceMappingURL=upbit.js.map