mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-22 20:48:04 +00:00
validation and profiles
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using OoplesFinance.StockIndicators;
|
||||
using OoplesFinance.StockIndicators.Models;
|
||||
using Skender.Stock.Indicators;
|
||||
using TALib;
|
||||
using Xunit.Abstractions;
|
||||
@@ -430,4 +432,43 @@ public sealed class TrixValidationTests(ITestOutputHelper output) : IDisposable
|
||||
Assert.True(double.IsFinite(value), $"Expected finite value, got {value}");
|
||||
}
|
||||
}
|
||||
|
||||
// ── Cross-library: OoplesFinance ──────────────────────────────────────────
|
||||
[Fact]
|
||||
public void Trix_MatchesOoples_Structural()
|
||||
{
|
||||
const int period = 14;
|
||||
var ooplesData = _testData.SkenderQuotes.Select(static q => new TickerData
|
||||
{
|
||||
Date = q.Date,
|
||||
Open = (double)q.Open,
|
||||
High = (double)q.High,
|
||||
Low = (double)q.Low,
|
||||
Close = (double)q.Close,
|
||||
Volume = (double)q.Volume
|
||||
}).ToList();
|
||||
|
||||
var stockData = new StockData(ooplesData);
|
||||
var oResult = stockData.CalculateTrix(length: period);
|
||||
var oValues = oResult.OutputValues.Values.First();
|
||||
|
||||
var trix = new global::QuanTAlib.Trix(period);
|
||||
var qValues = new List<double>();
|
||||
foreach (var item in _testData.Data)
|
||||
{
|
||||
qValues.Add(trix.Update(item).Value);
|
||||
}
|
||||
|
||||
Assert.True(oValues.Count > 0, "Ooples Trix must produce output");
|
||||
int finiteCount = 0;
|
||||
for (int i = period; i < Math.Min(oValues.Count, qValues.Count); i++)
|
||||
{
|
||||
if (double.IsFinite(oValues[i]) && double.IsFinite(qValues[i]))
|
||||
{
|
||||
finiteCount++;
|
||||
}
|
||||
}
|
||||
Assert.True(finiteCount > 100, $"Expected >100 finite Trix pairs, got {finiteCount}");
|
||||
_output.WriteLine($"Trix Ooples structural: {finiteCount} finite pairs verified.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user