Skip to content

Commit

Permalink
fix: add better logging handler from potentially changed pools #58
Browse files Browse the repository at this point in the history
  • Loading branch information
robcxyz committed Jul 4, 2024
1 parent 9a2f0c1 commit 746c7c3
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions balanced_backend/cron/token_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,17 @@ def run_token_stats(
)
t.total_supply = int(total_supply, 16) / 10 ** t.decimals

t.liquidity = sum([
i.base_supply * i.base_price for i in pools
if i.base_address == t.address
]) + sum([
i.quote_supply * i.quote_price for i in pools
if i.quote_address == t.address
])
try:
t.liquidity = sum([
i.base_supply * i.base_price for i in pools
if i.base_address == t.address
]) + sum([
i.quote_supply * i.quote_price for i in pools
if i.quote_address == t.address
])
except TypeError:
logger.info(f"No pool found for {t.name} - {t.address}")

session.merge(t)
session.commit()

Expand Down

0 comments on commit 746c7c3

Please sign in to comment.