[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
+7 -7
View File
@@ -127,9 +127,9 @@ public class RviTests
for (int i = 0; i < 50; i++)
{
var time = DateTime.UtcNow.AddSeconds(i);
double close = 100.0 + Math.Sin(i * 0.5) * 3.0; // oscillating
double high = close + 2.0 + Math.Sin(i * 0.3) * 1.5; // asymmetric highs
double low = close - 1.0 - Math.Cos(i * 0.7) * 0.8; // asymmetric lows
double close = 100.0 + (Math.Sin(i * 0.5) * 3.0); // oscillating
double high = close + 2.0 + (Math.Sin(i * 0.3) * 1.5); // asymmetric highs
double low = close - 1.0 - (Math.Cos(i * 0.7) * 0.8); // asymmetric lows
rviBar.Update(new TBar(time, close - 0.5, high, low, close, 1000));
rviClose.Update(new TValue(time, close));
@@ -267,7 +267,7 @@ public class RviTests
// Build up some history
for (int i = 0; i < 20; i++)
{
rvi.Update(new TValue(time.AddSeconds(i), 100.0 + i * 0.1), isNew: true);
rvi.Update(new TValue(time.AddSeconds(i), 100.0 + (i * 0.1)), isNew: true);
}
_ = rvi.Last; // Capture state before update
@@ -291,7 +291,7 @@ public class RviTests
// Build history
for (int i = 0; i < 30; i++)
{
rvi.Update(new TValue(time.AddSeconds(i), 100.0 + i * 0.5), isNew: true);
rvi.Update(new TValue(time.AddSeconds(i), 100.0 + (i * 0.5)), isNew: true);
}
// Start a new bar
@@ -648,7 +648,7 @@ public class RviTests
var source = new TSeries();
for (int i = 0; i < 50; i++)
{
source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * 0.5));
source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (i * 0.5)));
}
var result = Rvi.Batch(source, stdevLength: 10, rmaLength: 14);
@@ -665,7 +665,7 @@ public class RviTests
for (int i = 0; i < 50; i++)
{
var time = DateTime.UtcNow.AddSeconds(i);
double price = 100.0 + i * 0.5;
double price = 100.0 + (i * 0.5);
source.Add(new TBar(time, price - 1, price + 1, price - 2, price, 1000));
}
+4 -5
View File
@@ -167,7 +167,7 @@ public class RviValidationTests
for (int i = 0; i < 100; i++)
{
rvi.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 + i * 0.5));
rvi.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 + (i * 0.5)));
}
Assert.True(rvi.Last.Value > 80.0, $"Strictly rising prices should produce high RVI, got {rvi.Last.Value}");
@@ -183,7 +183,7 @@ public class RviValidationTests
for (int i = 0; i < 100; i++)
{
rvi.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 - i * 0.5));
rvi.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 - (i * 0.5)));
}
Assert.True(rvi.Last.Value < 20.0, $"Strictly falling prices should produce low RVI, got {rvi.Last.Value}");
@@ -486,7 +486,7 @@ public class RviValidationTests
// Multiple corrections on same price
for (int j = 0; j < 5; j++)
{
var tempPrice = new TValue(prices[29].Time, prices[29].Value * (1.0 + j * 0.01));
var tempPrice = new TValue(prices[29].Time, prices[29].Value * (1.0 + (j * 0.01)));
rvi.Update(tempPrice, isNew: false);
}
@@ -575,7 +575,7 @@ public class RviValidationTests
// Symmetric oscillation
for (int i = 0; i < 200; i++)
{
double price = 100.0 + Math.Sin(i * 0.1) * 5; // Oscillating ±5
double price = 100.0 + (Math.Sin(i * 0.1) * 5); // Oscillating ±5
rvi.Update(new TValue(DateTime.UtcNow.AddMinutes(i), price));
}
@@ -621,5 +621,4 @@ public class RviValidationTests
double mean = values.Average();
return values.Average(v => Math.Pow(v - mean, 2));
}
}