feat: 修复报错

This commit is contained in:
Daniel
2026-03-26 14:13:44 +08:00
commit b2223ec058
31 changed files with 17401 additions and 0 deletions

44
shared/protocol.md Normal file
View File

@@ -0,0 +1,44 @@
# Kline JSON Protocol (Go <-> Python)
用于 Go 行情采集端与 Python 展示/回测端的数据交换。
## 标准消息格式
```json
{
"type": "kline",
"source": "binance_ws",
"symbol": "btcusdt",
"interval": "1m",
"event_time": 1711430400000,
"open_time": 1711430400000,
"close_time": 1711430459999,
"open": "68000.00",
"high": "68025.00",
"low": "67990.00",
"close": "68010.00",
"volume": "12.40",
"trade_num": 102,
"final": true
}
```
## 字段说明
- `type`: 消息类型,固定 `kline`
- `source`: 数据来源,默认 `binance_ws`
- `symbol`: 交易对(小写,如 `btcusdt`
- `interval`: K 线周期(如 `1m``5m``1h`
- `event_time`: 事件时间(毫秒时间戳)
- `open_time`: K 线起始时间(毫秒时间戳)
- `close_time`: K 线结束时间(毫秒时间戳)
- `open/high/low/close`: 价格字段,使用字符串保证精度
- `volume`: 成交量,字符串
- `trade_num`: 成交笔数,整数
- `final`: 是否为收盘完成 K 线(`true` 表示该根 K 线已闭合)
## 约束约定
- 时间戳统一为 UTC 毫秒
- 数值字段在传输层统一为字符串trade_num 除外),消费端按需转换
- 数据可通过 Redis Pub/Sub、文件流jsonl或消息队列进行传输