Serve condition-scoped portfolio valuations from marked holdings

This commit is contained in:
2026-12-03 12:31:58 +08:00
parent 5696e3dae2
commit e26ba27a24
13 changed files with 302 additions and 16 deletions
+24
View File
@@ -333,3 +333,27 @@ sequenceDiagram
E-->>H: 每个可见市场一行
H-->>C: 200 data 数组,未找到返回空数组
```
### 查询持仓价值
`GET /v2/value?user=alice&condition=e` 返回该账户在市场 e 的持仓价值,单位为模拟美元。使用已登记的本地账户名或 20 字节钱包地址。省略 condition 查询所有已持有市场。无持仓的钱包返回零,仅有现金的账户也返回零。
```mermaid
flowchart LR
H["market_http.rs · GET /v2/value"] --> V["exchange/portfolio/http.rs"]
V --> A["exchange/portfolio.rs"] --> S["exchange/portfolio/value.sql"]
```
```mermaid
sequenceDiagram
participant C as 客户端
participant H as market_http.rs
participant E as Exchange
C->>H: GET /v2/value?user=alice&condition=e
H->>E: 读取 e 的所有结果资产价值
alt 持仓均可估值
H-->>C: 200,data 含 proxy_wallet 和 value
else 非零持仓缺价
H-->>C: 503,Retry-After 提示重试
end
```