mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-24 13:38:05 +00:00
Refactor and optimize various components of QuanTAlib
- Removed WmaVector class to streamline weighted moving average calculations. - Simplified RingBuffer implementation by removing unnecessary comments and improving clarity. - Enhanced SIMD extensions for better performance and readability. - Updated TBar and TBarSeries classes to improve property calculations and reduce overhead. - Cleaned up TValue struct by removing redundant comments. - Added comprehensive unit tests for IndicatorExtensions and TrimaIndicator to ensure functionality and correctness.
This commit is contained in:
@@ -108,7 +108,6 @@ public class TrimaTests
|
||||
|
||||
trima.Update(new TValue(DateTime.UtcNow, 100));
|
||||
trima.Update(new TValue(DateTime.UtcNow, 105));
|
||||
double valueBefore = trima.Value;
|
||||
|
||||
trima.Reset();
|
||||
|
||||
@@ -151,20 +150,24 @@ public class TrimaTests
|
||||
|
||||
// Calculate iteratively
|
||||
var iterativeResults = new TSeries();
|
||||
#pragma warning disable S4158 // Collection is known to be empty
|
||||
foreach (var item in series)
|
||||
{
|
||||
iterativeResults.Add(trimaIterative.Update(item));
|
||||
}
|
||||
#pragma warning restore S4158
|
||||
|
||||
// Calculate batch
|
||||
var batchResults = trimaBatch.Update(series);
|
||||
|
||||
// Compare
|
||||
Assert.Equal(iterativeResults.Count, batchResults.Count);
|
||||
#pragma warning disable S2583 // Condition always evaluates to false
|
||||
for (int i = 0; i < iterativeResults.Count; i++)
|
||||
{
|
||||
Assert.Equal(iterativeResults[i].Value, batchResults[i].Value, 1e-10);
|
||||
}
|
||||
#pragma warning restore S2583
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user