tardis-dev
Advanced tools
Comparing version 10.0.24 to 10.0.25
@@ -70,3 +70,3 @@ "use strict"; | ||
constructor(status, responseText, url) { | ||
super(`HttpError: status code ${status}`); | ||
super(`HttpError: status code: ${status}, response text: ${responseText}`); | ||
this.status = status; | ||
@@ -73,0 +73,0 @@ this.responseText = responseText; |
@@ -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,2 +25,12 @@ canHandle(message) { | ||
for (const okexTrade of okexTradesMessage.data) { | ||
// ignore trades that are first time encountered for a given symbol and that have timestamp day different that local timestamp day | ||
// such trades are duplicates and were already published for a previous day | ||
const symbol = okexTrade.instrument_id; | ||
const timestamp = new Date(okexTrade.timestamp); | ||
if (this._seenSymbols.has(symbol) === false) { | ||
this._seenSymbols.add(symbol); | ||
if (timestamp.getUTCDate() !== localTimestamp.getUTCDate()) { | ||
continue; | ||
} | ||
} | ||
yield { | ||
@@ -31,5 +42,5 @@ type: 'trade', | ||
price: Number(okexTrade.price), | ||
amount: Number(okexTrade.qty || okexTrade.size), | ||
amount: okexTrade.qty !== undefined ? Number(okexTrade.qty) : Number(okexTrade.size), | ||
side: okexTrade.side, | ||
timestamp: new Date(okexTrade.timestamp), | ||
timestamp, | ||
localTimestamp: localTimestamp | ||
@@ -36,0 +47,0 @@ }; |
{ | ||
"name": "tardis-dev", | ||
"version": "10.0.24", | ||
"version": "10.0.25", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=12" |
@@ -64,3 +64,3 @@ import crypto, { createHash } from 'crypto' | ||
constructor(public readonly status: number, public readonly responseText: string, public readonly url: string) { | ||
super(`HttpError: status code ${status}`) | ||
super(`HttpError: status code: ${status}, response text: ${responseText}`) | ||
} | ||
@@ -67,0 +67,0 @@ } |
@@ -7,2 +7,3 @@ 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,2 +26,13 @@ | ||
for (const okexTrade of okexTradesMessage.data) { | ||
// ignore trades that are first time encountered for a given symbol and that have timestamp day different that local timestamp day | ||
// such trades are duplicates and were already published for a previous day | ||
const symbol = okexTrade.instrument_id | ||
const timestamp = new Date(okexTrade.timestamp) | ||
if (this._seenSymbols.has(symbol) === false) { | ||
this._seenSymbols.add(symbol) | ||
if (timestamp.getUTCDate() !== localTimestamp.getUTCDate()) { | ||
continue | ||
} | ||
} | ||
yield { | ||
@@ -32,5 +44,5 @@ type: 'trade', | ||
price: Number(okexTrade.price), | ||
amount: Number(okexTrade.qty || okexTrade.size), | ||
amount: okexTrade.qty !== undefined ? Number(okexTrade.qty) : Number(okexTrade.size), | ||
side: okexTrade.side, | ||
timestamp: new Date(okexTrade.timestamp), | ||
timestamp, | ||
localTimestamp: localTimestamp | ||
@@ -37,0 +49,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
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
693957
12299