feat: single-row funds strip on header and system settings page
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -85,11 +85,24 @@ def profit_loss_ratio_from_trades(trades: list[dict[str, Any]] | None) -> float
|
||||
return profit_loss_ratio_from_averages(avg_win, avg_loss)
|
||||
|
||||
|
||||
def options_funding_label(
|
||||
funding_usdc: float | None,
|
||||
funding_usdt: float | None = None,
|
||||
) -> str:
|
||||
parts: list[str] = []
|
||||
if funding_usdc is not None:
|
||||
parts.append(f"{float(funding_usdc):.2f} USDC")
|
||||
if funding_usdt is not None:
|
||||
parts.append(f"{float(funding_usdt):.2f} USDT")
|
||||
return " · ".join(parts) if parts else "—"
|
||||
|
||||
|
||||
def total_funds_usdt(
|
||||
funding_usdt: float | None,
|
||||
trading_usdt: float | None,
|
||||
options_trading_usdc: float | None = None,
|
||||
options_funding_usdc: float | None = None,
|
||||
options_funding_usdt: float | None = None,
|
||||
) -> float | None:
|
||||
if funding_usdt is None:
|
||||
return None
|
||||
@@ -97,6 +110,8 @@ def total_funds_usdt(
|
||||
total = float(funding_usdt) + float(trading_usdt or 0)
|
||||
if options_funding_usdc is not None:
|
||||
total += float(options_funding_usdc)
|
||||
if options_funding_usdt is not None:
|
||||
total += float(options_funding_usdt)
|
||||
if options_trading_usdc is not None:
|
||||
total += float(options_trading_usdc)
|
||||
return round(total, 2)
|
||||
|
||||
Reference in New Issue
Block a user