aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/src
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2019-01-31 02:28:06 +0800
committerfragosti <francesco.agosti93@gmail.com>2019-01-31 02:28:06 +0800
commit7b4a0d4f8aff373b632983400d28dfdce602114a (patch)
tree994550fc0d7e5141f529a2f62ad73698be431250 /packages/pipeline/src
parentc2ad95fd94611dba2030778553380cf07a85a4c3 (diff)
downloaddexon-0x-contracts-7b4a0d4f8aff373b632983400d28dfdce602114a.tar
dexon-0x-contracts-7b4a0d4f8aff373b632983400d28dfdce602114a.tar.gz
dexon-0x-contracts-7b4a0d4f8aff373b632983400d28dfdce602114a.tar.bz2
dexon-0x-contracts-7b4a0d4f8aff373b632983400d28dfdce602114a.tar.lz
dexon-0x-contracts-7b4a0d4f8aff373b632983400d28dfdce602114a.tar.xz
dexon-0x-contracts-7b4a0d4f8aff373b632983400d28dfdce602114a.tar.zst
dexon-0x-contracts-7b4a0d4f8aff373b632983400d28dfdce602114a.zip
fix bloxy datasource getDexTradesAsync to allow for tx_hash repetitions in dedupe logic
Diffstat (limited to 'packages/pipeline/src')
-rw-r--r--packages/pipeline/src/data_sources/bloxy/index.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/pipeline/src/data_sources/bloxy/index.ts b/packages/pipeline/src/data_sources/bloxy/index.ts
index bba424f67..68764ca98 100644
--- a/packages/pipeline/src/data_sources/bloxy/index.ts
+++ b/packages/pipeline/src/data_sources/bloxy/index.ts
@@ -2,6 +2,7 @@ import axios from 'axios';
import * as R from 'ramda';
import { logUtils } from '@0x/utils';
+
// URL to use for getting dex trades from Bloxy.
export const BLOXY_DEX_TRADES_URL = 'https://bloxy.info/api/dex/trades';
// Number of trades to get at once. Must be less than or equal to MAX_OFFSET.
@@ -76,8 +77,11 @@ export class BloxySource {
*/
public async getDexTradesAsync(lastSeenTimestamp: number): Promise<BloxyTrade[]> {
const allTrades = await this._scrapeAllDexTradesAsync(lastSeenTimestamp);
- logUtils.log('Removing duplicate entries');
- const uniqueTrades = R.uniqBy(R.toString, allTrades) as BloxyTrade[];
+ logUtils.log(`Removing duplicates from ${allTrades.length} entries`);
+ const uniqueTrades = R.uniqBy(
+ (trade: BloxyTrade) => `${trade.tradeIndex}-${trade.tx_hash}`,
+ allTrades,
+ ) as BloxyTrade[];
logUtils.log(`Removed ${allTrades.length - uniqueTrades.length} duplicate entries`);
return uniqueTrades;
}