feat(indicator): per-interval S/R + Range + LSLine + Donchian 箱体(ADR-0003)
按 ADR-0003 把 Support / Resistance / Range / LSLine 从顶层下沉进 IntervalTechnicals,每个周期独立计算;顶层 5 字段保留为 Intervals[primary] 镜像(单一来源,不双写)以维持向后兼容的 JSON shape。 新增 BoxBreak(Donchian 风格,lookback=20 根不含当前根,K 线 < 21 → nil), 落到 IntervalTechnicals.Box。 IndicatorComputer.Compute 签名升级到 longShortByInterval map: market_context 改为并发拉取 15m/1h/4h/1d 的全局 LSR,1w 不在 Binance LSR 支持列表 → 加 warning lsr_unsupported_interval:1w。 测试:boxBreak 6 个 case(inside/break_up/break_down/insufficient/2 个 parse 失败)+ per-interval Support/Resistance/Range 跨周期断言 + 镜像不变量 + 缺 LSR key → LongShortLine nil。indicator.go 平均覆盖 97.26%(boxBreak 100%)。
This commit is contained in:
@@ -59,14 +59,15 @@ type TakerVolumeRepository interface {
|
||||
// 重复 IO。
|
||||
//
|
||||
// klinesByInterval 是按周期分组的 K 线 map(每周期一份升序切片);
|
||||
// primaryInterval 指定哪个周期参与 support/resistance/range/longShortLine
|
||||
// 的计算(其它周期只参与 Intervals 多周期指标如 Bollinger / Vegas)。
|
||||
// primaryInterval 决定顶层 TechnicalStructure 镜像哪个周期;所有周期
|
||||
// 都会独立填充进 Intervals。longShortByInterval 按周期分组的 LSR map
|
||||
// (某周期缺失时,该周期 IntervalTechnicals.LongShortLine 为 nil)。
|
||||
// 实现可见 internal/usecase/indicator.go。
|
||||
type IndicatorComputer interface {
|
||||
Compute(
|
||||
klinesByInterval map[string][]entity.Kline,
|
||||
primaryInterval string,
|
||||
longShort []entity.LongShortRatio,
|
||||
longShortByInterval map[string][]entity.LongShortRatio,
|
||||
) entity.TechnicalStructure
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user