Skip to content

Commit 2b50944

Browse files
committed
Ignore assets with null market_cap_rank
Brand new assets added to coingecko are shoved into the middle of the list without a rank and should be ignored
1 parent bb7053d commit 2b50944

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/coinrankEngine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const coinrankEngine = async (
6262

6363
const reply = await response.json()
6464
const marketsPage = asCoingeckoMarkets(reply)
65-
markets = [...markets, ...marketsPage]
65+
markets = [...markets, ...marketsPage.filter(m => m.rank != null)]
6666
page++
6767
if (page > NUM_PAGES) break
6868
}

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const asCoingeckoAsset = (raw: any) => {
3535
image: asString,
3636
current_price: asOptional(asNumber),
3737
market_cap: asOptional(asNumber),
38-
market_cap_rank: asNumber,
38+
market_cap_rank: asOptional(asNumber),
3939

4040
high_24h: asOptional(asNumber),
4141
low_24h: asOptional(asNumber),

0 commit comments

Comments
 (0)