stability and error cleaning. rule to read specs
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user