From 028180ca161969cd1870156229554810ec32b3d4 Mon Sep 17 00:00:00 2001 From: Lesigh-3100 Date: Mon, 27 Nov 2023 11:36:27 +0200 Subject: [PATCH] Add handling for instances where Stablecoin pool cannot be found for USD conversion --- fastlane_bot/bot.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fastlane_bot/bot.py b/fastlane_bot/bot.py index 9af35578b..2f4a7ebd1 100644 --- a/fastlane_bot/bot.py +++ b/fastlane_bot/bot.py @@ -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