Convert NO positions and conserve collateral across fixed negative-risk groups
This commit is contained in:
@@ -315,3 +315,24 @@ sequenceDiagram
|
||||
E->>D: 结算成交,释放未卖出份额
|
||||
E-->>C: 返回实际成交与收入
|
||||
```
|
||||
|
||||
## 互斥市场的转换与兑付
|
||||
|
||||
`command.rs` 解析组合定义和转换,`market.rs` 将请求交给 `neg_risk.rs`。后者使用 `ledger.rs` 调整可用持仓、用 `schema.sql` 定义的成员表和准备金保存组合状态。`catalog.rs` 返回每个成员的组合 ID 与固定序号。
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant U as 账户
|
||||
participant E as Exchange
|
||||
participant N as neg_risk.rs
|
||||
participant D as SQLite
|
||||
U->>E: convert 交出甲、乙各两份 NO
|
||||
E->>N: 开启写事务并核对请求 ID
|
||||
N->>D: 扣除可用 NO,记入其他选项的 YES
|
||||
N->>D: 从两盘转出 400 分,200 分退给账户,200 分留在组合
|
||||
E-->>U: 事务提交后返回转换明细
|
||||
E->>N: finalize 确认唯一赢家
|
||||
N->>D: 将组合准备金拨给赢家,保存赢家 ID
|
||||
E->>D: 核对该盘口的应付金额并提交裁决
|
||||
U->>E: redeem 按持有份额领取兑付
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user