Route manual USDT/USDC convert through trading account (not funding).
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -5,6 +5,15 @@
|
||||
|
||||
---
|
||||
|
||||
## 2026-07-30 — 手动兑换改走交易账户
|
||||
|
||||
### 变更
|
||||
|
||||
1. `/api/funds/convert`(SIM)改为 `account=trading`;LIVE 本就现货交易账户,兑换后清余额缓存。
|
||||
2. 设置页文案改为「交易账户」兑换。
|
||||
|
||||
---
|
||||
|
||||
## 2026-07-30 — 持仓锁定出场目标 / 暂停以损定仓重算
|
||||
|
||||
### 变更
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user