mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-16 09:38:05 +00:00
[CodeFactor] Apply fixes
This commit is contained in:
@@ -135,7 +135,7 @@ public class EventingTests
|
||||
randomValue,
|
||||
randomValue + Math.Abs(GetRandomDouble(rng) * 10),
|
||||
randomValue - Math.Abs(GetRandomDouble(rng) * 10),
|
||||
randomValue + GetRandomDouble(rng) * 5,
|
||||
randomValue + (GetRandomDouble(rng) * 5),
|
||||
Math.Abs(GetRandomDouble(rng) * 1000),
|
||||
true
|
||||
);
|
||||
|
||||
+4
-4
@@ -125,10 +125,10 @@ public class BarIndicatorTests
|
||||
/// <returns>A randomly generated TBar.</returns>
|
||||
private TBar GenerateRandomBar(bool isNew)
|
||||
{
|
||||
double open = GetRandomDouble() * 200 - 100;
|
||||
double close = GetRandomDouble() * 200 - 100;
|
||||
double high = Math.Max(open, close) + GetRandomDouble() * 10;
|
||||
double low = Math.Min(open, close) - GetRandomDouble() * 10;
|
||||
double open = (GetRandomDouble() * 200) - 100;
|
||||
double close = (GetRandomDouble() * 200) - 100;
|
||||
double high = Math.Max(open, close) + (GetRandomDouble() * 10);
|
||||
double low = Math.Min(open, close) - (GetRandomDouble() * 10);
|
||||
long volume = GetRandomNumber(0, 10000);
|
||||
|
||||
return new TBar(Time: DateTime.Now, Open: open, High: high, Low: low, Close: close, Volume: volume, IsNew: isNew);
|
||||
|
||||
@@ -14,7 +14,7 @@ public class AveragesUpdateTests
|
||||
{
|
||||
byte[] bytes = new byte[8];
|
||||
rng.GetBytes(bytes);
|
||||
return (double)BitConverter.ToUInt64(bytes, 0) / ulong.MaxValue * 200 - 100; // Range: -100 to 100
|
||||
return ((double)BitConverter.ToUInt64(bytes, 0) / ulong.MaxValue * 200) - 100; // Range: -100 to 100
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -14,7 +14,7 @@ public class UpdateTests
|
||||
{
|
||||
byte[] bytes = new byte[8];
|
||||
rng.GetBytes(bytes);
|
||||
return (double)BitConverter.ToUInt64(bytes, 0) / ulong.MaxValue * 200 - 100; // Range: -100 to 100
|
||||
return ((double)BitConverter.ToUInt64(bytes, 0) / ulong.MaxValue * 200) - 100; // Range: -100 to 100
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -14,7 +14,7 @@ public class MomentumUpdateTests
|
||||
{
|
||||
byte[] bytes = new byte[8];
|
||||
rng.GetBytes(bytes);
|
||||
return (double)BitConverter.ToUInt64(bytes, 0) / ulong.MaxValue * 200 - 100; // Range: -100 to 100
|
||||
return ((double)BitConverter.ToUInt64(bytes, 0) / ulong.MaxValue * 200) - 100; // Range: -100 to 100
|
||||
}
|
||||
|
||||
private TBar GetRandomBar(bool IsNew)
|
||||
@@ -22,7 +22,7 @@ public class MomentumUpdateTests
|
||||
double open = GetRandomDouble();
|
||||
double high = open + Math.Abs(GetRandomDouble());
|
||||
double low = open - Math.Abs(GetRandomDouble());
|
||||
double close = low + (high - low) * GetRandomDouble();
|
||||
double close = low + ((high - low) * GetRandomDouble());
|
||||
return new TBar(DateTime.Now, open, high, low, close, 1000, IsNew);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public class OscillatorsUpdateTests
|
||||
{
|
||||
byte[] bytes = new byte[8];
|
||||
rng.GetBytes(bytes);
|
||||
return (double)BitConverter.ToUInt64(bytes, 0) / ulong.MaxValue * 200 - 100; // Range: -100 to 100
|
||||
return ((double)BitConverter.ToUInt64(bytes, 0) / ulong.MaxValue * 200) - 100; // Range: -100 to 100
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -14,7 +14,7 @@ public class StatisticsUpdateTests
|
||||
{
|
||||
byte[] bytes = new byte[8];
|
||||
rng.GetBytes(bytes);
|
||||
return (double)BitConverter.ToUInt64(bytes, 0) / ulong.MaxValue * 200 - 100; // Range: -100 to 100
|
||||
return ((double)BitConverter.ToUInt64(bytes, 0) / ulong.MaxValue * 200) - 100; // Range: -100 to 100
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -14,7 +14,7 @@ public class VolatilityUpdateTests
|
||||
{
|
||||
byte[] bytes = new byte[8];
|
||||
rng.GetBytes(bytes);
|
||||
return (double)BitConverter.ToUInt64(bytes, 0) / ulong.MaxValue * 200 - 100; // Range: -100 to 100
|
||||
return ((double)BitConverter.ToUInt64(bytes, 0) / ulong.MaxValue * 200) - 100; // Range: -100 to 100
|
||||
}
|
||||
|
||||
private TBar GetRandomBar(bool IsNew)
|
||||
@@ -22,7 +22,7 @@ public class VolatilityUpdateTests
|
||||
double open = GetRandomDouble();
|
||||
double high = open + Math.Abs(GetRandomDouble());
|
||||
double low = open - Math.Abs(GetRandomDouble());
|
||||
double close = low + (high - low) * GetRandomDouble();
|
||||
double close = low + ((high - low) * GetRandomDouble());
|
||||
return new TBar(DateTime.Now, open, high, low, close, 1000, IsNew);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public class VolumeUpdateTests
|
||||
{
|
||||
byte[] bytes = new byte[8];
|
||||
rng.GetBytes(bytes);
|
||||
return (double)BitConverter.ToUInt64(bytes, 0) / ulong.MaxValue * 200 - 100; // Range: -100 to 100
|
||||
return ((double)BitConverter.ToUInt64(bytes, 0) / ulong.MaxValue * 200) - 100; // Range: -100 to 100
|
||||
}
|
||||
|
||||
private TBar GetRandomBar(bool IsNew)
|
||||
@@ -21,7 +21,7 @@ public class VolumeUpdateTests
|
||||
double open = GetRandomDouble();
|
||||
double high = open + Math.Abs(GetRandomDouble());
|
||||
double low = open - Math.Abs(GetRandomDouble());
|
||||
double close = low + (high - low) * GetRandomDouble();
|
||||
double close = low + ((high - low) * GetRandomDouble());
|
||||
double volume = Math.Abs(GetRandomDouble()) * 1000; // Random positive volume
|
||||
return new TBar(DateTime.Now, open, high, low, close, volume, IsNew);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user