Account for fractional outcome sets from split through redemption

This commit is contained in:
2026-12-03 06:53:37 +08:00
parent 7b26767a97
commit 2c4179a64e
17 changed files with 492 additions and 108 deletions
+30
View File
@@ -734,3 +734,33 @@ sequenceDiagram
E->>B: 从已提交变更刷新盘口,重启时恢复活跃订单
C->>E: 在已进入连续交易的子盘提交新单
```
### 小数份额、抵押和兑付
```mermaid
flowchart LR
command["command.rs"] --> market["market.rs"]
market --> inventory["inventory.rs"]
inventory --> ledger["ledger.rs"]
inventory --> schema["schema.sql"]
portfolio["portfolio.rs / portfolio.sql"] --> schema
holders["holders.rs / holders.sql"] --> schema
oi["open_interest.rs / open_interest.sql"] --> schema
activity["activity.rs / activity.sql"] --> schema
```
```mermaid
sequenceDiagram
participant C as 客户端
participant E as Exchange
participant D as SQLite
C->>E: split 1.500001 对
E->>D: 同一事务扣现金、增抵押、分别记 YES 和 NO、写活动及回执
C->>E: 卖单预留 1 YES
C->>E: merge 0.500001 对
E->>D: 检查两侧可用份额,扣两侧余量,返还 500001 微元
C->>E: 收盘、裁决并 redeem
E->>D: 按结果核销余仓、返还可兑现金并保存回执
C->>E: 重启后重发相同兑付请求
E-->>C: 返回已提交回执
```