Skip to content

Commit 46db3cc

Browse files
skip invalid coingecko data (#96)
1 parent ac2def8 commit 46db3cc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pyth_observer/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,12 @@ async def get_coingecko_prices(self):
270270
updates: Dict[str, int] = {} # Unix timestamps
271271

272272
for symbol in data:
273+
if "usd" not in data[symbol] or "last_updated_at" not in data[symbol]:
274+
logger.warning(
275+
f"CoinGecko data for {symbol} doesn't include `usd` and/or `last_updated_at`. CoinGecko returned: {data[symbol]}."
276+
)
277+
continue
278+
273279
prices[symbol] = data[symbol]["usd"]
274280
updates[symbol] = data[symbol]["last_updated_at"]
275281

0 commit comments

Comments
 (0)