a
This commit is contained in:
parent
7a64ff44c2
commit
7adf5c7126
|
|
@ -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']),
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user