Update src/trading/buyer.py

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Anton
2025-06-15 21:28:03 +02:00
committed by GitHub
parent 8f8fa2a526
commit ec1c3afae4
+3
View File
@@ -280,6 +280,9 @@ class TokenBuyer(Trader):
logger.warning(f"Failed to get actual execution price from bonding curve: {e}")
# Fallback to EXTREME_FAST estimate
tokens_received = self.extreme_fast_token_amount if self.extreme_fast_mode else self.amount / await self.curve_manager.calculate_price(token_info.bonding_curve)
+ if tokens_received == 0:
+ logger.error("Fallback failed unable to determine tokens received")
+ return 0.0, 0.0
return self.amount / tokens_received, tokens_received