Route manual USDT/USDC convert through trading account (not funding).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-30 00:23:16 +08:00
parent 0837982714
commit a9939bbbdd
3 changed files with 23 additions and 4 deletions
+11 -1
View File
@@ -167,11 +167,15 @@ async def funds_summary(_user: Annotated[str, Depends(require_user)]) -> dict[st
async def funds_convert(
body: ConvertBody, _user: Annotated[str, Depends(require_user)]
) -> dict[str, Any]:
"""USDT↔USDC 市价兑换:一律在交易账户(对齐 OKX 现货 cash;SIM 同口径)。"""
s = get_settings()
rate = usdc_usdt_mid_rate()
if s.is_sim:
r = SimFundsWallets(get_db()).convert(
direction=body.direction, amount=float(body.amount), rate=rate
direction=body.direction,
amount=float(body.amount),
rate=rate,
account="trading",
)
if not r.get("ok"):
raise HTTPException(status_code=400, detail=r.get("detail") or "兑换失败")
@@ -186,6 +190,12 @@ async def funds_convert(
)
finally:
client.close()
try:
from ..strategy.open_capacity import invalidate_live_balance_cache
invalidate_live_balance_cache()
except Exception:
pass
if not r.get("ok"):
raise HTTPException(status_code=400, detail=r.get("detail") or "兑换失败")
return r
+9
View File
@@ -5,6 +5,15 @@
---
## 2026-07-30 — 手动兑换改走交易账户
### 变更
1. `/api/funds/convert`SIM)改为 `account=trading`;LIVE 本就现货交易账户,兑换后清余额缓存。
2. 设置页文案改为「交易账户」兑换。
---
## 2026-07-30 — 持仓锁定出场目标 / 暂停以损定仓重算
### 变更
+3 -3
View File
@@ -1474,8 +1474,8 @@ export default function SettingsPage() {
onToggle={() => setFundsRulesOpen((v) => !v)}
>
<p>
OKX USDC-USDT<strong></strong>
{" "}
OKX USDC-USDT<strong></strong>
{" "}
{usdcRate != null ? `1 USDC ≈ ${usdcRate.toFixed(4)} USDT` : "—"}
</p>
<p>
@@ -1489,7 +1489,7 @@ export default function SettingsPage() {
</RulesFold>
<section className="settings-section">
<h3>USDT USDC</h3>
<h3> · USDT USDC</h3>
<div className="settings-fields">
<div className="field">
<label htmlFor="convertDir"></label>