Files
eth_hedge_sim/docs/审计修改方案-2026-08-08-交易所SoT续.md

47 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 审计修改方案 — 2026-08-08 交易所 SoT 续修
## 目标
实盘以交易所仓位/成交为准;本地仅镜像。修完后无 P0/P1 仓位与状态机硬伤。
## 修改清单
### P0 状态机与错腿
1. `closing` 加入 `BLOCKING_STATUSES`;引擎 manage + emergency 处理 closing
2. OKX `close_winning_oo`:先处理 closing(对齐 BN
3. emergency / `close_group`:检测期期 → `close_oo_full`
4. 到期:期权交易所未空 → fail-closed;空后只平永续;fill 不用 intrinsic
5. recover_opening:解析 `oo_put:`,双腿皆空才清槽
6. 期期盈利腿:交易所张数下单,成交均价入账,验空再落 residual
### P1 镜像与可用性
7. 残仓已空:零价镜像仅标记 `exchange_flat`,不伪造交割现金(PnL 标未知/0+note
8. `close_oo_full`:用 fills 汇总 realized_pnl
9. repair / abandon:交易所 size;永续已空可归档
10. 币安余额接入资金门(能查多少接多少)
11. 半自动:出场前要求盘口可成交(bid/ask 存在),否则 liquidity_wait
### 验收
- 单测覆盖 closing / emergency-OO / expiry 无 intrinsic / recover Put / BN bal stub
- 再审计无 P0;P1 交割账单拉取可标「后续」若交易所 API 未接
### 实施结果(2026-08-08
| 项 | 状态 |
|----|------|
| closing BLOCKING + engine | ✅ |
| OKX OO win 顺序 + 交易所成交 | ✅ |
| emergency/close_group → OO full | ✅ |
| 到期无 intrinsic;只平永续 | ✅ |
| recover oo_put 孤儿 Put | ✅ |
| repair/abandon 交易所 size | ✅ |
| BN 余额资金门 | ✅ |
| 半自动买一闸 | ✅ |
| 交割账单拉价 | ✅ OKX bills type=3/subType170-172BN exerciseRecord |
| 期期 LIVE 开仓账本 | ✅ 扣 Call/Put 权利金+手续费 |
再审计:仓位/成交/交割 SoT 主路径已闭环;无剩余 P0/P1。