Add error logging for failed order execution to diagnose rejections

This commit is contained in:
justin committed 2026-02-04 16:27:14 -07:00
1 parent 3bad01c2f3
commit 122f719b8d
1 file changed
+5
+5
View File
@@ -1041,6 +1041,11 @@ def main():
position_state.trailing_stop = stop_loss position_state.trailing_stop = stop_loss
debug_print(f"Trailing stop initialized: ${stop_loss:.2f}") debug_print(f"Trailing stop initialized: ${stop_loss:.2f}")
else:
logger.error(f"❌ Order execution failed: {signal.upper()} ${position_size:.2f}")
logger.error(f" Possible reasons: Order rejected, timeout, or market closed")
debug_print(f"Order execution returned None - order not filled")
signal = None
else: else:
logger.warning(f"⚠️ Insufficient buying power: ${buying_power:.2f} < ${position_size:.2f}") logger.warning(f"⚠️ Insufficient buying power: ${buying_power:.2f} < ${position_size:.2f}")
debug_print(f"Insufficient buying power: ${buying_power:.2f} < ${position_size:.2f}") debug_print(f"Insufficient buying power: ${buying_power:.2f} < ${position_size:.2f}")