|
@@ -63,7 +63,7 @@ class TradingEngine:
|
|
|
cache_age = self.market_monitor.get_cache_age_seconds()
|
|
|
|
|
|
# Use cached data if it's fresh (less than 30 seconds old)
|
|
|
- if cached_balance and cache_age < 30:
|
|
|
+ if cached_balance and cache_age is not None and cache_age < 30:
|
|
|
logger.debug(f"Using cached balance (age: {cache_age:.1f}s)")
|
|
|
return cached_balance
|
|
|
|
|
@@ -79,7 +79,7 @@ class TradingEngine:
|
|
|
cache_age = self.market_monitor.get_cache_age_seconds()
|
|
|
|
|
|
# Use cached data if it's fresh (less than 30 seconds old)
|
|
|
- if cached_positions is not None and cache_age < 30:
|
|
|
+ if cached_positions is not None and cache_age is not None and cache_age < 30:
|
|
|
logger.debug(f"Using cached positions (age: {cache_age:.1f}s): {len(cached_positions)} positions")
|
|
|
return cached_positions
|
|
|
|
|
@@ -95,7 +95,7 @@ class TradingEngine:
|
|
|
cache_age = self.market_monitor.get_cache_age_seconds()
|
|
|
|
|
|
# Use cached data if it's fresh (less than 30 seconds old)
|
|
|
- if cached_orders is not None and cache_age < 30:
|
|
|
+ if cached_orders is not None and cache_age is not None and cache_age < 30:
|
|
|
logger.debug(f"Using cached orders (age: {cache_age:.1f}s): {len(cached_orders)} orders")
|
|
|
return cached_orders
|
|
|
|