mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-25 22:08:05 +00:00
[CodeFactor] Apply fixes to commit 0606491
This commit is contained in:
@@ -269,7 +269,7 @@ public class HomodIndicatorTests
|
||||
// Generate sine wave pattern
|
||||
for (int i = 0; i < 200; i++)
|
||||
{
|
||||
double price = 100.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / knownPeriod);
|
||||
double price = 100.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / knownPeriod));
|
||||
indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 1, price - 1, price);
|
||||
indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar));
|
||||
}
|
||||
@@ -309,7 +309,7 @@ public class HomodIndicatorTests
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
double price = 100.0 + i * 0.5; // Trending up
|
||||
double price = 100.0 + (i * 0.5); // Trending up
|
||||
indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 1, price - 1, price);
|
||||
indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar));
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ public class HomodTests
|
||||
// Build some history
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10), isNew: true);
|
||||
homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10)), isNew: true);
|
||||
}
|
||||
|
||||
homod.Update(new TValue(DateTime.UtcNow.AddSeconds(100), 110.0), isNew: true);
|
||||
@@ -213,7 +213,7 @@ public class HomodTests
|
||||
// First run
|
||||
for (int i = 0; i < 200; i++)
|
||||
{
|
||||
homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10));
|
||||
homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10)));
|
||||
}
|
||||
var firstResult = homod.Last.Value;
|
||||
|
||||
@@ -222,7 +222,7 @@ public class HomodTests
|
||||
// Second run with same data
|
||||
for (int i = 0; i < 200; i++)
|
||||
{
|
||||
homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10));
|
||||
homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10)));
|
||||
}
|
||||
var secondResult = homod.Last.Value;
|
||||
|
||||
@@ -407,7 +407,7 @@ public class HomodTests
|
||||
|
||||
for (int i = 0; i < 200; i++)
|
||||
{
|
||||
source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10));
|
||||
source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10)));
|
||||
}
|
||||
|
||||
Assert.True(homod.IsHot);
|
||||
@@ -423,7 +423,7 @@ public class HomodTests
|
||||
|
||||
for (int i = 0; i < 300; i++)
|
||||
{
|
||||
source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10));
|
||||
source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10)));
|
||||
}
|
||||
|
||||
// Both should have values
|
||||
|
||||
@@ -110,7 +110,7 @@ public class HomodValidationTests
|
||||
// Generate 500 bars of sine wave
|
||||
for (int i = 0; i < 500; i++)
|
||||
{
|
||||
double value = 100.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / knownPeriod);
|
||||
double value = 100.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / knownPeriod));
|
||||
homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), value));
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class HomodValidationTests
|
||||
// Generate sine wave with specified period
|
||||
for (int i = 0; i < 600; i++)
|
||||
{
|
||||
double value = 100.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / period);
|
||||
double value = 100.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / period));
|
||||
homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), value));
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ public class HomodValidationTests
|
||||
// Strong uptrend with no cyclical component
|
||||
for (int i = 0; i < 500; i++)
|
||||
{
|
||||
double value = 100.0 + i * 0.5;
|
||||
double value = 100.0 + (i * 0.5);
|
||||
var result = homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), value));
|
||||
Assert.True(double.IsFinite(result.Value));
|
||||
}
|
||||
@@ -339,7 +339,7 @@ public class HomodValidationTests
|
||||
// Generate synthetic cycle
|
||||
for (int i = 0; i < 200; i++)
|
||||
{
|
||||
double value = 100.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / 20);
|
||||
double value = 100.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / 20));
|
||||
homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), value));
|
||||
}
|
||||
|
||||
@@ -347,7 +347,7 @@ public class HomodValidationTests
|
||||
var postWarmupValues = new List<double>();
|
||||
for (int i = 200; i < 400; i++)
|
||||
{
|
||||
double value = 100.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / 20);
|
||||
double value = 100.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / 20));
|
||||
var result = homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), value));
|
||||
postWarmupValues.Add(result.Value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user