mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-15 09:08:04 +00:00
feat: enhance documentation for event flow patterns, SoA storage, and argument validation in AGENTS and MODELS
This commit is contained in:
@@ -251,3 +251,6 @@ When creating a new indicator, you are **DONE** only when:
|
||||
* **Math**: Use `System.Math` or `System.Numerics`.
|
||||
* **Root Namespace**: `QuanTAlib`.
|
||||
* **Patterns & Decisions**: When designing, refactoring, or fixing indicators or tests, first query `qdrant.mcp` for stored QuanTAlib patterns, architectural decisions, and benchmarks, and align new work with those references unless there is a documented reason to diverge.
|
||||
* **Event Flow Pattern (Commit d7dbd70)**: For `ITValuePublisher`-based indicators, subscribe directly with `source.Pub += Handle;` in constructors instead of storing `source` or delegate fields solely for subscription; rely on struct-based event args (e.g., `TBarEventArgs`, `TValueEventArgs`) and, when Meziantou MA0046 flags the non-EventArgs signature, suppress it locally with a targeted pragma and comment explaining the performance trade-off.
|
||||
* **SoA Backing Storage (Commit d7dbd70)**: Core series types (`TSeries`, `TBarSeries`) intentionally use concrete `List<T>` fields to support SoA layout and `CollectionsMarshal.AsSpan`; when analyzers suggest collection abstractions (MA0016), suppress them narrowly around those fields, as this is a deliberate performance design.
|
||||
* **Argument Validation (Commit d7dbd70)**: All `Calculate`/`Batch` and span-based APIs must use `ArgumentException` (or derived) overloads that include the offending parameter name (e.g., `nameof(output)` or `nameof(sourceY)`) for length and range checks, matching the MA0015-compliant pattern adopted across indicators.
|
||||
|
||||
@@ -72,6 +72,8 @@ These tests compare the indicator's output against established external librarie
|
||||
- **Compare against Python (pandas-ta/talib)**: If C# libs are unavailable.
|
||||
- **Tolerance**: Typically `1e-6` to `1e-9`.
|
||||
|
||||
When asserting parameter validation behavior (e.g., invalid periods or mismatched buffer lengths), align with the MA0015-compliant pattern defined in `AGENTS.md` (commit d7dbd70): `ArgumentException` (or derived) overloads must include the offending `paramName` (for example `nameof(output)` or `nameof(sourceY)`), and tests should verify both the exception type and the parameter name where relevant.
|
||||
|
||||
## 3. Example Test Template
|
||||
|
||||
```csharp
|
||||
|
||||
Reference in New Issue
Block a user