tardis-dev
Advanced tools
Comparing version 10.1.1 to 10.1.2
@@ -5,2 +5,3 @@ import { BookChange, Exchange, Trade } from '../types'; | ||
private readonly _exchange; | ||
private readonly _seenSymbols; | ||
constructor(_exchange: Exchange); | ||
@@ -7,0 +8,0 @@ canHandle(message: HuobiDataMessage): boolean; |
@@ -8,2 +8,3 @@ "use strict"; | ||
this._exchange = _exchange; | ||
this._seenSymbols = new Set(); | ||
} | ||
@@ -27,2 +28,7 @@ canHandle(message) { | ||
const symbol = message.ch.split('.')[1].toUpperCase(); | ||
// always ignore first returned trade as it's a 'stale' trade, which has already been published before disconnect | ||
if (this._seenSymbols.has(symbol) === false) { | ||
this._seenSymbols.add(symbol); | ||
return; | ||
} | ||
for (const huobiTrade of message.tick.data) { | ||
@@ -29,0 +35,0 @@ yield { |
@@ -6,2 +6,3 @@ import { BookChange, DerivativeTicker, Exchange, FilterForExchange, Trade } from '../types'; | ||
private readonly _market; | ||
private readonly _seenSymbols; | ||
constructor(_exchange: Exchange, _market: OKEX_MARKETS); | ||
@@ -8,0 +9,0 @@ canHandle(message: OkexDataMessage): boolean; |
@@ -9,2 +9,3 @@ "use strict"; | ||
this._market = _market; | ||
this._seenSymbols = new Set(); | ||
} | ||
@@ -24,5 +25,11 @@ canHandle(message) { | ||
for (const okexTrade of okexTradesMessage.data) { | ||
const symbol = okexTrade.instrument_id; | ||
// always ignore first returned trade as it's a 'stale' trade, which has already been published before disconnect | ||
if (this._seenSymbols.has(symbol) === false) { | ||
this._seenSymbols.add(symbol); | ||
break; | ||
} | ||
yield { | ||
type: 'trade', | ||
symbol: okexTrade.instrument_id, | ||
symbol, | ||
exchange: this._exchange, | ||
@@ -29,0 +36,0 @@ id: typeof okexTrade.trade_id === 'string' ? okexTrade.trade_id : undefined, |
{ | ||
"name": "tardis-dev", | ||
"version": "10.1.1", | ||
"version": "10.1.2", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=12" |
@@ -8,2 +8,4 @@ import { BookChange, Exchange, Trade } from '../types' | ||
export class HuobiTradesMapper implements Mapper<'huobi' | 'huobi-dm' | 'huobi-dm-swap', Trade> { | ||
private readonly _seenSymbols = new Set<string>() | ||
constructor(private readonly _exchange: Exchange) {} | ||
@@ -31,2 +33,8 @@ canHandle(message: HuobiDataMessage) { | ||
// always ignore first returned trade as it's a 'stale' trade, which has already been published before disconnect | ||
if (this._seenSymbols.has(symbol) === false) { | ||
this._seenSymbols.add(symbol) | ||
return | ||
} | ||
for (const huobiTrade of message.tick.data) { | ||
@@ -33,0 +41,0 @@ yield { |
@@ -7,2 +7,4 @@ import { BookChange, DerivativeTicker, Exchange, FilterForExchange, Trade } from '../types' | ||
export class OkexTradesMapper implements Mapper<OKEX_EXCHANGES, Trade> { | ||
private readonly _seenSymbols = new Set<string>() | ||
constructor(private readonly _exchange: Exchange, private readonly _market: OKEX_MARKETS) {} | ||
@@ -25,5 +27,13 @@ | ||
for (const okexTrade of okexTradesMessage.data) { | ||
const symbol = okexTrade.instrument_id | ||
// always ignore first returned trade as it's a 'stale' trade, which has already been published before disconnect | ||
if (this._seenSymbols.has(symbol) === false) { | ||
this._seenSymbols.add(symbol) | ||
break | ||
} | ||
yield { | ||
type: 'trade', | ||
symbol: okexTrade.instrument_id, | ||
symbol, | ||
exchange: this._exchange, | ||
@@ -30,0 +40,0 @@ id: typeof okexTrade.trade_id === 'string' ? okexTrade.trade_id : undefined, |
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
696757
12338