mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-22 04:28:04 +00:00
test tolerances updated
This commit is contained in:
@@ -146,7 +146,7 @@ public class AlmaValidationTests : IDisposable
|
||||
var qResult = alma.Update(_testData.Data);
|
||||
|
||||
// 3. Verify
|
||||
ValidationHelper.VerifyData(qResult, oAlma, x => x, skip: 100, tolerance: 1.0);
|
||||
ValidationHelper.VerifyData(qResult, oAlma, x => x, skip: 100, tolerance: ValidationHelper.OoplesTolerance);
|
||||
}
|
||||
_output.WriteLine("ALMA Batch validated successfully against Ooples");
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class BesselValidationTests : IDisposable
|
||||
Bessel.Calculate(src.AsSpan(), outSpan.AsSpan(), length);
|
||||
|
||||
// Verify last window for convergence and consistency
|
||||
ValidationHelper.VerifyData(qResult, outSpan, lookback: 0, skip: length, tolerance: 1e-9);
|
||||
ValidationHelper.VerifyData(qResult, outSpan, lookback: 0, skip: length, tolerance: ValidationHelper.DefaultTolerance);
|
||||
}
|
||||
|
||||
_output.WriteLine("Bessel validated internally: Span vs TSeries are consistent.");
|
||||
|
||||
@@ -70,7 +70,7 @@ public class ConvValidationTests : IDisposable
|
||||
|
||||
if (i >= period) // Skip warmup
|
||||
{
|
||||
Assert.Equal(smaVal.Value, convVal.Value, 1e-4);
|
||||
Assert.Equal(smaVal.Value, convVal.Value, ValidationHelper.DefaultTolerance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ public class ConvValidationTests : IDisposable
|
||||
|
||||
if (i >= period) // Skip warmup
|
||||
{
|
||||
Assert.Equal(wmaVal.Value, convVal.Value, 1e-4);
|
||||
Assert.Equal(wmaVal.Value, convVal.Value, ValidationHelper.DefaultTolerance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,7 +133,7 @@ public class ConvValidationTests : IDisposable
|
||||
|
||||
if (i >= period) // Skip warmup
|
||||
{
|
||||
Assert.Equal(trimaVal.Value, convVal.Value, 1e-4);
|
||||
Assert.Equal(trimaVal.Value, convVal.Value, ValidationHelper.DefaultTolerance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -209,6 +209,6 @@ public class ConvValidationTests : IDisposable
|
||||
var conv = new Conv(kernel);
|
||||
var result = conv.Update(_testData.Data);
|
||||
|
||||
ValidationHelper.VerifyData(result, ooplesWma, (s) => s, skip: period, tolerance: 1e-4);
|
||||
ValidationHelper.VerifyData(result, ooplesWma, (s) => s, skip: period, tolerance: ValidationHelper.OoplesTolerance);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ public class DemaValidationTests : IDisposable
|
||||
// Compare
|
||||
// Note: There might be tiny differences due to floating point operations order
|
||||
// or internal state handling optimization in Dema class vs composed Ema classes.
|
||||
Assert.Equal(ooplesVal, qVal.Value, 1e-9);
|
||||
Assert.Equal(ooplesVal, qVal.Value, ValidationHelper.DefaultTolerance);
|
||||
}
|
||||
}
|
||||
_output.WriteLine("DEMA validated successfully against Ooples logic (2*EMA - EMA(EMA))");
|
||||
|
||||
@@ -57,7 +57,7 @@ public class DwmaValidationTests : IDisposable
|
||||
var wma1Val = wma1.Update(val);
|
||||
var wma2Val = wma2.Update(wma1Val);
|
||||
|
||||
Assert.Equal(wma2Val.Value, dwmaVal.Value, 1e-9);
|
||||
Assert.Equal(wma2Val.Value, dwmaVal.Value, ValidationHelper.DefaultTolerance);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class DwmaValidationTests : IDisposable
|
||||
var w1 = wma1.Update(val);
|
||||
var w2 = wma2.Update(w1);
|
||||
|
||||
Assert.Equal(w2.Value, qVal.Value, 1e-9);
|
||||
Assert.Equal(w2.Value, qVal.Value, ValidationHelper.DefaultTolerance);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class DwmaValidationTests : IDisposable
|
||||
var tResult = outputs2[0];
|
||||
int totalLookback = lookback1 + lookback2;
|
||||
|
||||
ValidationHelper.VerifyData(qResult, tResult, totalLookback, tolerance: 1e-6);
|
||||
ValidationHelper.VerifyData(qResult, tResult, totalLookback, tolerance: ValidationHelper.TulipTolerance);
|
||||
}
|
||||
_output.WriteLine("DWMA validated against Tulip (Chained WMA)");
|
||||
}
|
||||
@@ -143,7 +143,7 @@ public class DwmaValidationTests : IDisposable
|
||||
.ToArray();
|
||||
|
||||
int totalLookback = (period - 1) * 2;
|
||||
ValidationHelper.VerifyData(qResult, wma2Results, totalLookback, tolerance: 1e-6);
|
||||
ValidationHelper.VerifyData(qResult, wma2Results, totalLookback, tolerance: ValidationHelper.SkenderTolerance);
|
||||
}
|
||||
_output.WriteLine("DWMA validated against Skender (Chained WMA)");
|
||||
}
|
||||
@@ -174,7 +174,7 @@ public class DwmaValidationTests : IDisposable
|
||||
Assert.Equal(Core.RetCode.Success, retCode2);
|
||||
|
||||
int totalLookback = (period - 1) * 2;
|
||||
ValidationHelper.VerifyData(qResult, dwmaOutput, totalLookback, tolerance: 1e-6);
|
||||
ValidationHelper.VerifyData(qResult, dwmaOutput, totalLookback, tolerance: ValidationHelper.TalibTolerance);
|
||||
}
|
||||
_output.WriteLine("DWMA validated against TA-Lib (Chained WMA)");
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ public class EmaValidationTests : IDisposable
|
||||
var oValues = oResult.OutputValues.Values.First();
|
||||
|
||||
// Compare
|
||||
ValidationHelper.VerifyData(qResult, oValues, (s) => s, tolerance: 5e-4);
|
||||
ValidationHelper.VerifyData(qResult, oValues, (s) => s, tolerance: ValidationHelper.OoplesTolerance);
|
||||
}
|
||||
_output.WriteLine("EMA validated successfully against Ooples");
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class HmaValidationTests : IDisposable
|
||||
var sResult = _testData.SkenderQuotes.GetHma(period).ToList();
|
||||
|
||||
// Compare last 100 records
|
||||
ValidationHelper.VerifyData(qResult, sResult, (s) => s.Hma, tolerance: 1e-5);
|
||||
ValidationHelper.VerifyData(qResult, sResult, (s) => s.Hma, tolerance: ValidationHelper.SkenderTolerance);
|
||||
}
|
||||
_output.WriteLine("HMA Batch(TSeries) validated successfully against Skender");
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public class HmaValidationTests : IDisposable
|
||||
var tResult = outputs[0];
|
||||
|
||||
// Compare last 100 records
|
||||
ValidationHelper.VerifyData(qResult, tResult, lookback, tolerance: 1e-5);
|
||||
ValidationHelper.VerifyData(qResult, tResult, lookback, tolerance: ValidationHelper.TulipTolerance);
|
||||
}
|
||||
_output.WriteLine("HMA Batch(TSeries) validated successfully against Tulip");
|
||||
}
|
||||
@@ -148,7 +148,7 @@ public class HmaValidationTests : IDisposable
|
||||
var sResult = _testData.SkenderQuotes.GetHma(period).ToList();
|
||||
|
||||
// Compare last 100 records
|
||||
ValidationHelper.VerifyData(qOutput, sResult, (s) => s.Hma, tolerance: 1e-5);
|
||||
ValidationHelper.VerifyData(qOutput, sResult, (s) => s.Hma, tolerance: ValidationHelper.SkenderTolerance);
|
||||
}
|
||||
_output.WriteLine("HMA Span validated successfully against Skender");
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class HtitValidationTests : IDisposable
|
||||
{
|
||||
double talibValue = output[i - outRange.Start.Value];
|
||||
double quantalibValue = quantalibResults.Values[i];
|
||||
Assert.Equal(talibValue, quantalibValue, 1e-6);
|
||||
Assert.Equal(talibValue, quantalibValue, ValidationHelper.TalibTolerance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public class HtitValidationTests : IDisposable
|
||||
// The divergence in Skender is likely due to implementation details or smoothing differences.
|
||||
double diff = Math.Abs(skenderValue - quantalibValue);
|
||||
double relError = diff / skenderValue;
|
||||
Assert.True(relError < 0.005, $"Relative error {relError} too high at index {i}");
|
||||
Assert.True(relError < ValidationHelper.RelativeTolerance, $"Relative error {relError} too high at index {i}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,7 @@ public class HtitValidationTests : IDisposable
|
||||
// Skender implementation differs slightly (~0.32%) from TA-Lib/QuanTAlib
|
||||
double diff = Math.Abs(skenderValue - quantalibValue);
|
||||
double relError = diff / skenderValue;
|
||||
Assert.True(relError < 0.005, $"Relative error {relError} too high at index {i}");
|
||||
Assert.True(relError < ValidationHelper.RelativeTolerance, $"Relative error {relError} too high at index {i}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,7 @@ public class HtitValidationTests : IDisposable
|
||||
// QuanTAlib matches TA-Lib (reference) with 1e-6 precision.
|
||||
double diff = Math.Abs(ooplesValue - quantalibValue);
|
||||
double relError = diff / ooplesValue;
|
||||
Assert.True(relError < 0.003, $"Relative error {relError} too high at index {i}");
|
||||
Assert.True(relError < ValidationHelper.RelativeTolerance, $"Relative error {relError} too high at index {i}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class KamaValidationTests
|
||||
var oValues = oResult.OutputValues["Kama"];
|
||||
|
||||
// Compare
|
||||
ValidationHelper.VerifyData(qResult, oValues, (s) => s, tolerance: 5e-4);
|
||||
ValidationHelper.VerifyData(qResult, oValues, (s) => s, tolerance: ValidationHelper.OoplesTolerance);
|
||||
}
|
||||
_output.WriteLine("KAMA validated successfully against Ooples");
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class LsmaValidationTests
|
||||
var sResult = _testData.SkenderQuotes.GetEpma(period).ToList();
|
||||
|
||||
// Compare last 100 records
|
||||
ValidationHelper.VerifyData(qResult, sResult, x => x.Epma, tolerance: 1e-4);
|
||||
ValidationHelper.VerifyData(qResult, sResult, x => x.Epma, tolerance: ValidationHelper.OoplesTolerance);
|
||||
}
|
||||
_output.WriteLine("LSMA Batch(TSeries) validated successfully against Skender");
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class LsmaValidationTests
|
||||
var sResult = _testData.SkenderQuotes.GetEpma(period).ToList();
|
||||
|
||||
// Compare last 100 records
|
||||
ValidationHelper.VerifyData(qResults, sResult, x => x.Epma, tolerance: 1e-4);
|
||||
ValidationHelper.VerifyData(qResults, sResult, x => x.Epma, tolerance: ValidationHelper.OoplesTolerance);
|
||||
}
|
||||
_output.WriteLine("LSMA Streaming validated successfully against Skender");
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class LsmaValidationTests
|
||||
var sResult = _testData.SkenderQuotes.GetEpma(period).ToList();
|
||||
|
||||
// Compare last 100 records
|
||||
ValidationHelper.VerifyData(qOutput, sResult, x => x.Epma, tolerance: 1e-4);
|
||||
ValidationHelper.VerifyData(qOutput, sResult, x => x.Epma, tolerance: ValidationHelper.OoplesTolerance);
|
||||
}
|
||||
_output.WriteLine("LSMA Span validated successfully against Skender");
|
||||
}
|
||||
|
||||
@@ -111,8 +111,9 @@ public class MamaValidationTests
|
||||
var qResult = mama.Update(_testData.Data); // _testData.Data is Close prices
|
||||
|
||||
// 3. Verify MAMA
|
||||
// Tolerance increased to 30.0 due to high-precision constant updates in QuanTAlib
|
||||
// Ooples implementation shows larger divergence (~26.3) likely due to different smoothing or constant handling
|
||||
// Tolerance set to 30.0 due to significant divergence (~27.0) caused by:
|
||||
// 1. Initialization: Ooples starts from 0, QuanTAlib warms up with Average.
|
||||
// 2. Precision: Ooples uses 4-decimal constants, QuanTAlib uses exact fractions.
|
||||
ValidationHelper.VerifyData(qResult, oMama, x => x, skip: 100, tolerance: 30.0);
|
||||
|
||||
// 4. Verify FAMA
|
||||
|
||||
@@ -53,7 +53,7 @@ public class MgdiValidationTests : IDisposable
|
||||
|
||||
if (!double.IsNaN(skenderValue))
|
||||
{
|
||||
Assert.Equal(skenderValue, quantalibValue, 1e-6);
|
||||
Assert.Equal(skenderValue, quantalibValue, ValidationHelper.SkenderTolerance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class MgdiValidationTests : IDisposable
|
||||
|
||||
if (!double.IsNaN(skenderValue))
|
||||
{
|
||||
Assert.Equal(skenderValue, quantalibValue, 1e-6);
|
||||
Assert.Equal(skenderValue, quantalibValue, ValidationHelper.SkenderTolerance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,7 +120,7 @@ public class MgdiValidationTests : IDisposable
|
||||
// We'll check for close correlation using relative error
|
||||
double diff = Math.Abs(ooplesValue - quantalibValue);
|
||||
double relError = diff / ooplesValue;
|
||||
Assert.True(relError < 1e-9, $"Relative error {relError} too high at index {i}");
|
||||
Assert.True(relError < ValidationHelper.OoplesTolerance, $"Relative error {relError} too high at index {i}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace QuanTAlib.Tests;
|
||||
|
||||
public class PwmaComparisonTests
|
||||
{
|
||||
private readonly ITestOutputHelper _output;
|
||||
|
||||
public PwmaComparisonTests(ITestOutputHelper output)
|
||||
{
|
||||
_output = output;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Compare_O1_vs_Naive()
|
||||
{
|
||||
int period = 50;
|
||||
int count = 5000;
|
||||
var random = new Random(123);
|
||||
var data = new List<double>();
|
||||
for (int i = 0; i < count; i++) data.Add(random.NextDouble() * 100);
|
||||
|
||||
// 1. QuanTAlib O(1)
|
||||
var pwma = new Pwma(period);
|
||||
var qResults = new List<double>();
|
||||
foreach (var val in data)
|
||||
{
|
||||
qResults.Add(pwma.Update(new TValue(DateTime.UtcNow, val)).Value);
|
||||
}
|
||||
|
||||
// 2. Naive O(N)
|
||||
var nResults = new List<double>();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (i < period - 1)
|
||||
{
|
||||
// Warmup logic matching QuanTAlib
|
||||
double sumSq = 0;
|
||||
double wSum = 0;
|
||||
for (int j = 0; j <= i; j++)
|
||||
{
|
||||
double weight = (j + 1) * (j + 1);
|
||||
wSum += data[j] * weight;
|
||||
sumSq += weight;
|
||||
}
|
||||
nResults.Add(wSum / sumSq);
|
||||
}
|
||||
else
|
||||
{
|
||||
double sumSq = 0;
|
||||
double wSum = 0;
|
||||
for (int j = 0; j < period; j++)
|
||||
{
|
||||
double weight = (j + 1) * (j + 1);
|
||||
wSum += data[i - period + 1 + j] * weight;
|
||||
sumSq += weight;
|
||||
}
|
||||
nResults.Add(wSum / sumSq);
|
||||
}
|
||||
}
|
||||
|
||||
// Compare
|
||||
double maxDiff = 0;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
double diff = Math.Abs(qResults[i] - nResults[i]);
|
||||
if (diff > maxDiff) maxDiff = diff;
|
||||
}
|
||||
|
||||
_output.WriteLine($"Max Difference between O(1) and Naive O(N): {maxDiff:F10}");
|
||||
Assert.True(maxDiff < 1e-9, $"O(1) implementation diverged too much: {maxDiff}");
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public class PwmaValidationTests
|
||||
var oValues = oResult.OutputValues["Pwma"];
|
||||
|
||||
// Compare
|
||||
ValidationHelper.VerifyData(qResult, oValues, (s) => s, tolerance: 1e-3);
|
||||
ValidationHelper.VerifyData(qResult, oValues, (s) => s, tolerance: 2e-4);
|
||||
}
|
||||
_output.WriteLine("PWMA validated successfully against Ooples");
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class RmaValidationTests : IDisposable
|
||||
int skip = period * 30;
|
||||
|
||||
int itemsToVerify = _testData.Data.Count - skip;
|
||||
ValidationHelper.VerifyData(quantalibResults, skenderResults, (s) => s.Smma, skip: itemsToVerify, tolerance: 1e-4);
|
||||
ValidationHelper.VerifyData(quantalibResults, skenderResults, (s) => s.Smma, skip: itemsToVerify, tolerance: ValidationHelper.OoplesTolerance);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -93,6 +93,6 @@ public class RmaValidationTests : IDisposable
|
||||
int skip = period * 30;
|
||||
int itemsToVerify = _testData.Data.Count - skip;
|
||||
|
||||
ValidationHelper.VerifyData(qResult, oValues, (s) => s, skip: itemsToVerify, tolerance: 5e-4);
|
||||
ValidationHelper.VerifyData(qResult, oValues, (s) => s, skip: itemsToVerify, tolerance: ValidationHelper.OoplesTolerance);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ public class SmaValidationTests : IDisposable
|
||||
var sResult = Calculations.CalculateSimpleMovingAverage(stockData, period).OutputValues.Values.First();
|
||||
|
||||
// Compare last 100 records
|
||||
ValidationHelper.VerifyData(qResult, sResult, (s) => s, tolerance: 1e-4);
|
||||
ValidationHelper.VerifyData(qResult, sResult, (s) => s, 100, ValidationHelper.OoplesTolerance);
|
||||
}
|
||||
_output.WriteLine("SMA Batch(TSeries) validated successfully against Ooples");
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class SsfValidationTests : IDisposable
|
||||
// We use a looser tolerance (10.0) because our implementation uses high-precision constants (Math.Sqrt(2) * Math.PI)
|
||||
// whereas Ooples likely uses the approximation (1.414 * 3.14159) found in some reference implementations.
|
||||
// This difference in constants causes a divergence in values.
|
||||
ValidationHelper.VerifyData(qResult, oValues, (s) => s, skip: period, tolerance: 10.0);
|
||||
ValidationHelper.VerifyData(qResult, oValues, (s) => s, skip: period, tolerance: ValidationHelper.OoplesTolerance);
|
||||
}
|
||||
_output.WriteLine("SSF validated successfully against Ooples");
|
||||
}
|
||||
|
||||
@@ -60,16 +60,16 @@ public class SuperValidationTests : IDisposable
|
||||
continue;
|
||||
}
|
||||
|
||||
Assert.Equal((double)skenderResults[i].SuperTrend!, results[i], 1e-7);
|
||||
Assert.Equal((double)skenderResults[i].SuperTrend!, results[i], ValidationHelper.SkenderTolerance);
|
||||
|
||||
if (skenderResults[i].UpperBand != null)
|
||||
{
|
||||
Assert.Equal((double)skenderResults[i].UpperBand!, upper[i], 1e-7);
|
||||
Assert.Equal((double)skenderResults[i].UpperBand!, upper[i], ValidationHelper.SkenderTolerance);
|
||||
}
|
||||
|
||||
if (skenderResults[i].LowerBand != null)
|
||||
{
|
||||
Assert.Equal((double)skenderResults[i].LowerBand!, lower[i], 1e-7);
|
||||
Assert.Equal((double)skenderResults[i].LowerBand!, lower[i], ValidationHelper.SkenderTolerance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ public class T3ValidationTests
|
||||
var oValues = oResult.OutputValues["T3"];
|
||||
|
||||
// Compare
|
||||
ValidationHelper.VerifyData(qResult, oValues, (s) => s, tolerance: 1e-3);
|
||||
ValidationHelper.VerifyData(qResult, oValues, (s) => s, tolerance: ValidationHelper.OoplesTolerance);
|
||||
}
|
||||
_output.WriteLine("T3 validated successfully against Ooples");
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class TrimaValidationTests
|
||||
int lookback = TALib.Functions.TrimaLookback(period);
|
||||
|
||||
// Compare last 100 records
|
||||
ValidationHelper.VerifyData(qResult, output, outRange, lookback, tolerance: 1e-4);
|
||||
ValidationHelper.VerifyData(qResult, output, outRange, lookback, tolerance: ValidationHelper.OoplesTolerance);
|
||||
}
|
||||
_output.WriteLine("TRIMA Batch(TSeries) validated successfully against TA-Lib");
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public class TrimaValidationTests
|
||||
var tResult = outputs[0];
|
||||
|
||||
// Compare last 100 records
|
||||
ValidationHelper.VerifyData(qResult, tResult, lookback, tolerance: 1e-4);
|
||||
ValidationHelper.VerifyData(qResult, tResult, lookback, tolerance: ValidationHelper.OoplesTolerance);
|
||||
}
|
||||
_output.WriteLine("TRIMA Batch(TSeries) validated successfully against Tulip");
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public class TrimaValidationTests
|
||||
int lookback = TALib.Functions.TrimaLookback(period);
|
||||
|
||||
// Compare last 100 records
|
||||
ValidationHelper.VerifyData(qOutput, talibOutput, outRange, lookback, tolerance: 1e-4);
|
||||
ValidationHelper.VerifyData(qOutput, talibOutput, outRange, lookback, tolerance: ValidationHelper.OoplesTolerance);
|
||||
}
|
||||
_output.WriteLine("TRIMA Span validated successfully against TA-Lib");
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class WmaValidationTests
|
||||
var sResult = _testData.SkenderQuotes.GetWma(period).ToList();
|
||||
|
||||
// Compare last 100 records
|
||||
ValidationHelper.VerifyData(qResult, sResult, x => x.Wma, tolerance: 1e-5);
|
||||
ValidationHelper.VerifyData(qResult, sResult, x => x.Wma, tolerance: ValidationHelper.SkenderTolerance);
|
||||
}
|
||||
_output.WriteLine("WMA Batch(TSeries) validated successfully against Skender");
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class WmaValidationTests
|
||||
var sResult = _testData.SkenderQuotes.GetWma(period).ToList();
|
||||
|
||||
// Compare last 100 records
|
||||
ValidationHelper.VerifyData(qResults, sResult, x => x.Wma, tolerance: 1e-5);
|
||||
ValidationHelper.VerifyData(qResults, sResult, x => x.Wma, tolerance: ValidationHelper.SkenderTolerance);
|
||||
}
|
||||
_output.WriteLine("WMA Streaming validated successfully against Skender");
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class WmaValidationTests
|
||||
var sResult = _testData.SkenderQuotes.GetWma(period).ToList();
|
||||
|
||||
// Compare last 100 records
|
||||
ValidationHelper.VerifyData(qOutput, sResult, x => x.Wma, tolerance: 1e-5);
|
||||
ValidationHelper.VerifyData(qOutput, sResult, x => x.Wma, tolerance: ValidationHelper.SkenderTolerance);
|
||||
}
|
||||
_output.WriteLine("WMA Span validated successfully against Skender");
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public class WmaValidationTests
|
||||
int lookback = TALib.Functions.WmaLookback(period);
|
||||
|
||||
// Compare last 100 records
|
||||
ValidationHelper.VerifyData(qResult, output, outRange, lookback, tolerance: 1e-4);
|
||||
ValidationHelper.VerifyData(qResult, output, outRange, lookback, tolerance: ValidationHelper.TalibTolerance);
|
||||
}
|
||||
_output.WriteLine("WMA Batch(TSeries) validated successfully against TA-Lib");
|
||||
}
|
||||
@@ -137,7 +137,7 @@ public class WmaValidationTests
|
||||
int lookback = TALib.Functions.WmaLookback(period);
|
||||
|
||||
// Compare last 100 records
|
||||
ValidationHelper.VerifyData(qResults, output, outRange, lookback, tolerance: 1e-4);
|
||||
ValidationHelper.VerifyData(qResults, output, outRange, lookback, tolerance: ValidationHelper.TalibTolerance);
|
||||
}
|
||||
_output.WriteLine("WMA Streaming validated successfully against TA-Lib");
|
||||
}
|
||||
@@ -163,7 +163,7 @@ public class WmaValidationTests
|
||||
int lookback = TALib.Functions.WmaLookback(period);
|
||||
|
||||
// Compare last 100 records
|
||||
ValidationHelper.VerifyData(qOutput, talibOutput, outRange, lookback, tolerance: 1e-4);
|
||||
ValidationHelper.VerifyData(qOutput, talibOutput, outRange, lookback, tolerance: ValidationHelper.TalibTolerance);
|
||||
}
|
||||
_output.WriteLine("WMA Span validated successfully against TA-Lib");
|
||||
}
|
||||
@@ -190,7 +190,7 @@ public class WmaValidationTests
|
||||
var tResult = outputs[0];
|
||||
|
||||
// Compare last 100 records
|
||||
ValidationHelper.VerifyData(qResult, tResult, lookback, tolerance: 1e-4);
|
||||
ValidationHelper.VerifyData(qResult, tResult, lookback, tolerance: ValidationHelper.TulipTolerance);
|
||||
}
|
||||
_output.WriteLine("WMA Batch(TSeries) validated successfully against Tulip");
|
||||
}
|
||||
@@ -221,7 +221,7 @@ public class WmaValidationTests
|
||||
var tResult = outputs[0];
|
||||
|
||||
// Compare last 100 records
|
||||
ValidationHelper.VerifyData(qResults, tResult, lookback, tolerance: 1e-4);
|
||||
ValidationHelper.VerifyData(qResults, tResult, lookback, tolerance: ValidationHelper.TulipTolerance);
|
||||
}
|
||||
_output.WriteLine("WMA Streaming validated successfully against Tulip");
|
||||
}
|
||||
@@ -248,7 +248,7 @@ public class WmaValidationTests
|
||||
var tResult = outputs[0];
|
||||
|
||||
// Compare last 100 records
|
||||
ValidationHelper.VerifyData(qOutput, tResult, lookback, tolerance: 1e-4);
|
||||
ValidationHelper.VerifyData(qOutput, tResult, lookback, tolerance: ValidationHelper.TulipTolerance);
|
||||
}
|
||||
_output.WriteLine("WMA Span validated successfully against Tulip");
|
||||
}
|
||||
@@ -281,7 +281,7 @@ public class WmaValidationTests
|
||||
var oValues = oResult.OutputValues["Wma"];
|
||||
|
||||
// Compare
|
||||
ValidationHelper.VerifyData(qResult, oValues, (s) => s, tolerance: 5e-4);
|
||||
ValidationHelper.VerifyData(qResult, oValues, (s) => s, tolerance: ValidationHelper.OoplesTolerance);
|
||||
}
|
||||
_output.WriteLine("WMA validated successfully against Ooples");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user