fix期权复盘与数据统计双口径盈亏,并修复卖回封顶导致盈利单冻成亏损。
平仓卖光可卖币后再按账户差分结算复盘;数据统计改为历史币盈亏×卖回价;复盘展示初始权利金与盈利率,并附历史修复脚本。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1225,7 +1225,7 @@ def register_options_routes(app: Flask, cfg: dict[str, Any]) -> None:
|
||||
underlying=underlying,
|
||||
inst_id=inst_id,
|
||||
)
|
||||
if out.get("ok"):
|
||||
if out.get("ok") and out.get("sell_complete", True) and not out.get("incomplete"):
|
||||
try:
|
||||
from lib.options.options_account_pnl_lib import try_settle_after_sellback
|
||||
|
||||
@@ -1235,10 +1235,14 @@ def register_options_routes(app: Flask, cfg: dict[str, Any]) -> None:
|
||||
ex,
|
||||
bridge_id=int(bid) if bid is not None else None,
|
||||
cfg=cfg,
|
||||
underlying=underlying,
|
||||
sell_complete=True,
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
_mark_balances_stale(cfg)
|
||||
elif out.get("ok"):
|
||||
_mark_balances_stale(cfg)
|
||||
return jsonify(out)
|
||||
|
||||
@app.route("/api/options/convert/quote", methods=["POST"])
|
||||
|
||||
Reference in New Issue
Block a user