diff --git a/core/src/exchanges/smarkets/fetcher.ts b/core/src/exchanges/smarkets/fetcher.ts index c8f78e7f..a52bde64 100644 --- a/core/src/exchanges/smarkets/fetcher.ts +++ b/core/src/exchanges/smarkets/fetcher.ts @@ -403,14 +403,22 @@ export class SmarketsFetcher implements IExchangeFetcher(); for (const market of allMarkets) { - const existing = marketsByEvent.get(market.event_id) || []; - marketsByEvent.set(market.event_id, [...existing, market]); + const existing = marketsByEvent.get(market.event_id); + if (existing) { + existing.push(market); + } else { + marketsByEvent.set(market.event_id, [market]); + } } const contractsByMarket = new Map(); for (const contract of allContracts) { - const existing = contractsByMarket.get(contract.market_id) || []; - contractsByMarket.set(contract.market_id, [...existing, contract]); + const existing = contractsByMarket.get(contract.market_id); + if (existing) { + existing.push(contract); + } else { + contractsByMarket.set(contract.market_id, [contract]); + } } const volumesByMarket = new Map(); @@ -443,7 +451,7 @@ export class SmarketsFetcher implements IExchangeFetcher, targetCount?: number ): Promise { - let allEvents: SmarketsRawEvent[] = []; + const allEvents: SmarketsRawEvent[] = []; let lastId: string | undefined; let page = 0; @@ -461,7 +469,7 @@ export class SmarketsFetcher implements IExchangeFetcher