@hackape/tardis-dev
Version:
Convenient access to tick-level historical and real-time cryptocurrency market data via Node.js
45 lines • 1.5 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.OKCoinRealTimeFeed = exports.OkexRealTimeFeed = void 0;
const zlib_1 = require("zlib");
const realtimefeed_1 = require("./realtimefeed");
class OkexRealTimeFeed extends realtimefeed_1.RealTimeFeedBase {
constructor() {
super(...arguments);
this.wssURL = 'wss://awspush.okex.com:8443/ws/v3';
this.decompress = (message) => {
message = zlib_1.inflateRawSync(message);
return message;
};
}
mapToSubscribeMessages(filters) {
const args = filters
.map((filter) => {
if (!filter.symbols || filter.symbols.length === 0) {
throw new Error(`${this._exchange} RealTimeFeed requires explicitly specified symbols when subscribing to live feed`);
}
return filter.symbols.map((symbol) => {
return `${filter.channel}:${symbol}`;
});
})
.flatMap((s) => s);
return [
{
op: 'subscribe',
args
}
];
}
messageIsError(message) {
return message.event === 'error';
}
}
exports.OkexRealTimeFeed = OkexRealTimeFeed;
class OKCoinRealTimeFeed extends OkexRealTimeFeed {
constructor() {
super(...arguments);
this.wssURL = 'wss://real.okcoin.com:8443/ws/v3';
}
}
exports.OKCoinRealTimeFeed = OKCoinRealTimeFeed;
//# sourceMappingURL=okex.js.map
;