mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-25 05:48:06 +00:00
[CodeFactor] Apply fixes to commit 0606491
This commit is contained in:
@@ -148,7 +148,7 @@ public class VwapbandsIndicatorTests
|
||||
var now = DateTime.UtcNow;
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + i, 105 + i, 95 + i, 102 + i, 1000 + i * 100);
|
||||
indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + i, 105 + i, 95 + i, 102 + i, 1000 + (i * 100));
|
||||
indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar));
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ public class VwapbandsTests
|
||||
// Make multiple corrections
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
var correctionBar = new TBar(DateTime.UtcNow, 150 + i, 160 + i, 140 + i, 155 + i, 2000 + i * 100);
|
||||
var correctionBar = new TBar(DateTime.UtcNow, 150 + i, 160 + i, 140 + i, 155 + i, 2000 + (i * 100));
|
||||
vwapbands.Update(correctionBar, isNew: false);
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ public class VwapbandsTests
|
||||
vwapbands.Update(bar2);
|
||||
|
||||
// VWAP = (100*1000 + 110*2000) / (1000+2000) = 320000/3000 = 106.666...
|
||||
double expectedVwap = (100.0 * 1000 + 110.0 * 2000) / (1000 + 2000);
|
||||
double expectedVwap = ((100.0 * 1000) + (110.0 * 2000)) / (1000 + 2000);
|
||||
Assert.Equal(expectedVwap, vwapbands.Vwap.Value, precision: 10);
|
||||
}
|
||||
|
||||
@@ -600,7 +600,7 @@ public class VwapbandsTests
|
||||
|
||||
// VWAP should be closer to 100 due to higher volume
|
||||
// VWAP = (100*10000 + 200*100) / (10000+100) = 1020000/10100 ≈ 100.99
|
||||
double expectedVwap = (100.0 * 10000 + 200.0 * 100) / (10000 + 100);
|
||||
double expectedVwap = ((100.0 * 10000) + (200.0 * 100)) / (10000 + 100);
|
||||
Assert.Equal(expectedVwap, vwapbands.Vwap.Value, precision: 10);
|
||||
Assert.True(vwapbands.Vwap.Value < 110, "VWAP should be heavily weighted toward 100");
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ public sealed class VwapbandsValidationTests : IDisposable
|
||||
|
||||
// VWAP should be closer to 100 (high volume price)
|
||||
// VWAP = (100 × 10000 + 200 × 100) / (10000 + 100) = 1020000 / 10100 ≈ 100.99
|
||||
double expectedVwap = (100.0 * 10000 + 200.0 * 100) / (10000 + 100);
|
||||
double expectedVwap = ((100.0 * 10000) + (200.0 * 100)) / (10000 + 100);
|
||||
Assert.Equal(expectedVwap, vwapbands.Vwap.Value, precision: 10);
|
||||
Assert.True(vwapbands.Vwap.Value < 110, "VWAP should be heavily weighted toward 100");
|
||||
|
||||
@@ -434,7 +434,7 @@ public sealed class VwapbandsValidationTests : IDisposable
|
||||
// Multiple zero-volume bars with different prices
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
var zeroVolBar = new TBar(DateTime.UtcNow.AddMinutes(i + 1), 200 + i * 10, 200 + i * 10, 200 + i * 10, 200 + i * 10, 0);
|
||||
var zeroVolBar = new TBar(DateTime.UtcNow.AddMinutes(i + 1), 200 + (i * 10), 200 + (i * 10), 200 + (i * 10), 200 + (i * 10), 0);
|
||||
vwapbands.Update(zeroVolBar);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user