Show position-limit freeze on hub and instance risk badges.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -97,17 +97,20 @@ APP_TIMEZONE=Asia/Shanghai
|
||||
|
||||
| 字段 | 说明 |
|
||||
|------|------|
|
||||
| `status` | `normal` / `freeze_1h` / `freeze_4h` / `freeze_daily` |
|
||||
| `status` | `normal` / `freeze_1h` / `freeze_4h` / `freeze_daily` / `freeze_position` |
|
||||
| `status_label` | 中文标签 |
|
||||
| `can_trade` | 是否允许新开仓(仅风控维度) |
|
||||
| `reason` | 悬停提示文案 |
|
||||
| `active_count` / `max_active_positions` | 当前活跃持仓与 `.env` 中 `MAX_ACTIVE_POSITIONS` |
|
||||
| `cooloff_until_ms` | 1h/4h 冷静期结束时间戳(毫秒) |
|
||||
| `freeze_until_ms` | 倒计时结束时间戳(日冻结为下一交易日切点) |
|
||||
| `freeze_remaining_sec` | 服务端计算的剩余秒数(供调试) |
|
||||
|
||||
**仓位上限冻结**:当活跃持仓数 ≥ 实例 `.env` 的 `MAX_ACTIVE_POSITIONS`(默认 1)且账户无时间类冻结时,徽章显示 **仓位上限冻结**;平仓后自动恢复 **正常**。时间冻结(1h/4h/日)优先展示。
|
||||
|
||||
## 前端倒计时
|
||||
|
||||
- 共用脚本:`static/account_risk_badge.js?v=3`
|
||||
- 共用脚本:`static/account_risk_badge.js?v=4`
|
||||
- 样式:`static/account_risk_badge.css`
|
||||
- 展示格式:`4h冻结 · 3h 12m`;日冻结为距下一交易日切点剩余时间
|
||||
- 倒计时优先用服务端 `freeze_remaining_sec` 推算结束时刻,避免绝对时间戳与时区/脏数据偏差
|
||||
@@ -118,7 +121,7 @@ APP_TIMEZONE=Asia/Shanghai
|
||||
|
||||
## 相关代码
|
||||
|
||||
- `account_risk_lib.py` — 状态机、`enrich_risk_status_countdown`、`on_user_initiated_close`
|
||||
- `account_risk_lib.py` — 状态机、`enrich_risk_status_countdown`、`apply_position_limit_risk`、`on_user_initiated_close`
|
||||
- `hub_bridge.py` — `/api/hub/account-risk/user-close`
|
||||
- `manual_trading_hub/hub.py` — 中控平仓成功后调用 user-close
|
||||
- `strategy_trend_register.py` — `stop_trend_pullback` 结束计划时登记风控
|
||||
|
||||
Reference in New Issue
Block a user