From 7adf5c7126f9ebfe5af99cb3028df03c478daa6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=96=87=E8=96=87=E5=AE=89?= Date: Fri, 23 Jan 2026 20:03:07 +0800 Subject: [PATCH] a --- backend/api/routes/stats.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/api/routes/stats.py b/backend/api/routes/stats.py index 606a2d2..45242f9 100644 --- a/backend/api/routes/stats.py +++ b/backend/api/routes/stats.py @@ -45,6 +45,7 @@ async def get_performance_stats( @router.get("/dashboard") async def get_dashboard_data(account_id: int = Depends(get_account_id)): """获取仪表板数据""" + logger.info(f"获取仪表板数据 (account_id={account_id})") try: account_data = None account_error = None @@ -180,7 +181,7 @@ async def get_dashboard_data(account_id: int = Depends(get_account_id)): try: from database.models import TradingConfig total_balance = float(account_data.get('total_balance', 0)) - max_total_position_percent = float(TradingConfig.get_value('MAX_TOTAL_POSITION_PERCENT', 0.30)) + max_total_position_percent = float(TradingConfig.get_value('MAX_TOTAL_POSITION_PERCENT', 0.30, account_id=account_id)) # 名义仓位(notional)与保证金占用(margin)是两个口径: # - 名义仓位可以 > 100%(高杠杆下非常正常) @@ -241,7 +242,7 @@ async def get_dashboard_data(account_id: int = Depends(get_account_id)): from database.models import TradingConfig config_keys = ['STOP_LOSS_PERCENT', 'TAKE_PROFIT_PERCENT', 'LEVERAGE', 'MAX_POSITION_PERCENT'] for key in config_keys: - config = TradingConfig.get(key) + config = TradingConfig.get(key, account_id=account_id) if config: trading_config[key] = { 'value': TradingConfig._convert_value(config['config_value'], config['config_type']),