Skip to content

Commit

Permalink
Add handling for instances where Stablecoin pool cannot be found for …
Browse files Browse the repository at this point in the history
…USD conversion
  • Loading branch information
Lesigh-3100 committed Nov 27, 2023
1 parent b1de6b8 commit 028180c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fastlane_bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,8 +766,10 @@ def calculate_profit(
raise str(e)
else:
best_profit_eth = best_profit_fl_token

usd_eth_conversion_rate = Decimal(str(CCm.bypair(pair=f"{self.ConfigObj.WRAPPED_GAS_TOKEN_KEY}/{self.ConfigObj.STABLECOIN_KEY}")[0].p))
try:
usd_eth_conversion_rate = Decimal(str(CCm.bypair(pair=f"{self.ConfigObj.WRAPPED_GAS_TOKEN_KEY}/{self.ConfigObj.STABLECOIN_KEY}")[0].p))
except Exception:
usd_eth_conversion_rate = Decimal("NaN")
best_profit_usd = best_profit_eth * usd_eth_conversion_rate
return best_profit_fl_token, best_profit_eth, best_profit_usd

Expand Down

0 comments on commit 028180c

Please sign in to comment.