diff --git a/backend/check_abnormal_orders.py b/backend/check_abnormal_orders.py index a2c6976..a5f8f56 100644 --- a/backend/check_abnormal_orders.py +++ b/backend/check_abnormal_orders.py @@ -173,10 +173,19 @@ def check_abnormal_orders(): entry_price = order[4] filled_price = order[5] - time_str = last_time.strftime('%H:%M:%S') if last_time else 'N/A' + # last_time 是字符串,直接格式化 + if last_time: + if isinstance(last_time, str): + time_str = last_time[11:19] # 提取 HH:MM:SS 部分 + else: + time_str = last_time.strftime('%H:%M:%S') + else: + time_str = 'N/A' + filled_str = f"{filled_price:.2f}" if filled_price else "NULL" + entry_str = f"{entry_price:.2f}" if entry_price else "NULL" print(f" {time_str} | {symbol} | {side:4s} | {status:15s} | " - f"入场:{entry_price:.2f} 成交:{filled_str}") + f"入场:{entry_str} 成交:{filled_str}") print() print("=" * 80)