stability and error cleaning. rule to read specs

This commit is contained in:
Dobromir Popov
2025-08-10 13:05:41 +03:00
parent e05163deb7
commit 6861d0f20b
4 changed files with 51 additions and 8 deletions

View File

@@ -2513,7 +2513,7 @@ class TradingExecutor:
'error': str(e)
}
def execute_trade(self, symbol: str, action: str, quantity: float) -> bool:
def execute_trade(self, symbol: str, action: str, quantity: float, current_price: Optional[float] = None) -> bool:
"""Execute a trade directly (compatibility method for dashboard)
Args:
@@ -2525,10 +2525,9 @@ class TradingExecutor:
bool: True if trade executed successfully
"""
try:
# Get current price
current_price = None
# Always get real current price - never use simulated data
current_price = self._get_real_current_price(symbol)
# Get current price (allow explicit price or fallback to real fetch)
if current_price is None:
current_price = self._get_real_current_price(symbol)
if current_price is None:
logger.error(f"Failed to get real current price for {symbol}")
return False