Files
eth_hedge_sim/docs/审计说明-2026-08-07-期期对冲.md
dekun ec244c63c6 Add option-option hedge mode with SIM/LIVE parity.
Mutual hedge_mode, amplitude OTM selection, 1:1 risk sizing, win-leg/full close, dual audits and docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 16:01:16 +08:00

34 lines
1.7 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-07 期期对冲
## 范围
期期对冲(`hedge_mode=option_option`):振幅选约、1:1 定仓、SIM/LIVE 开平、盈利腿/全平、资金门、设置与 Plan UI。
## 审计 #1 — Bugbot
| 问题 | 级别 | 处理 |
|------|------|------|
| LIVE 盈利腿卖出后重试可能双卖 | high | 先 `status=closing` 再下单;`closing` 态只做账本收尾 |
| 到期走永期 `close_group` 漏 Put | high | 新增 `close_oo_full`;引擎到期/紧急走全平;LIVE `live_sell_oo_both` |
| opening 恢复不识别 Put | high | opening intent 的 `perp_side` 写入 `oo_put:{inst}` 标记第二腿 |
| 资金门未计 cushion | medium | `assess_open_capacity` 期期需求 × `oo_budget_cushion` |
## 审计 #2 — Security Review
| 问题 | 级别 | 处理 |
|------|------|------|
| 到期/紧急仍用 perp `close_group` | high | 同 #1OO 全平分支 |
| recover_stuck_opening 非 OO 感知 | high | intent 标记 Put;完整 OO 扫描恢复仍列为后续加固 |
| LIVE 盈利腿非原子 | high | closing 标记 + skip_market 收尾 |
| Put 失败 Call 回滚不确定 | medium | 保留 opening(既有);与 OO intent 标记配合人工/恢复 |
| size_and_gate hedge_mode 参数与 ledger 可能不一致 | medium | 正常路径同 tick 读写 DBgate 读 ledger |
## 结论
两轮审计指出的 **blocker 级交易安全问题已在代码中修补**(全平路径、closing 防重入、资金门 cushion、intent 标记)。
`recover_stuck_opening` 完整双腿扫描仍建议下一迭代专项测试;当前以 intent 标记降低孤儿 Put 风险。
## 测试
- `tests/test_oo_selection_sizing.py``tests/test_risk_sizing.py` 通过。