validation and profiles

This commit is contained in:
Miha Kralj
2026-02-26 22:02:52 -08:00
parent 9ab37c1200
commit 8a1ba95173
317 changed files with 18704 additions and 622 deletions
@@ -1,3 +1,6 @@
using OoplesFinance.StockIndicators;
using OoplesFinance.StockIndicators.Models;
// PIVOTCAM Validation Tests - Camarilla Pivot Points
// Self-consistency validation across all API modes.
//
@@ -271,4 +274,24 @@ public sealed class PivotcamValidationTests
}
}
}
}
[Fact(Skip = "Ooples pivot indicators group by calendar day — 500×1-min bars yields ~3 daily pivots. Requires daily OHLCV input; not comparable with intraday GBM data.")]
public void Pivotcam_MatchesOoples_Structural()
{
var gbm = new GBM(startPrice: 100.0, mu: 0.02, sigma: 0.15, seed: 42);
var bars = gbm.Fetch(500, DateTime.UtcNow.Ticks, TimeSpan.FromMinutes(1));
var ooplesData = bars.Select(b => new TickerData
{
Date = new DateTime(b.Time, DateTimeKind.Utc),
Open = b.Open,
High = b.High,
Low = b.Low,
Close = b.Close,
Volume = b.Volume
}).ToList();
var result = new StockData(ooplesData).CalculateCamarillaPivotPoints();
var values = result.OutputValues.Values.First();
int finiteCount = values.Count(v => double.IsFinite(v));
Assert.True(finiteCount > 100, $"Expected >100 finite values, got {finiteCount}");
}
}
+15
View File
@@ -111,6 +111,21 @@ All levels use `Math.FusedMultiplyAdd` for the `close + range * constant` comput
## Performance Profile
### Operation Count (Streaming Mode)
Camarilla Pivot uses a fixed multiplier series (1.1/12, 1.1/6, ...) applied to previous-bar range — O(1).
| Operation | Count | Cost (cycles) | Subtotal |
| :--- | :---: | :---: | :---: |
| Store prev OHLC | 4 | 1 cy | ~4 cy |
| Range = H - L | 1 | 1 cy | ~1 cy |
| R1..R4 via FMA (C + k*range) | 4 | 1 cy | ~4 cy |
| S1..S4 via FMA (C - k*range) | 4 | 1 cy | ~4 cy |
| NaN guard + state update | 1 | 2 cy | ~2 cy |
| **Total** | **O(1)** | — | **~15 cy** |
O(1) pure arithmetic. Precomputed Camarilla multipliers [1.1/12, 1.1/6, 1.1/4, 1.1/2] applied via FMA(C, 1, k*range).
### Implementation Design
Pure arithmetic with no loops, no buffers, no auxiliary data structures. Each `Update` call performs 1 division (PP), 8 FMA operations, and 3 comparisons for NaN validation.