Derive market order protection from visible opposing depth

This commit is contained in:
2026-12-03 07:18:25 +08:00
parent f90605bfc7
commit 5d82be0091
10 changed files with 201 additions and 33 deletions
+18
View File
@@ -858,3 +858,21 @@ sequenceDiagram
E-->>C: 拒绝请求,保留账户余额与挂单
end
```
### 市价单按盘口深度定价
```mermaid
sequenceDiagram
participant C as 客户端
participant E as estimate.rs 或 market.rs 与 book.rs
participant R as resident.rs
participant B as matching 盘口
C->>E: 买入 1.80 美元,省略最高价
E->>R: 用本事务已同步的 YES 盘口计算保护价
R->>B: 读取最优价起的卖盘档位
B-->>R: 0.40 有 2 份,0.50 有 3 份
R->>R: 累计金额,第二档覆盖 1.80 美元
R-->>E: 保护价 0.50,包含互补 NO 买单形成的卖盘
E->>B: 用预算和保护价计算可成交数量
E-->>C: 估价返回预期成交,下单提交成功后返回实际成交
```