Use exchange fees, UPL, funding for LIVE PnL; USDC 1:1 to USDT.

Option open P&L stays local (option net); exit target ignores estimated close fees.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-26 21:49:20 +08:00
parent b7e055e37b
commit ca66c494e7
12 changed files with 685 additions and 25 deletions
+20
View File
@@ -0,0 +1,20 @@
"""实盘金额口径:统一折 USDT(USDC 等 1:1)。"""
from __future__ import annotations
def to_usdt(amount: float, ccy: str | None = None) -> float:
"""按约定将币种金额折成 USDTUSDC/USD/USDT 一律 1:1。"""
a = float(amount or 0.0)
if a == 0.0:
return 0.0
c = (ccy or "USDT").strip().upper()
if c in ("USDT", "USDC", "USD", ""):
return a
# 其他币种暂按面值记(极少见);后续可扩汇率
return a
def abs_fee_usdt(fee: float, ccy: str | None = None) -> float:
"""手续费记为正成本(USDT)。"""
return abs(to_usdt(fee, ccy))