[CodeFactor] Apply fixes to commit 4a01f03

This commit is contained in:
codefactor-io
2026-03-11 03:35:12 +00:00
parent 4a01f03cb4
commit 567fa89465
63 changed files with 293 additions and 302 deletions
+5 -5
View File
@@ -103,10 +103,10 @@ public class DecayIndicatorTests
{
indicator.HistoricalData.AddBar(
now.AddMinutes(i),
100 + i * 2,
105 + i * 2,
95 + i * 2,
102 + i * 2);
100 + (i * 2),
105 + (i * 2),
95 + (i * 2),
102 + (i * 2));
indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar));
}
@@ -158,7 +158,7 @@ public class DecayIndicatorTests
for (int i = 0; i < 10; i++)
{
double price = 100 + i * 5;
double price = 100 + (i * 5);
indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price);
indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar));
}
+1 -1
View File
@@ -337,7 +337,7 @@ public class DecayTests
for (int i = 0; i < largeSize; i++)
{
source[i] = 100.0 + i * 0.1;
source[i] = 100.0 + (i * 0.1);
}
Decay.Batch(source, output, TestPeriod);
+1 -1
View File
@@ -331,7 +331,7 @@ public class DwtValidationTests
// Build state well past warmup (WarmupPeriod = 2^4 = 16)
for (int i = 0; i < 50; i++)
{
ind.Update(new TValue(t0.AddSeconds(i), 100.0 + i * 0.5));
ind.Update(new TValue(t0.AddSeconds(i), 100.0 + (i * 0.5)));
}
// Anchor bar
+2 -2
View File
@@ -440,9 +440,9 @@ public sealed class Dwt : AbstractBase
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static double Get(Span<double> b, int h, int c, int lag)
{
int idx = ((h - 1 - lag) % c + c) % c;
int idx = (((h - 1 - lag) % c) + c) % c;
int maxLag = c - 1;
if (lag > maxLag) { idx = ((h - 1 - maxLag) % c + c) % c; }
if (lag > maxLag) { idx = (((h - 1 - maxLag) % c) + c) % c; }
return b[idx];
}
@@ -103,10 +103,10 @@ public class EdecayIndicatorTests
{
indicator.HistoricalData.AddBar(
now.AddMinutes(i),
100 + i * 2,
105 + i * 2,
95 + i * 2,
102 + i * 2);
100 + (i * 2),
105 + (i * 2),
95 + (i * 2),
102 + (i * 2));
indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar));
}
@@ -158,7 +158,7 @@ public class EdecayIndicatorTests
for (int i = 0; i < 10; i++)
{
double price = 100 + i * 5;
double price = 100 + (i * 5);
indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price);
indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar));
}
+1 -1
View File
@@ -337,7 +337,7 @@ public class EdecayTests
for (int i = 0; i < largeSize; i++)
{
source[i] = 100.0 + i * 0.1;
source[i] = 100.0 + (i * 0.1);
}
Edecay.Batch(source, output, TestPeriod);
+3 -3
View File
@@ -53,7 +53,7 @@ public class FftValidationTests
for (int i = 0; i < windowSize * 3; i++)
{
double signal = 50.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / targetPeriod);
double signal = 50.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / targetPeriod));
indicator.Update(new TValue(time.AddMinutes(i), signal), true);
}
@@ -74,7 +74,7 @@ public class FftValidationTests
for (int i = 0; i < windowSize * 4; i++)
{
double signal = 50.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / targetPeriod);
double signal = 50.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / targetPeriod));
indicator.Update(new TValue(time.AddMinutes(i), signal), true);
}
@@ -246,7 +246,7 @@ public class FftValidationTests
for (int i = 0; i < 50; i++)
{
ind.Update(new TValue(t0.AddSeconds(i), 100.0 + 10.0 * Math.Sin(2 * Math.PI * i / 8.0)));
ind.Update(new TValue(t0.AddSeconds(i), 100.0 + (10.0 * Math.Sin(2 * Math.PI * i / 8.0))));
}
var anchorTime = t0.AddSeconds(50);
+4 -4
View File
@@ -84,7 +84,7 @@ public sealed class Fft : AbstractBase
_hanning = new double[windowSize];
for (int n = 0; n < windowSize; n++)
{
_hanning[n] = 0.5 - 0.5 * Math.Cos(twoPiOverN * n);
_hanning[n] = 0.5 - (0.5 * Math.Cos(twoPiOverN * n));
}
// Precompute bit-reversal permutation table
@@ -262,7 +262,7 @@ public sealed class Fft : AbstractBase
}
// Parabolic interpolation: shift = 0.5*(a-c)/(a - 2b + c)
double denom = a - 2.0 * b + c;
double denom = a - (2.0 * b) + c;
double shift = Math.Abs(denom) > 0.0 ? 0.5 * (a - c) / denom : 0.0;
double dominantPeriod = (double)_windowSize / (bestK + shift);
@@ -417,7 +417,7 @@ public sealed class Fft : AbstractBase
{
for (int n = 0; n < windowSize; n++)
{
hanning[n] = 0.5 - 0.5 * Math.Cos(twoPiOverN * n);
hanning[n] = 0.5 - (0.5 * Math.Cos(twoPiOverN * n));
bitRev[n] = BitReverse(n, log2N);
}
@@ -476,7 +476,7 @@ public sealed class Fft : AbstractBase
workIm[bestK + 1] * workIm[bestK + 1])
: bestMag;
double denom = a - 2.0 * bestMag + c;
double denom = a - (2.0 * bestMag) + c;
double shift = Math.Abs(denom) > 0.0 ? 0.5 * (a - c) / denom : 0.0;
double dominant = (double)windowSize / (bestK + shift);
double clamped = Math.Clamp(dominant, minPeriod, maxPeriod);
+2 -2
View File
@@ -73,7 +73,7 @@ public sealed class Ifft : AbstractBase
_hanning = new double[windowSize];
for (int n = 0; n < windowSize; n++)
{
_hanning[n] = 0.5 - 0.5 * Math.Cos(twoPiOverN * n);
_hanning[n] = 0.5 - (0.5 * Math.Cos(twoPiOverN * n));
}
// Precompute bit-reversal permutation table
@@ -330,7 +330,7 @@ public sealed class Ifft : AbstractBase
{
for (int n = 0; n < windowSize; n++)
{
hanning[n] = 0.5 - 0.5 * Math.Cos(twoPiOverN * n);
hanning[n] = 0.5 - (0.5 * Math.Cos(twoPiOverN * n));
bitRev[n] = BitReverse(n, log2N);
}