documentation by daveskender/stock.indicators
npx skills add https://github.com/daveskender/stock.indicators --skill documentation此技能涵盖位于 docs/ 文件夹中的 VitePress 文档站点的编写和更新,重点关注指标参考页面。
该站点使用 VitePress 和 Vue 3 构建。
| 路径 | 用途 |
|---|---|
docs/indicators/ | 每个指标一个 .md 文件(主要受众) |
docs/.vitepress/config.mts | 站点配置 — 导航、侧边栏、元数据 |
docs/.vitepress/components/ |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 在 Markdown 内部使用的 Vue 组件 |
docs/.vitepress/public/assets/ | 静态图片(webp,已优化) |
docs/.vitepress/public/data/ | 图表 JSON 文件(每个指标键一个) |
docs/guide/getting-started.md | 入门指南:安装 + 首次调用 |
docs/guide/index.md | 指南概览 + 样式比较 |
docs/guide/batch.md | 批量(系列)样式指南 |
docs/guide/buffer.md | 缓冲区列表样式指南 |
docs/guide/stream.md | 流式处理中心样式指南 |
docs/guide/customization.md | 自定义指标指南 |
docs/indicators.md | 指标概览/索引页面 |
docs/utilities/ | 实用工具 API 参考页面 |
docs/performance.md | 性能基准参考 |
排除在构建之外:AGENTS.md、PRINCIPLES.md 和 README.md 通过 config.mts 中的 srcExclude 排除,不得从指标页面链接。
# 从 /docs 文件夹
pnpm install
pnpm run docs:dev
# 站点在 http://localhost:5173/ 打开
docs/indicators/{Indicator}.md 处的每个指标页面都严格遵循此章节顺序。切勿省略章节;根据判断决定哪些可选元素适用。
---
title: 完整指标名称 (缩写)
description: 描述该指标测量内容的一句话。
---
title:人类可读的名称,当存在缩写时,将缩写放在括号内description:简洁(≤160 字符)、纯文本的句子 — 用于 SEO 和链接预览# 完整指标名称 (缩写)
由 作者姓名 创建,[指标名称](https://en.wikipedia.org/wiki/...) 是对其测量内容的简要描述。
[[讨论] 💬](https://github.com/DaveSkender/Stock.Indicators/discussions/{id} "关于此指标的社区讨论")
<IndicatorChartPanel indicator-key="{IndicatorKey}" />
规则:
[[讨论]] 链接docs/.vitepress/public/data/{IndicatorKey}.json 处存在图表 JSON 文件时,包含 <IndicatorChartPanel>;当不存在图表数据时(例如,简单的基元或二次分析页面)省略indicator-key 必须与 JSON 文件名完全匹配(PascalCase,无扩展名)// C# 使用语法
IReadOnlyList<{Indicator}Result> results =
quotes.To{Indicator}(param1, param2);
// C# 使用语法 作为注释;相关时添加 (使用收盘价) 或类似的限定词quotes.To{Indicator}(...) 行上## 参数
| 参数 | 类型 | 描述 |
| ----- | ---- | ----------- |
| `参数名` | int | 带约束的描述。默认值为 N。 |
当指标没有参数时(例如 ToAdl()、ToTr()),完全省略此章节。
参数描述规则:
N" 或 "S")始终存在,即使对于无参数指标:
### 历史行情数据要求
您必须至少有 `N` 个周期的 `quotes` 来覆盖预热期。
`quotes` 是通用 `TQuote` 历史价格行情的集合。它应具有一致的频率(日、小时、分钟等)。有关更多信息,请参阅[指南](/guide/getting-started#historical-quotes)。
N、2×(S+P)、S+P+100)10×N 个数据点")## 响应
```csharp
IReadOnlyList<{Indicator}Result>
quotes 的所有可用指标值的时间序列。N-1 个周期的值将为 null,因为没有足够的数据进行计算。
调整空值周期的项目符号以匹配实际的预热期(例如,"前 `S-1` 个慢速周期...")。
#### 收敛警告(条件性)
当指标使用引入收敛误差的平滑/递归算法时,立即在项目符号列表后添加:
```markdown
::: warning ⚞ 收敛警告
前 `10×N` 个周期将存在幅度递减、与收敛相关的精度误差,对于较早的周期,指标值的偏差可能高达约 5%。
:::
调整周期数和百分比以匹配指标的实际收敛行为。
### `{Indicator}Result`
| 属性 | 类型 | 描述 |
| -------- | ---- | ----------- |
| `Timestamp` | DateTime | 来自所评估 `TQuote` 的日期 |
| `PropertyName` | double | 此值代表的内容 |
Timestamp 始终是第一行double,对于价格衍生值(例如 Ichimoku)使用 decimal,对于计数使用 int### 实用工具
- [.Condense()](/utilities/results/condense)
- [.Find(lookupDate)](/utilities/results/find-by-date)
- [.RemoveWarmupPeriods()](/utilities/results/remove-warmup-periods)
- [.RemoveWarmupPeriods(removePeriods)](/utilities/results/remove-warmup-periods)
有关更多信息,请参阅[实用工具和辅助函数](/utilities/results/)。
当指标不支持自定义数量时,省略 .RemoveWarmupPeriods(removePeriods) 重载。
## 链式调用
此指标可以从任何支持链式调用的指标或方法生成。
```csharp
// 示例
var results = quotes
.Use(CandlePart.HL2)
.To{Indicator}(..);
结果可以在 {PrimaryValue} 上使用其他支持链式调用的指标进行进一步处理。
// 示例
var results = quotes
.To{Indicator}(..)
.ToRsi(..);
变体:
quotes 读取(不能从链式调用)时,将第一个代码块替换为:此指标必须从 \quotes` 生成,不能从另一个支持链式调用的指标或方法的结果生成。`TenkanSen 是用于链式调用的主要可重用值。")在章节末尾添加使用指南的交叉引用:
有关更多信息,请参阅[链式调用指标](/guide/batch#chaining-indicators)。
## 流式处理
当您需要增量计算而不使用中心时,请使用缓冲区样式的 `List<T>`:
```csharp
{Indicator}List {indicator}List = new(param1, param2);
foreach (IQuote quote in quotes) // 模拟流
{
{indicator}List.Add(quote);
}
// 基于 `ICollection<{Indicator}Result>`
IReadOnlyList<{Indicator}Result> results = {indicator}List;
订阅 QuoteHub 以进行高级流式处理场景:
QuoteHub quoteHub = new();
{Indicator}Hub observer = quoteHub.To{Indicator}Hub(param1, param2);
foreach (IQuote quote in quotes) // 模拟流
{
quoteHub.Add(quote);
}
IReadOnlyList<{Indicator}Result> results = observer.Results;
当中心订阅上游支持链式调用的中心(而不是 QuoteHub)时,相应地调整中心变量类型和创建方式。
在章节末尾添加使用指南的交叉引用:
有关完整的使用指南,请参阅[缓冲区列表](/guide/buffer)和[流式处理中心](/guide/stream)。
当指标由于架构限制无法支持流式处理时,包含 ## 流式处理 并使用此标准措辞,而不是示例:
## 流式处理
此指标不支持流式处理。
{一句话说明架构原因。}
请改用带有定期重新计算的系列(批量)实现。
按类别划分的标准原因:
使用 VitePress 警告容器来处理不值得单独章节的显著注意事项:
::: warning
此处为简要警告文本。
:::
将这些放在它们所限定的内容之后(例如,结果表之后)。
当指标有次要分析变体(例如 SmaAnalysis)时,创建一个单独的页面。次要页面:
<IndicatorChartPanel>(图表位于主页面)当指标有多个值得提前显示的重载时(例如 Ichimoku),在参数表之前的单个代码块中显示所有有意义的签名,并用简要注释区分每个:
// 标准用法
IReadOnlyList<...> results = quotes.ToIndicator(a, b);
// 使用自定义选项的用法
IReadOnlyList<...> results = quotes.ToIndicator(a, b, c);
当两个变体共享相同的结果类型但具有不同的参数集和不同的流式处理支持时(例如,Renko 固定砖块大小与 ATR 衍生砖块大小),将它们合并到一个具有共享结构的页面中:
## 参数,每个变体使用 H3 子章节(### 固定砖块大小、### ATR 衍生砖块大小)## 响应 合并为一个章节(共享结果类型)## 链式调用 — 注意任何变体特定的限制## 流式处理 中,为支持的变体显示完整示例,然后为不支持的变体添加 warning 警告:## 流式处理
[支持变体的完整缓冲区/中心示例]
::: warning
`ToVariantAtr()` 不支持流式处理。{一句话原因。}
:::
不要为不支持的变体创建单独的 H2 章节 — 将所有流式处理内容保留在一个 ## 流式处理 标题下。
<IndicatorChartPanel> 组件的图表图片是从 docs/.vitepress/public/data/{IndicatorKey}.json 处的 JSON 数据文件渲染的。添加新指标时:
<IndicatorChartPanel indicator-key="{IndicatorKey}" /> 添加到页面当第二个 <IndicatorChartPanel> 用于说明同一指标的行为上不同的模式时(例如,StdDevChannels 使用 null 回溯期渲染与固定周期运行不同;HtTrendline 同时暴露趋势线输出和主导周期输出),第二个面板是有效的。在这种情况下,将第二个面板立即放在介绍不同行为的散文之后,放在其自己的 H2 或 H3 标题下。不要仅仅为了显示相同输出在不同参数值下的情况而添加第二个面板。
对于散文中引用的静态(非图表)图片:
docs/.vitepress/public/assets/ 中webp 格式,宽度为 832px:cwebp -resize 832 0 -q 100 examples.png -o examples-832.webp/assets/filename-832.webpdocs/indicators/{Indicator}.mdtitle 和 descriptiondocs/ 运行 pnpm run docs:devN-1N、S、F、P 作为单字母公式变量简写 — 在首次使用时定义它们每周安装次数
1
代码仓库
GitHub Stars
1.2K
首次出现
1 天前
安全审计
安装于
amp1
cline1
openclaw1
opencode1
cursor1
kimi-cli1
This skill covers writing and updating the VitePress documentation site located in the docs/ folder, with focus on indicator reference pages.
The site is built with VitePress and Vue 3.
| Path | Purpose |
|---|---|
docs/indicators/ | One .md file per indicator (the primary audience) |
docs/.vitepress/config.mts | Site config — nav, sidebar, metadata |
docs/.vitepress/components/ | Vue components used inside Markdown |
docs/.vitepress/public/assets/ | Static images (webp, optimized) |
docs/.vitepress/public/data/ | Chart JSON files (one per indicator key) |
docs/guide/getting-started.md | Get started: install + first call |
docs/guide/index.md | Guide overview + style comparison |
docs/guide/batch.md | Batch (Series) style guide |
docs/guide/buffer.md | Buffer list style guide |
docs/guide/stream.md | Stream hub style guide |
docs/guide/customization.md | Custom indicators guide |
docs/indicators.md | Indicators landing/index page |
docs/utilities/ | Utility API reference pages |
docs/performance.md | Performance benchmarks reference |
Excluded from build : AGENTS.md, PRINCIPLES.md, and README.md are excluded via srcExclude in config.mts and must not be linked from indicator pages.
# from /docs folder
pnpm install
pnpm run docs:dev
# site opens at http://localhost:5173/
Every indicator page at docs/indicators/{Indicator}.md follows this section order exactly. Never omit sections; use judgment about which optional elements apply.
---
title: Full Indicator Name (ABBR)
description: One-sentence description of what the indicator measures.
---
title: Human-readable name with abbreviation in parentheses when one existsdescription: Concise (≤160 characters), plain-text sentence — used for SEO and link previews# Full Indicator Name (ABBR)
Created by Author Name, [Indicator Name](https://en.wikipedia.org/wiki/...) is a brief description of what it measures.
[[Discuss] 💬](https://github.com/DaveSkender/Stock.Indicators/discussions/{id} "Community discussion about this indicator")
<IndicatorChartPanel indicator-key="{IndicatorKey}" />
Rules:
[[Discuss]] link using the correct GitHub Discussions URL<IndicatorChartPanel> when a chart JSON file exists at docs/.vitepress/public/data/{IndicatorKey}.json; omit when no chart data exists (e.g., simple primitives or secondary analysis pages)indicator-key must match the JSON filename exactly (PascalCase, no extension)```csharp
// C# usage syntax
IReadOnlyList<{Indicator}Result> results =
quotes.To{Indicator}(param1, param2);
```
// C# usage syntax as the comment; add (with Close price) or similar qualifier when relevantquotes.To{Indicator}(...) lines when multiple overloads exist## Parameters
| param | type | description |
| ----- | ---- | ----------- |
| `paramName` | int | Description with constraints. Default is N. |
Omit this section entirely when the indicator has no parameters (e.g., ToAdl(), ToTr()).
Parameter description rules:
N" or "S")Always present, even for parameter-free indicators:
### Historical quotes requirements
You must have at least `N` periods of `quotes` to cover the warmup periods.
`quotes` is a collection of generic `TQuote` historical price quotes. It should have a consistent frequency (day, hour, minute, etc). See [the Guide](/guide/getting-started#historical-quotes) for more information.
N, 2×(S+P), S+P+100)10×N data points prior to the intended usage date for better precision")## Response
```csharp
IReadOnlyList<{Indicator}Result>
```
- This method returns a time series of all available indicator values for the `quotes` provided.
- It always returns the same number of elements as there are in the historical quotes.
- It does not return a single incremental indicator value.
- The first `N-1` periods will have `null` values since there's not enough data to calculate.
Adjust the null-period bullet to match the actual warmup (e.g., "The first S-1 slow periods...").
Add immediately after the bullet list when the indicator uses a smoothing/recursive algorithm that introduces convergence error:
::: warning ⚞ Convergence warning
The first `10×N` periods will have decreasing magnitude, convergence-related precision errors that can be as high as ~5% deviation in indicator values for earlier periods.
:::
Adjust the period count and percentage to match the indicator's actual convergence behavior.
### `{Indicator}Result`
| property | type | description |
| -------- | ---- | ----------- |
| `Timestamp` | DateTime | Date from evaluated `TQuote` |
| `PropertyName` | double | What this value represents |
Timestamp is always the first rowdouble for computed values, decimal for price-derived values (e.g., Ichimoku), int for counts### Utilities
- [.Condense()](/utilities/results/condense)
- [.Find(lookupDate)](/utilities/results/find-by-date)
- [.RemoveWarmupPeriods()](/utilities/results/remove-warmup-periods)
- [.RemoveWarmupPeriods(removePeriods)](/utilities/results/remove-warmup-periods)
See [Utilities and helpers](/utilities/results/) for more information.
Omit .RemoveWarmupPeriods(removePeriods) overload when the indicator does not support a custom count.
## Chaining
This indicator may be generated from any chain-enabled indicator or method.
```csharp
// example
var results = quotes
.Use(CandlePart.HL2)
.To{Indicator}(..);
```
Results can be further processed on `{PrimaryValue}` with additional chain-enabled indicators.
```csharp
// example
var results = quotes
.To{Indicator}(..)
.ToRsi(..);
```
Variations:
quotes (not chains), replace the first block with: This indicator must be generated from \quotes and **cannot** be generated from results of another chain-enabled indicator or method.TenkanSen is the primary reusable value for chaining purposes.")End the section with a cross-reference to the usage guide:
See [Chaining indicators](/guide/batch#chaining-indicators) for more.
## Streaming
Use the buffer-style `List<T>` when you need incremental calculations without a hub:
```csharp
{Indicator}List {indicator}List = new(param1, param2);
foreach (IQuote quote in quotes) // simulating stream
{
{indicator}List.Add(quote);
}
// based on `ICollection<{Indicator}Result>`
IReadOnlyList<{Indicator}Result> results = {indicator}List;
```
Subscribe to a `QuoteHub` for advanced streaming scenarios:
```csharp
QuoteHub quoteHub = new();
{Indicator}Hub observer = quoteHub.To{Indicator}Hub(param1, param2);
foreach (IQuote quote in quotes) // simulating stream
{
quoteHub.Add(quote);
}
IReadOnlyList<{Indicator}Result> results = observer.Results;
```
When the hub subscribes to an upstream chain-enabled hub (not a QuoteHub), adjust the hub variable type and creation accordingly.
End the section with a cross-reference to the usage guides:
See [Buffer lists](/guide/buffer) and [Stream hubs](/guide/stream) for full usage guides.
When an indicator cannot support streaming due to an architectural constraint, include ## Streaming with this standard wording instead of examples:
## Streaming
Streaming is not supported for this indicator.
{One sentence stating the architectural reason.}
Use the Series (batch) implementation with periodic recalculation instead.
Standard reasons by category:
Use VitePress admonition containers for notable caveats that don't warrant a full section:
::: warning
Brief warning text here.
:::
Place these immediately after the content they qualify (e.g., after the result table).
When an indicator has a secondary analysis variant (e.g., SmaAnalysis), create a separate page. Secondary pages:
<IndicatorChartPanel> (chart lives on the primary page)When an indicator has multiple overloads worth showing upfront (e.g., Ichimoku), show all meaningful signatures in a single code block before the Parameters table, with brief comments distinguishing each:
// standard usage
IReadOnlyList<...> results = quotes.ToIndicator(a, b);
// usage with custom option
IReadOnlyList<...> results = quotes.ToIndicator(a, b, c);
When two variants share the same result type but have distinct parameter sets and different streaming support (e.g., Renko fixed-brick vs. ATR-derived), merge them into one page with a shared structure:
## Parameters with H3 subsections per variant (### Fixed brick size, ### ATR-derived brick size)## Response into one section (shared result type)## Chaining — note any variant-specific restrictions## Streaming, show full examples for the supported variant, then add a warning admonition for the unsupported variant:## Streaming
[Full buffer/hub examples for the supported variant]
::: warning
`ToVariantAtr()` does not support streaming. {One sentence reason.}
:::
Do not create a separate H2 section for the unsupported variant — keep all streaming content under one ## Streaming heading.
Chart images for the <IndicatorChartPanel> component are rendered from JSON data files at docs/.vitepress/public/data/{IndicatorKey}.json. When adding a new indicator:
<IndicatorChartPanel indicator-key="{IndicatorKey}" /> to the pageA second <IndicatorChartPanel> mid-page is valid when it illustrates a behaviorally distinct mode of the same indicator (e.g., StdDevChannels with null lookback renders differently than a fixed-period run; HtTrendline exposes both a trendline output and a dominant cycle period output). In that case, place the second panel immediately after the prose that introduces the distinct behavior, under its own H2 or H3 heading. Do not add a second panel merely to show the same output at different parameter values.
For static (non-chart) images referenced in prose:
docs/.vitepress/public/assets/webp format at 832px width: cwebp -resize 832 0 -q 100 examples.png -o examples-832.webp/assets/filename-832.webpdocs/indicators/{Indicator}.md following the page structure abovetitle and description setpnpm run docs:dev from docs/N-1N, S, F, P as single-letter formula variable shorthand — define them on first useWeekly Installs
1
Repository
GitHub Stars
1.2K
First Seen
1 day ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
amp1
cline1
openclaw1
opencode1
cursor1
kimi-cli1
Stripe API 最佳实践指南:最新版本集成路径与支付解决方案
2,700 周安装