Skill站外收录 @skilllib/skill-2014279392149581826
indicator-series
实现高精度批量指标计算,作为其他实现形式的基准参考。通过预分配数组优化性能,在确保数值准确性的前提下提升执行效率,并配合详尽的回归测试与基准验证,保证算法在不同场景下的稳定性和一致性。
数据与分析 AI 技能
Skills.MD
# Series indicator development
## File structure
- Implementation: `src/{category}/{Indicator}/{Indicator}.StaticSeries.cs`
- Test: `tests/indicators/{category}/{Indicator}/{Indicator}.StaticSeries.Tests.cs`
- Catalog: `src/{category}/{Indicator}/{Indicator}.Catalog.cs`
- Categories: a-d, e-k, m-r, s-z (alphabetical)
## Performance optimization
**Array allocation pattern** (recommended for new implementations):
```csharp
TResult[] results = new TResult[length];
// ... assign results[i] = new TResult(...);
return new List<TResult>(results); // NOT results.ToList()
```
**When to use**: Indicators with predictable result counts show ~2x improvement (Issue #1259)
**When NOT to use**: Benchmark first. Some indicators (ADL) remain faster with `List.Add()`
**Conversion strategy**:
1. Benchmark existing List-based implementation
2. Convert to array pattern
3. Benchmark again
4. Revert if no improvement or regression
## Required implementation
Beyond the .StaticSeries.cs file, ensure:
- [ ] **Catalog registration**: Create `src/**/{IndicatorName}.Catalog.cs` and register in `src/_common/Catalog/Catalog.Listings.cs`
- [ ] **Unit tests**: Create `tests/indicators/**/{IndicatorName}.StaticSeries.Tests.cs`
- Inherit from `StaticSeriesTestBase`
- Include `[TestCategory("Regression")]` for baseline validation
- Verify against manually calculated reference values
- [ ] **Performance benchmark**: Add to `tools/performance/SeriesIndicators.cs`
- [ ] **Public documentation**: Update `docs/_indicators/{IndicatorName}.md`
## Precision testing patterns
- **Store reference data separately**: Create `{Indicator}.Data.cs` files with arrays of expected values at maximum precision
- **Excel manual calculations**: Export at highest precision available (~14 decimal places for `default.csv` values ~200)
- **Baseline regression validation**: Compare full dataset against reference arrays using Money10-Money12 precision
- **Spot check assertions**: Use Money4 for individual sample value readability (sanity checks, not proofs)
- **Longer datasets**: May require lower precision (e.g., Money10 for 15k quotes) due to accumulated floating-point error
- **Document degradation**: When precision must be lowered, explain why in test comments
## Examples
- **Simple single-value**: `src/s-z/Sma/Sma.StaticSeries.cs`
- **Exponential smoothing**: `src/e-k/Ema/Ema.StaticSeries.cs`
- **Complex multi-stage**: `src/a-d/Adx/Adx.StaticSeries.cs`
- **Multi-line results**: `src/a-d/Alligator/Alligator.StaticSeries.cs`
See `references/decision-tree.md` for result interface selection guidance.
## Constitutional constraints
- **Series is truth**: All other styles (BufferList, StreamHub) MUST match Series results exactly
- **Verify against authoritative sources**: NEVER trust other libraries—use reference publications only
- **Algebraic stability**: Prefer boundary detection over clamping
- **Real-world testing**: Synthetic boundary data may miss precision edge cases
- **Fix formulas, not symptoms**: When all styles fail identically, fix the core algorithm
NEVER modify formulas without verification against authoritative mathematical references. See `src/AGENTS.md` for formula protection rules.
---
Last updated: December 31, 2025
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「indicator-series」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次