Skip to content

Commit

Permalink
handle missing coingecko keys in one more place
Browse files Browse the repository at this point in the history
  • Loading branch information
fhenneke committed Oct 11, 2024
1 parent 44aa063 commit 12e49a8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/price_providers/coingecko_pricing.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,12 @@ def get_token_id_by_address(self, token_address: str) -> str | None:
self.last_reload_time = (
time.time()
) # update the last reload time to current time
for token in self.filtered_token_list:
if token["platforms"].get("ethereum") == token_address:
return token["id"]
if (
self.filtered_token_list is not None
): # TODO: handle missing keys more systematically
for token in self.filtered_token_list:
if token["platforms"].get("ethereum") == token_address:
return token["id"]
return None

def fetch_api_price(
Expand Down

0 comments on commit 12e49a8

Please sign in to comment.