mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-17 01:58:06 +00:00
[CodeFactor] Apply fixes to commit 0606491
This commit is contained in:
@@ -100,10 +100,10 @@ public class MidpointIndicatorTests
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
@@ -1223,9 +1223,9 @@ public class TBarSeriesTests
|
||||
{
|
||||
times[i] = i;
|
||||
opens[i] = i * 10.0;
|
||||
highs[i] = i * 10.0 + 5.0;
|
||||
lows[i] = i * 10.0 - 5.0;
|
||||
closes[i] = i * 10.0 + 2.0;
|
||||
highs[i] = (i * 10.0) + 5.0;
|
||||
lows[i] = (i * 10.0) - 5.0;
|
||||
closes[i] = (i * 10.0) + 2.0;
|
||||
volumes[i] = i * 100.0;
|
||||
}
|
||||
|
||||
@@ -1233,7 +1233,7 @@ public class TBarSeriesTests
|
||||
|
||||
Assert.Equal(N, series.Count);
|
||||
Assert.Equal(0, series[0].Time);
|
||||
Assert.Equal((N - 1) * 10.0 + 2.0, series[N - 1].Close);
|
||||
Assert.Equal(((N - 1) * 10.0) + 2.0, series[N - 1].Close);
|
||||
Assert.Equal((N - 1) * 100.0, series[N - 1].Volume);
|
||||
}
|
||||
|
||||
@@ -1246,7 +1246,7 @@ public class TBarSeriesTests
|
||||
|
||||
for (int i = 0; i < N; i++)
|
||||
{
|
||||
bars[i] = new TBar(i, i * 10.0, i * 10.0 + 5.0, i * 10.0 - 5.0, i * 10.0 + 2.0, i * 100.0);
|
||||
bars[i] = new TBar(i, i * 10.0, (i * 10.0) + 5.0, (i * 10.0) - 5.0, (i * 10.0) + 2.0, i * 100.0);
|
||||
}
|
||||
|
||||
series.AddRange(bars);
|
||||
@@ -1254,6 +1254,6 @@ public class TBarSeriesTests
|
||||
Assert.Equal(N, series.Count);
|
||||
Assert.Equal(0, series[0].Time);
|
||||
Assert.Equal(2.0, series[0].Close);
|
||||
Assert.Equal((N - 1) * 10.0 + 2.0, series[N - 1].Close);
|
||||
Assert.Equal(((N - 1) * 10.0) + 2.0, series[N - 1].Close);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class BiInputIndicatorBaseTests
|
||||
var indicator = new Mae(5);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
indicator.Update(i * 10.0, i * 10.0 + 5.0);
|
||||
indicator.Update(i * 10.0, (i * 10.0) + 5.0);
|
||||
Assert.False(indicator.IsHot);
|
||||
}
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public class BiInputIndicatorBaseTests
|
||||
var indicator = new Mae(5);
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
indicator.Update(i * 10.0, i * 10.0 + 5.0);
|
||||
indicator.Update(i * 10.0, (i * 10.0) + 5.0);
|
||||
}
|
||||
Assert.True(indicator.IsHot);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public class BiInputIndicatorBaseTests
|
||||
var indicator = new Mae(3);
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
indicator.Update(i * 10.0, i * 10.0 + 5.0);
|
||||
indicator.Update(i * 10.0, (i * 10.0) + 5.0);
|
||||
}
|
||||
Assert.True(indicator.IsHot);
|
||||
}
|
||||
@@ -268,7 +268,7 @@ public class BiInputIndicatorBaseTests
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
indicator.Update(i * 10.0, i * 10.0 + 5.0);
|
||||
indicator.Update(i * 10.0, (i * 10.0) + 5.0);
|
||||
}
|
||||
double original = indicator.Last.Value;
|
||||
|
||||
@@ -360,7 +360,7 @@ public class BiInputIndicatorBaseTests
|
||||
var indicator = new Mae(3);
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
indicator.Update(i * 10.0, i * 10.0 + 5.0);
|
||||
indicator.Update(i * 10.0, (i * 10.0) + 5.0);
|
||||
}
|
||||
Assert.True(indicator.IsHot);
|
||||
|
||||
@@ -563,7 +563,7 @@ public class BiInputIndicatorBaseTests
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
actual.Add(now.AddMinutes(i), i * 10.0);
|
||||
predicted.Add(now.AddMinutes(i), i * 10.0 + 5.0);
|
||||
predicted.Add(now.AddMinutes(i), (i * 10.0) + 5.0);
|
||||
}
|
||||
|
||||
var result = Mae.Batch(actual, predicted, 5);
|
||||
@@ -603,7 +603,7 @@ public class BiInputIndicatorBaseTests
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
actual.Add(now.AddMinutes(i), i * 10.0);
|
||||
predicted.Add(now.AddMinutes(i), i * 10.0 + 3.0);
|
||||
predicted.Add(now.AddMinutes(i), (i * 10.0) + 3.0);
|
||||
}
|
||||
|
||||
var (results, indicator) = Mae.Calculate(actual, predicted, 5);
|
||||
@@ -647,7 +647,7 @@ public class BiInputIndicatorBaseTests
|
||||
{
|
||||
var bar = gbm.Next();
|
||||
actual[i] = bar.Close;
|
||||
predicted[i] = bar.Close * 1.03 + 1.0;
|
||||
predicted[i] = (bar.Close * 1.03) + 1.0;
|
||||
}
|
||||
|
||||
// Streaming
|
||||
|
||||
@@ -536,7 +536,6 @@ public class TSeriesTests
|
||||
Assert.Equal(3.0, series[2].Value);
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void GetEnumerator_ExplicitGenericInterface_Works()
|
||||
{
|
||||
|
||||
@@ -100,7 +100,7 @@ public sealed class WclpriceValidationTests : IDisposable
|
||||
var bar = new TBar(DateTime.UtcNow, open: 10.0, high: 20.0, low: 8.0, close: 16.0, volume: 1000);
|
||||
var ind = new Wclprice();
|
||||
var result = ind.Update(bar, isNew: true);
|
||||
double expected = (20.0 + 8.0 + 2.0 * 16.0) / 4.0; // = 15.0
|
||||
double expected = (20.0 + 8.0 + (2.0 * 16.0)) / 4.0; // = 15.0
|
||||
Assert.Equal(expected, result.Value, 1e-12);
|
||||
_output.WriteLine($"WCLPRICE formula: expected={expected}, actual={result.Value}: PASSED");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user