diff options
author | fragosti <francesco.agosti93@gmail.com> | 2019-01-31 02:28:06 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2019-01-31 02:28:06 +0800 |
commit | 7b4a0d4f8aff373b632983400d28dfdce602114a (patch) | |
tree | 994550fc0d7e5141f529a2f62ad73698be431250 /packages | |
parent | c2ad95fd94611dba2030778553380cf07a85a4c3 (diff) | |
download | dexon-0x-contracts-7b4a0d4f8aff373b632983400d28dfdce602114a.tar.gz 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')
-rw-r--r-- | packages/pipeline/src/data_sources/bloxy/index.ts | 8 |
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; } |