more live trades fix
This commit is contained in:
@ -1031,7 +1031,7 @@ class TradingOrchestrator:
|
||||
action_probs = [0.1, 0.1, 0.8] # Default distribution
|
||||
action_probs[action_idx] = confidence
|
||||
else:
|
||||
# Fallback to generic predict method
|
||||
# Fallback to generic predict method
|
||||
action_probs, confidence = model.predict(enhanced_features)
|
||||
except Exception as e:
|
||||
logger.warning(f"CNN prediction failed: {e}")
|
||||
|
@ -230,15 +230,25 @@ class TradingExecutor:
|
||||
required_capital = self._calculate_position_size(confidence, current_price)
|
||||
|
||||
# Get available balance for the quote asset
|
||||
available_balance = self.exchange.get_balance(quote_asset)
|
||||
|
||||
# If USDC balance is insufficient, check USDT as fallback (for MEXC compatibility)
|
||||
if available_balance < required_capital and quote_asset == 'USDC':
|
||||
# For MEXC, prioritize USDT over USDC since most accounts have USDT
|
||||
if quote_asset == 'USDC':
|
||||
# Check USDT first (most common balance)
|
||||
usdt_balance = self.exchange.get_balance('USDT')
|
||||
usdc_balance = self.exchange.get_balance('USDC')
|
||||
|
||||
if usdt_balance >= required_capital:
|
||||
available_balance = usdt_balance
|
||||
quote_asset = 'USDT' # Use USDT instead
|
||||
logger.info(f"BALANCE CHECK: Using USDT fallback balance for {symbol}")
|
||||
quote_asset = 'USDT' # Use USDT for trading
|
||||
logger.info(f"BALANCE CHECK: Using USDT balance for {symbol} (preferred)")
|
||||
elif usdc_balance >= required_capital:
|
||||
available_balance = usdc_balance
|
||||
logger.info(f"BALANCE CHECK: Using USDC balance for {symbol}")
|
||||
else:
|
||||
# Use the larger balance for reporting
|
||||
available_balance = max(usdt_balance, usdc_balance)
|
||||
quote_asset = 'USDT' if usdt_balance > usdc_balance else 'USDC'
|
||||
else:
|
||||
available_balance = self.exchange.get_balance(quote_asset)
|
||||
|
||||
logger.info(f"BALANCE CHECK: Symbol: {symbol}, Action: {action}, Required: ${required_capital:.2f} {quote_asset}, Available: ${available_balance:.2f} {quote_asset}")
|
||||
|
||||
|
Reference in New Issue
Block a user