Skip to content

Commit 5dd8b00

Browse files
CopilotDaveSkender
andauthored
docs: Add streaming-related info for RSI, MACD, Bollinger Bands, etc. (#1729)
Signed-off-by: Dave Skender <[email protected]> Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: DaveSkender <[email protected]>
1 parent 95a816d commit 5dd8b00

File tree

14 files changed

+794
-18
lines changed

14 files changed

+794
-18
lines changed

.specify/specs/001-develop-streaming-indicators/tasks.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -409,11 +409,17 @@ Note on former deferrals: Indicators like Fractal, HtTrendline, Hurst, Ichimoku,
409409

410410
- [x] **D001** Update `docs/_indicators/Sma.md` with streaming usage section and examples ✅
411411
- [x] **D002** Update `docs/_indicators/Ema.md` with streaming usage section and examples ✅
412-
- [ ] **D003** Update `docs/_indicators/Rsi.md` with streaming usage section and examples
413-
- [ ] **D004** Update `docs/_indicators/Macd.md` with streaming usage section and examples
414-
- [ ] **D005** Update `docs/_indicators/BollingerBands.md` with streaming usage section and examples
415-
- [ ] **D006** Update `README.md` with streaming overview paragraph and quick-start example
416-
- [ ] **D007** Update `src/MigrationGuide.V3.md` with streaming capability summary and migration guidance
412+
- [x] **D003** Update `docs/_indicators/Rsi.md` with streaming usage section and examples ✅
413+
- [x] **D004** Update `docs/_indicators/Macd.md` with streaming usage section and examples ✅
414+
- [x] **D005** Update `docs/_indicators/BollingerBands.md` with streaming usage section and examples ✅
415+
- [x] **D006** Update `README.md` with streaming overview paragraph and quick-start example ✅
416+
- [x] **D007** Update `src/MigrationGuide.V3.md` with streaming capability summary and migration guidance ✅
417+
- Overview of three calculation styles (Series, BufferList, StreamHub)
418+
- Migration examples from v2 Series to v3 streaming
419+
- Performance considerations
420+
- Links to indicator-specific documentation
421+
- Completed guide.md TODO sections (BufferList and StreamHub)
422+
- Added comprehensive streaming performance documentation to performance.md
417423

418424
**Checkpoint**: Phase 5 completion delivers polished user-facing documentation for all streaming features
419425

@@ -588,8 +594,8 @@ Each task should follow these guidelines:
588594
- **Phase 2**: 85 BufferList implementation tasks (T001-T085) — 82 complete, 3 remaining (T055/T068 not implementing, T085 human-only)
589595
- **Phase 3**: 85 StreamHub implementation tasks (T086-T170) — 79 complete, 6 remaining (T108, T145 implementable; T140/T153 not implementing, T170 human-only)
590596
- **Phase 4**: 17 test infrastructure tasks (T175-T185, Q001-Q006) — 12 complete, 5 remaining
591-
- **Phase 5**: 7 documentation tasks (D001-D007) — 2 complete, 5 remaining
597+
- **Phase 5**: 7 documentation tasks (D001-D007) — 7 complete, 0 remaining
592598
- **Phase 6**: 10 enhancement tasks (E001-E010) — 0 complete, 10 remaining (Priority 4 enhancements + private project items)
593-
- **Total**: 214 tasks — 183 complete, 31 remaining (4 marked as not implementing, 2 human-only)
599+
- **Total**: 214 tasks — 188 complete, 26 remaining (4 marked as not implementing, 2 human-only)
594600

595601
Removed blanket deferral: The above indicators are complex but unblocked with established reference patterns (see instruction files).

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,35 @@
1414

1515
Build your technical analysis, trading algorithms, machine learning, charting, or other intelligent market software with this library and your own [OHLCV](https://dotnet.stockindicators.dev/guide/#historical-quotes) price quotes sources for equities, commodities, forex, cryptocurrencies, and others. [Stock Indicators for Python](https://python.stockindicators.dev/) is also available.
1616

17+
## Streaming Support
18+
19+
v3 introduces comprehensive **streaming capabilities** for real-time and incremental data processing. Most indicators now support three calculation styles:
20+
21+
- **Series** - Traditional batch processing for complete historical datasets
22+
- **BufferList** - Incremental calculations with efficient buffer management
23+
- **StreamHub** - Real-time processing with observable patterns and state management
24+
25+
Quick example using streaming:
26+
27+
```csharp
28+
// Create a quote hub for streaming quotes
29+
QuoteHub<Quote> quoteHub = new();
30+
31+
// Subscribe indicators to the hub
32+
EmaHub<Quote> emaHub = quoteHub.ToEma(20);
33+
RsiHub<Quote> rsiHub = quoteHub.ToRsi(14);
34+
35+
// Stream quotes as they arrive
36+
foreach (Quote quote in liveQuotes)
37+
{
38+
quoteHub.Add(quote);
39+
40+
// Access real-time results
41+
EmaResult emaResult = emaHub.Results.LastOrDefault();
42+
RsiResult rsiResult = rsiHub.Results.LastOrDefault();
43+
}
44+
```
45+
1746
Visit our project site for more information:
1847

1948
- [Overview](https://dotnet.stockindicators.dev/)

docs/_indicators/Aroon.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,33 @@ var results = quotes
7272
```
7373

7474
This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method.
75+
76+
## Streaming
77+
78+
Use the buffer-style `List<T>` when you need incremental calculations without a hub:
79+
80+
```csharp
81+
AroonList aroonList = new(lookbackPeriods);
82+
83+
foreach (IQuote quote in quotes) // simulating stream
84+
{
85+
aroonList.Add(quote);
86+
}
87+
88+
// based on `ICollection<AroonResult>`
89+
IReadOnlyList<AroonResult> results = aroonList;
90+
```
91+
92+
Subscribe to a `QuoteHub` for advanced streaming scenarios:
93+
94+
```csharp
95+
QuoteHub<Quote> quoteHub = new();
96+
AroonHub<Quote> observer = quoteHub.ToAroon(lookbackPeriods);
97+
98+
foreach (Quote quote in quotes) // simulating stream
99+
{
100+
quoteHub.Add(quote);
101+
}
102+
103+
IReadOnlyList<AroonResult> results = observer.Results;
104+
```

docs/_indicators/Cci.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,33 @@ var results = quotes
6868
```
6969

7070
This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method.
71+
72+
## Streaming
73+
74+
Use the buffer-style `List<T>` when you need incremental calculations without a hub:
75+
76+
```csharp
77+
CciList cciList = new(lookbackPeriods);
78+
79+
foreach (IQuote quote in quotes) // simulating stream
80+
{
81+
cciList.Add(quote);
82+
}
83+
84+
// based on `ICollection<CciResult>`
85+
IReadOnlyList<CciResult> results = cciList;
86+
```
87+
88+
Subscribe to a `QuoteHub` for advanced streaming scenarios:
89+
90+
```csharp
91+
QuoteHub<Quote> quoteHub = new();
92+
CciHub<Quote> observer = quoteHub.ToCci(lookbackPeriods);
93+
94+
foreach (Quote quote in quotes) // simulating stream
95+
{
96+
quoteHub.Add(quote);
97+
}
98+
99+
IReadOnlyList<CciResult> results = observer.Results;
100+
```

docs/_indicators/ConnorsRsi.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,33 @@ var results = quotes
8787
.ToConnorsRsi(..)
8888
.ToSma(..);
8989
```
90+
91+
## Streaming
92+
93+
Use the buffer-style `List<T>` when you need incremental calculations without a hub:
94+
95+
```csharp
96+
ConnorsRsiList connorsRsiList = new(rsiPeriods, streakPeriods, rankPeriods);
97+
98+
foreach (IQuote quote in quotes) // simulating stream
99+
{
100+
connorsRsiList.Add(quote);
101+
}
102+
103+
// based on `ICollection<ConnorsRsiResult>`
104+
IReadOnlyList<ConnorsRsiResult> results = connorsRsiList;
105+
```
106+
107+
Subscribe to a `QuoteHub` for advanced streaming scenarios:
108+
109+
```csharp
110+
QuoteHub<Quote> quoteHub = new();
111+
ConnorsRsiHub<Quote> observer = quoteHub.ToConnorsRsi(rsiPeriods, streakPeriods, rankPeriods);
112+
113+
foreach (Quote quote in quotes) // simulating stream
114+
{
115+
quoteHub.Add(quote);
116+
}
117+
118+
IReadOnlyList<ConnorsRsiResult> results = observer.Results;
119+
```

docs/_indicators/Keltner.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,32 @@ var results = quotes
8080
.ToKeltner(..);
8181
```
8282

83-
### Stream indicator
83+
## Streaming
8484

85-
This indicator supports real-time streaming with `ToKeltnerHub()`. See [StreamHub guide]({{site.baseurl}}/guide/#streaming-hub-style-indicators) for usage.
85+
Use the buffer-style `List<T>` when you need incremental calculations without a hub:
8686

8787
```csharp
88-
// example - to stream real-time data
89-
var quoteHub = new QuoteHub();
90-
var keltnerHub = quoteHub.ToKeltnerHub(emaPeriods, multiplier, atrPeriods);
88+
KeltnerList keltnerList = new(emaPeriods, multiplier, atrPeriods);
89+
90+
foreach (IQuote quote in quotes) // simulating stream
91+
{
92+
keltnerList.Add(quote);
93+
}
94+
95+
// based on `ICollection<KeltnerResult>`
96+
IReadOnlyList<KeltnerResult> results = keltnerList;
97+
```
98+
99+
Subscribe to a `QuoteHub` for advanced streaming scenarios:
100+
101+
```csharp
102+
QuoteHub<Quote> quoteHub = new();
103+
KeltnerHub<Quote> observer = quoteHub.ToKeltner(emaPeriods, multiplier, atrPeriods);
104+
105+
foreach (IQuote quote in quotes) // simulating stream
106+
{
107+
quoteHub.Add(quote);
108+
}
109+
110+
IReadOnlyList<KeltnerResult> results = observer.Results;
91111
```

docs/_indicators/Macd.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,33 @@ var results = quotes
8989
.ToMacd(..)
9090
.ToSlope(..);
9191
```
92+
93+
## Streaming
94+
95+
Use the buffer-style `List<T>` when you need incremental calculations without a hub:
96+
97+
```csharp
98+
MacdList macdList = new(fastPeriods, slowPeriods, signalPeriods);
99+
100+
foreach (IQuote quote in quotes) // simulating stream
101+
{
102+
macdList.Add(quote);
103+
}
104+
105+
// based on `ICollection<MacdResult>`
106+
IReadOnlyList<MacdResult> results = macdList;
107+
```
108+
109+
Subscribe to a `QuoteHub` for advanced streaming scenarios:
110+
111+
```csharp
112+
QuoteHub<Quote> quoteHub = new();
113+
MacdHub<Quote> observer = quoteHub.ToMacd(fastPeriods, slowPeriods, signalPeriods);
114+
115+
foreach (Quote quote in quotes) // simulating stream
116+
{
117+
quoteHub.Add(quote);
118+
}
119+
120+
IReadOnlyList<MacdResult> results = observer.Results;
121+
```

docs/_indicators/StochRsi.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,33 @@ var results = quotes
8888
.ToStochRsi(..)
8989
.ToSlope(..);
9090
```
91+
92+
## Streaming
93+
94+
Use the buffer-style `List<T>` when you need incremental calculations without a hub:
95+
96+
```csharp
97+
StochRsiList stochRsiList = new(rsiPeriods, stochPeriods, signalPeriods, smoothPeriods);
98+
99+
foreach (IQuote quote in quotes) // simulating stream
100+
{
101+
stochRsiList.Add(quote);
102+
}
103+
104+
// based on `ICollection<StochRsiResult>`
105+
IReadOnlyList<StochRsiResult> results = stochRsiList;
106+
```
107+
108+
Subscribe to a `QuoteHub` for advanced streaming scenarios:
109+
110+
```csharp
111+
QuoteHub<Quote> quoteHub = new();
112+
StochRsiHub<Quote> observer = quoteHub.ToStochRsi(rsiPeriods, stochPeriods, signalPeriods, smoothPeriods);
113+
114+
foreach (Quote quote in quotes) // simulating stream
115+
{
116+
quoteHub.Add(quote);
117+
}
118+
119+
IReadOnlyList<StochRsiResult> results = observer.Results;
120+
```

docs/_indicators/SuperTrend.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,33 @@ See [Utilities and helpers]({{site.baseurl}}/utilities#utilities-for-indicator-r
6969
## Chaining
7070

7171
This indicator is not chain-enabled and must be generated from `quotes`. It **cannot** be used for further processing by other chain-enabled indicators.
72+
73+
## Streaming
74+
75+
Use the buffer-style `List<T>` when you need incremental calculations without a hub:
76+
77+
```csharp
78+
SuperTrendList superTrendList = new(lookbackPeriods, multiplier);
79+
80+
foreach (IQuote quote in quotes) // simulating stream
81+
{
82+
superTrendList.Add(quote);
83+
}
84+
85+
// based on `ICollection<SuperTrendResult>`
86+
IReadOnlyList<SuperTrendResult> results = superTrendList;
87+
```
88+
89+
Subscribe to a `QuoteHub` for advanced streaming scenarios:
90+
91+
```csharp
92+
QuoteHub<Quote> quoteHub = new();
93+
SuperTrendHub<Quote> observer = quoteHub.ToSuperTrend(lookbackPeriods, multiplier);
94+
95+
foreach (Quote quote in quotes) // simulating stream
96+
{
97+
quoteHub.Add(quote);
98+
}
99+
100+
IReadOnlyList<SuperTrendResult> results = observer.Results;
101+
```

docs/_indicators/T3.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,33 @@ var results = quotes
7777
.ToT3(..)
7878
.ToRsi(..);
7979
```
80+
81+
## Streaming
82+
83+
Use the buffer-style `List<T>` when you need incremental calculations without a hub:
84+
85+
```csharp
86+
T3List t3List = new(lookbackPeriods, volumeFactor);
87+
88+
foreach (IQuote quote in quotes) // simulating stream
89+
{
90+
t3List.Add(quote);
91+
}
92+
93+
// based on `ICollection<T3Result>`
94+
IReadOnlyList<T3Result> results = t3List;
95+
```
96+
97+
Subscribe to a `QuoteHub` for advanced streaming scenarios:
98+
99+
```csharp
100+
QuoteHub<Quote> quoteHub = new();
101+
T3Hub<Quote> observer = quoteHub.ToT3(lookbackPeriods, volumeFactor);
102+
103+
foreach (Quote quote in quotes) // simulating stream
104+
{
105+
quoteHub.Add(quote);
106+
}
107+
108+
IReadOnlyList<T3Result> results = observer.Results;
109+
```

0 commit comments

Comments
 (0)