Files
tick-stock-panel/docs/tickflow-pro-shared-rate-limit.md
T
dunmin1980andCursor f65aaa88f6 docs: clarify rate limit is process-local, not cross-product
Align the Pro rate-limit note with the critique: 80% applies inside
one process; Stage A cross-product safety relies on off-peak scheduling.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-19 09:36:55 +08:00

28 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# TickFlow Pro 限频安全预算(进程内 + 跨产品错峰)
## 决策(经 ChatGPT/Codex 评析修订)
- `backend/app/tickflow/rate_limits.py` 提供**单 Python 进程内**的 rpm 槽位限速与 `SAFETY_RPM_FACTOR=0.8`
- **不要**把「各进程各扣 80%」当成账户级共享限频:Gold Shadow 容器与 A 股面板进程状态独立,理论聚合可达 160%。
- Stage A 期间跨产品靠**错峰**,不在 Gold 上部署分布式限频重构。
## 预算表示例(Pro,单进程 80%)
| capability | 套餐 rpm | 进程内 80% |
|---|---:|---:|
| quote.batch | 120 | 96 |
| quote.pool | 60 | 48 |
| kline.daily.batch | 60 | 48 |
| kline.minute.batch | 30 | 24 |
| depth5.batch | 30 | 24 |
| adj_factor | 60 | 48 |
## 错峰(Stage A
- 盘中:优先 Gold Shadow 观察与 legacy `gold-monitor`
- A 股 Pro 探测/大批量同步:建议 **16:00 后**
- 禁止全市场一年分钟一次性回填。
## 实现要点
- `resolve_limit(..., apply_safety=True)` 默认对 rpm 做 `floor(rpm * 0.8)`
- `sleep_between_batches``index=0` 只占槽不 sleep(首批突发行为已有测试文档化);后续 batch 按槽位等待。
- 诊断可传 `apply_safety=False`;跨容器账户预算需另设(Stage A 不做)。
- 任一 429 / fallback 应记入证据链,禁止静默混源。