feat(market): Phase 1 扩展 — 更多 symbol + Bollinger/Vegas + 衍生品信号
- collector.symbols 与 supportedSymbols 加 SOL/BNB/DOGE,env-default 与 README 同步 - entity 追加 TechnicalStructure.Intervals(每周期 Bollinger + Vegas,omitempty 不破坏既有字段)与 DerivativesBundle.Signal - 新增纯解析 usecase derivatives_signal.go:fundingBias 绝对阈值、oiSignal 用 P20 baseline + 价格方向(OI up + 价格 up/down → long/short_building,funding 不参与方向)、lsrRegime 绝对阈值;signal 数据不足走 warnings 进 DataQuality - indicator.go 加 sma/stddev/ema/bollinger/vegas + computeIntervalTechnicals;IndicatorComputer 签名收 klines map - harness 同步:G12 扩入 derivatives_signal.go(含 Makefile G12.5/6 + ADR-0002 适用范围 + project-map / harness-health 更新)
This commit is contained in:
@@ -195,25 +195,29 @@ grep -rn "FundingRepo\|OIRepo\|LSRepo\|TakerRepo" internal/controller
|
||||
|
||||
## G12. 指标计算的 float64 边界
|
||||
|
||||
**规则**:`float64` 在 `internal/usecase/` 下**只允许出现在 `indicator.go` 内部**作为 transient 计算变量;进入 `entity` / 返回上层之前必须 `strconv.FormatFloat(_, 'f', -1, 64)` 转回 string。`internal/usecase/indicator.go` 同时**禁止** import `internal/repo/...` 的任何子包。
|
||||
**规则**:`float64` 在 `internal/usecase/` 下**只允许出现在纯解析 usecase 文件**(当前为 `indicator.go` 与 `derivatives_signal.go`)内部作为 transient 计算变量;进入 `entity` / 返回上层之前必须 `strconv.FormatFloat(_, 'f', -1, 64)` 转回 string。这些文件同时**禁止** import `internal/repo/...` 的任何子包。
|
||||
|
||||
**为什么**:G2 已经预留"指标计算中间过程可用 float64"的例外,但没有可机械验证的边界。Milestone 6 之后会有更多指标加入,必须把例外明文化、可 grep 化,避免某天 float64 悄悄出现在 entity 字段或被 repo 持久化。决策细节见 `ai/adr/0002-indicator-numeric-boundary.md`。
|
||||
**为什么**:G2 已经预留"指标计算中间过程可用 float64"的例外,但没有可机械验证的边界。Milestone 6 之后会有更多指标和衍生品信号加入,必须把例外明文化、可 grep 化,避免某天 float64 悄悄出现在 entity 字段或被 repo 持久化。决策细节见 `ai/adr/0002-indicator-numeric-boundary.md`。
|
||||
|
||||
**怎么验证**:
|
||||
**新增同形态文件时**:必须同步扩 Makefile 的 G12.1 白名单与 G12.5/6 子规则(参考 `derivatives_signal.go` 接入的方式),并把文件名加入本规则的"当前为"括注。
|
||||
|
||||
**怎么验证**(由 `make guard` 自动跑):
|
||||
```bash
|
||||
# usecase 下除 indicator.go 之外不得出现 float64
|
||||
grep -rn --include="*.go" "float64\|float32" internal/usecase | grep -v indicator
|
||||
# G12.1:usecase 下除白名单文件外不得出现 float64
|
||||
grep -rn --include="*.go" "float64\|float32" internal/usecase | grep -vE "indicator|derivatives_signal"
|
||||
# 期望:无输出
|
||||
|
||||
# indicator.go 不得 import 任何 repo 子包
|
||||
# G12.2/G12.3:indicator.go 不得 import repo 子包,也不得 import binance/postgres/pgx
|
||||
grep -n "internal/repo" internal/usecase/indicator.go
|
||||
# 期望:无输出
|
||||
|
||||
# indicator.go 不得 import binance / postgres / pgx
|
||||
grep -nE "binance|postgres|pgx" internal/usecase/indicator.go
|
||||
# 期望:无输出(注释中的 ADR 引用不算)
|
||||
|
||||
# entity 字段任何位置不得 float
|
||||
# G12.5/G12.6:derivatives_signal.go 同上
|
||||
grep -n "internal/repo" internal/usecase/derivatives_signal.go
|
||||
grep -nE "binance|postgres|pgx" internal/usecase/derivatives_signal.go
|
||||
# 期望:无输出
|
||||
|
||||
# G12.4:entity 字段任何位置不得 float
|
||||
grep -rn --include="*.go" "float64\|float32" internal/entity
|
||||
# 期望:无输出
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user