tardis-dev
Advanced tools
Comparing version 13.20.3 to 13.20.4
@@ -87,2 +87,6 @@ "use strict"; | ||
}; | ||
const OKCOIN_V5_API_SWITCH_DATE = new Date('2023-04-27T00:00:00.000Z'); | ||
const shouldUseOkcoinV5Mappers = (localTimestamp) => { | ||
return isRealTime(localTimestamp) || localTimestamp.valueOf() >= OKCOIN_V5_API_SWITCH_DATE.valueOf(); | ||
}; | ||
const tradesMappers = { | ||
@@ -117,3 +121,3 @@ bitmex: () => bitmex_1.bitmexTradesMapper, | ||
bybit: (localTimestamp) => shouldUseBybitV5Mappers(localTimestamp) ? new bybit_1.BybitV5TradesMapper('bybit') : new bybit_1.BybitTradesMapper('bybit'), | ||
okcoin: () => new okex_1.OkexTradesMapper('okcoin', 'spot'), | ||
okcoin: (localTimestamp) => shouldUseOkcoinV5Mappers(localTimestamp) ? new okex_1.OkexV5TradesMapper('okcoin') : new okex_1.OkexTradesMapper('okcoin', 'spot'), | ||
hitbtc: () => hitbtc_1.hitBtcTradesMapper, | ||
@@ -182,3 +186,5 @@ phemex: () => phemex_1.phemexTradesMapper, | ||
bybit: (localTimestamp) => shouldUseBybitV5Mappers(localTimestamp) ? new bybit_1.BybitV5BookChangeMapper('bybit', 50) : new bybit_1.BybitBookChangeMapper('bybit', false), | ||
okcoin: (localTimestamp) => new okex_1.OkexBookChangeMapper('okcoin', 'spot', localTimestamp.valueOf() >= new Date('2020-02-13').valueOf()), | ||
okcoin: (localTimestamp) => shouldUseOkcoinV5Mappers(localTimestamp) | ||
? new okex_1.OkexV5BookChangeMapper('okcoin', true) | ||
: new okex_1.OkexBookChangeMapper('okcoin', 'spot', localTimestamp.valueOf() >= new Date('2020-02-13').valueOf()), | ||
hitbtc: () => hitbtc_1.hitBtcBookChangeMapper, | ||
@@ -289,3 +295,3 @@ phemex: () => phemex_1.phemexBookChangeMapper, | ||
: new okex_1.OkexBookTickerMapper('okex-options', 'option'), | ||
okcoin: () => new okex_1.OkexBookTickerMapper('okcoin', 'spot'), | ||
okcoin: (localTimestamp) => shouldUseOkcoinV5Mappers(localTimestamp) ? new okex_1.OkexV5BookTickerMapper('okcoin', true) : new okex_1.OkexBookTickerMapper('okcoin', 'spot'), | ||
serum: () => new serum_1.SerumBookTickerMapper('serum'), | ||
@@ -292,0 +298,0 @@ 'star-atlas': () => new serum_1.SerumBookTickerMapper('star-atlas'), |
@@ -12,7 +12,4 @@ import { Filter } from '../types'; | ||
} | ||
export declare class OKCoinRealTimeFeed extends RealTimeFeedBase { | ||
export declare class OKCoinRealTimeFeed extends OkexRealTimeFeed { | ||
protected wssURL: string; | ||
protected mapToSubscribeMessages(filters: Filter<string>[]): any[]; | ||
protected messageIsError(message: any): boolean; | ||
protected decompress: (message: any) => any; | ||
} | ||
@@ -19,0 +16,0 @@ export declare class OkexOptionsRealTimeFeed extends OkexRealTimeFeed { |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.OkexOptionsRealTimeFeed = exports.OKCoinRealTimeFeed = exports.OkexRealTimeFeed = void 0; | ||
const zlib_1 = require("zlib"); | ||
const crypto_1 = __importDefault(require("crypto")); | ||
@@ -78,32 +77,7 @@ const handy_1 = require("../handy"); | ||
exports.OkexRealTimeFeed = OkexRealTimeFeed; | ||
class OKCoinRealTimeFeed extends realtimefeed_1.RealTimeFeedBase { | ||
class OKCoinRealTimeFeed extends OkexRealTimeFeed { | ||
constructor() { | ||
super(...arguments); | ||
this.wssURL = 'wss://real.okcoin.com:8443/ws/v3'; | ||
this.decompress = (message) => { | ||
message = (0, zlib_1.inflateRawSync)(message); | ||
return message; | ||
}; | ||
this.wssURL = 'wss://real.okcoin.com:8443/ws/v5/public'; | ||
} | ||
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: [...new Set(args)] | ||
} | ||
]; | ||
} | ||
messageIsError(message) { | ||
return message.event === 'error'; | ||
} | ||
} | ||
@@ -110,0 +84,0 @@ exports.OKCoinRealTimeFeed = OKCoinRealTimeFeed; |
{ | ||
"name": "tardis-dev", | ||
"version": "13.20.3", | ||
"version": "13.20.4", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=12" |
@@ -156,2 +156,7 @@ import { ONE_SEC_IN_MS } from '../handy' | ||
const OKCOIN_V5_API_SWITCH_DATE = new Date('2023-04-27T00:00:00.000Z') | ||
const shouldUseOkcoinV5Mappers = (localTimestamp: Date) => { | ||
return isRealTime(localTimestamp) || localTimestamp.valueOf() >= OKCOIN_V5_API_SWITCH_DATE.valueOf() | ||
} | ||
const tradesMappers = { | ||
@@ -195,3 +200,4 @@ bitmex: () => bitmexTradesMapper, | ||
shouldUseBybitV5Mappers(localTimestamp) ? new BybitV5TradesMapper('bybit') : new BybitTradesMapper('bybit'), | ||
okcoin: () => new OkexTradesMapper('okcoin', 'spot'), | ||
okcoin: (localTimestamp: Date) => | ||
shouldUseOkcoinV5Mappers(localTimestamp) ? new OkexV5TradesMapper('okcoin') : new OkexTradesMapper('okcoin', 'spot'), | ||
hitbtc: () => hitBtcTradesMapper, | ||
@@ -277,3 +283,5 @@ phemex: () => phemexTradesMapper, | ||
okcoin: (localTimestamp: Date) => | ||
new OkexBookChangeMapper('okcoin', 'spot', localTimestamp.valueOf() >= new Date('2020-02-13').valueOf()), | ||
shouldUseOkcoinV5Mappers(localTimestamp) | ||
? new OkexV5BookChangeMapper('okcoin', true) | ||
: new OkexBookChangeMapper('okcoin', 'spot', localTimestamp.valueOf() >= new Date('2020-02-13').valueOf()), | ||
hitbtc: () => hitBtcBookChangeMapper, | ||
@@ -406,3 +414,4 @@ phemex: () => phemexBookChangeMapper, | ||
okcoin: () => new OkexBookTickerMapper('okcoin', 'spot'), | ||
okcoin: (localTimestamp: Date) => | ||
shouldUseOkcoinV5Mappers(localTimestamp) ? new OkexV5BookTickerMapper('okcoin', true) : new OkexBookTickerMapper('okcoin', 'spot'), | ||
serum: () => new SerumBookTickerMapper('serum'), | ||
@@ -409,0 +418,0 @@ 'star-atlas': () => new SerumBookTickerMapper('star-atlas'), |
@@ -81,35 +81,4 @@ import { inflateRawSync } from 'zlib' | ||
export class OKCoinRealTimeFeed extends RealTimeFeedBase { | ||
protected wssURL = 'wss://real.okcoin.com:8443/ws/v3' | ||
protected mapToSubscribeMessages(filters: Filter<string>[]): any[] { | ||
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: [...new Set(args)] | ||
} | ||
] | ||
} | ||
protected messageIsError(message: any): boolean { | ||
return message.event === 'error' | ||
} | ||
protected decompress = (message: any) => { | ||
message = inflateRawSync(message) as Buffer | ||
return message | ||
} | ||
export class OKCoinRealTimeFeed extends OkexRealTimeFeed { | ||
protected wssURL = 'wss://real.okcoin.com:8443/ws/v5/public' | ||
} | ||
@@ -116,0 +85,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1737833
32091