This commit is contained in:
薇薇安 2026-02-17 23:06:22 +08:00
parent 60a7e15100
commit b0392f358e

View File

@ -406,7 +406,7 @@ async def sync_trades_from_binance(
- sync_all_symbols=False: 仅对DB 中近期有记录的 symbol拉取订单默认避免全市场请求
"""
try:
logger.info(f"开始从币安同步历史订单(最近{days}...")
logger.info(f"开始从币安同步历史订单(最近{days}sync_all_symbols={sync_all_symbols}account_id={account_id or DEFAULT_ACCOUNT_ID}...")
# 导入必要的模块
trading_system_path = project_root / 'trading_system'
@ -524,6 +524,8 @@ async def sync_trades_from_binance(
logger.warning(f" [{idx}/{len(symbol_list)}] 获取 {symbol} 订单失败: {e}")
continue
logger.info(f"✓ 从币安获取到 {len(all_orders)} 个已成交订单(涉及 {len(symbol_list)} 个交易对)")
if len(all_orders) == 0:
logger.warning(f"⚠️ 从币安获取到的订单数为 0可能原因1) 时间范围内确实没有订单 2) 交易对列表为空 3) API 调用失败。时间范围: {datetime.fromtimestamp(start_ts_sec)}{datetime.fromtimestamp(end_ts_sec)}")
except Exception as e:
logger.error(f"获取币安订单失败: {e}", exc_info=True)
raise HTTPException(status_code=500, detail=f"获取币安订单失败: {str(e)}")