[CodeFactor] Apply fixes to commit 0606491

This commit is contained in:
codefactor-io
2026-03-12 19:37:50 +00:00
parent 060649192f
commit 8f79257155
384 changed files with 1197 additions and 1215 deletions
@@ -61,7 +61,7 @@ public class CvIndicatorTests
var now = DateTime.UtcNow;
for (int i = 0; i < 30; i++)
{
double basePrice = 100 + i * 2 + (i % 2 == 0 ? 5 : -5); // Add some volatility
double basePrice = 100 + (i * 2) + (i % 2 == 0 ? 5 : -5); // Add some volatility
indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 5, basePrice - 5, basePrice + 2, 1000);
// Process update for each bar to simulate history loading
+4 -4
View File
@@ -354,7 +354,7 @@ public class CvTests
// Stable prices (small changes)
for (int i = 0; i < 20; i++)
{
cvStable.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + i * 0.01));
cvStable.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + (i * 0.01)));
}
// Volatile prices (alternating)
@@ -399,7 +399,7 @@ public class CvTests
// Low volatility period
for (int i = 0; i < 15; i++)
{
cv.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + i * 0.1));
cv.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + (i * 0.1)));
}
double lowVolResult = cv.Last.Value;
@@ -420,7 +420,7 @@ public class CvTests
// Establish long-run variance
for (int i = 0; i < 15; i++)
{
cv.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + i * 0.5));
cv.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + (i * 0.5)));
}
// Introduce shock
@@ -430,7 +430,7 @@ public class CvTests
// Let it decay
for (int i = 16; i < 50; i++)
{
cv.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + (i - 16) * 0.1));
cv.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + ((i - 16) * 0.1)));
}
double decayedVol = cv.Last.Value;
@@ -77,7 +77,7 @@ public class CvValidationTests
// Warmup with stable prices
for (int i = 0; i < 25; i++)
{
double price = 100.0 * (1 + 0.001 * (i % 2 == 0 ? 1 : -1));
double price = 100.0 * (1 + (0.001 * (i % 2 == 0 ? 1 : -1)));
cv.Update(new TValue(DateTime.UtcNow.AddMinutes(i), price));
}
@@ -95,7 +95,7 @@ public class CvValidationTests
double lastVol = shockVol;
for (int i = 0; i < 50; i++)
{
double price = 120.0 * (1 + 0.0001 * (i % 2 == 0 ? 1 : -1)); // Very stable prices
double price = 120.0 * (1 + (0.0001 * (i % 2 == 0 ? 1 : -1))); // Very stable prices
cv.Update(new TValue(DateTime.UtcNow.AddMinutes(31 + i), price));
lastVol = cv.Last.Value;
}
@@ -117,7 +117,7 @@ public class CvValidationTests
// Warmup
for (int i = 0; i < 25; i++)
{
cv.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 + i * 0.1));
cv.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 + (i * 0.1)));
}
// Series of large moves
@@ -172,7 +172,7 @@ public class CvValidationTests
for (int i = period; i < logReturns.Length; i++)
{
double prevReturn = logReturns[i - 1];
variance = omega + alpha * prevReturn * prevReturn + beta * variance;
variance = omega + (alpha * prevReturn * prevReturn) + (beta * variance);
}
// Expected annualized volatility
@@ -331,7 +331,7 @@ public class CvValidationTests
// Warmup with stable prices then shock
for (int i = 0; i < 25; i++)
{
double price = 100.0 + i * 0.1;
double price = 100.0 + (i * 0.1);
cvLowBeta.Update(new TValue(DateTime.UtcNow.AddMinutes(i), price));
cvHighBeta.Update(new TValue(DateTime.UtcNow.AddMinutes(i), price));
}
@@ -346,7 +346,7 @@ public class CvValidationTests
// Continue with stable prices - track decay
for (int i = 0; i < 20; i++)
{
double price = 120.0 + i * 0.05;
double price = 120.0 + (i * 0.05);
cvLowBeta.Update(new TValue(DateTime.UtcNow.AddMinutes(31 + i), price));
cvHighBeta.Update(new TValue(DateTime.UtcNow.AddMinutes(31 + i), price));
}