Prevent env autofill from overwriting OKX API keys when saving hedge settings.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -105,18 +105,21 @@ def total_funds_usdt(
|
||||
options_funding_usdt: float | None = None,
|
||||
options_trading_usdt: float | None = None,
|
||||
) -> float | None:
|
||||
if funding_usdt is None:
|
||||
parts = [
|
||||
funding_usdt,
|
||||
trading_usdt,
|
||||
options_funding_usdc,
|
||||
options_funding_usdt,
|
||||
options_trading_usdc,
|
||||
options_trading_usdt,
|
||||
]
|
||||
if all(v is None for v in parts):
|
||||
return None
|
||||
try:
|
||||
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)
|
||||
if options_trading_usdt is not None:
|
||||
total += float(options_trading_usdt)
|
||||
total = 0.0
|
||||
for v in parts:
|
||||
if v is not None:
|
||||
total += float(v)
|
||||
return round(total, 2)
|
||||
except (TypeError, ValueError):
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user