mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-17 10:08:05 +00:00
feat: Add new CodeQL extension for C# and SonarLint configuration
- Introduced a new CodeQL extension for C# in `.github/codeql/extensions/quantalib-csharp/codeql-pack.yml`. - Added SonarLint configuration in `.sonarlint/CSharp/SonarLint.xml` and `.sonarlint/csharp.ruleset` to suppress specific rules for high-performance indicators. - Removed outdated `.vscode/launch.json` configurations. - Updated `.vscode/tasks.json` to streamline build and test tasks, including renaming and consolidating tasks. - Modified `Directory.Build.props` to enhance SARIF output directory handling and integrate SonarLint rules. - Refactored various indicator classes to improve code clarity and maintainability, including updates to method parameters for consistency. - Added XML documentation comments to several classes and methods for better code understanding. - Improved numerical stability in calculations by replacing direct comparisons with `double.Epsilon` checks in multiple classes.
This commit is contained in:
@@ -39,8 +39,8 @@ public sealed class Vama : AbstractBase
|
||||
{
|
||||
public static VamaState New() => new()
|
||||
{
|
||||
ShortAtr = new RmaState(0, 1.0, false),
|
||||
LongAtr = new RmaState(0, 1.0, false),
|
||||
ShortAtr = new RmaState(Ema: 0, E: 1.0, IsCompensated: false),
|
||||
LongAtr = new RmaState(Ema: 0, E: 1.0, IsCompensated: false),
|
||||
PrevClose = double.NaN,
|
||||
BufferHead = 0,
|
||||
BufferSum = 0,
|
||||
@@ -244,7 +244,7 @@ public sealed class Vama : AbstractBase
|
||||
newHead,
|
||||
bufferSum,
|
||||
validCount,
|
||||
true);
|
||||
IsInitialized: true);
|
||||
|
||||
Last = new TValue(input.Time, result);
|
||||
PubEvent(Last, isNew);
|
||||
@@ -285,7 +285,7 @@ public sealed class Vama : AbstractBase
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
var bar = source[i];
|
||||
var result = Update(bar, true);
|
||||
var result = Update(bar, isNew: true);
|
||||
tSpan[i] = bar.Time;
|
||||
vSpan[i] = result.Value;
|
||||
}
|
||||
@@ -314,7 +314,7 @@ public sealed class Vama : AbstractBase
|
||||
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
var result = Update(new TValue(sourceTimes[i], sourceValues[i]), true);
|
||||
var result = Update(new TValue(sourceTimes[i], sourceValues[i]), isNew: true);
|
||||
tSpan[i] = sourceTimes[i];
|
||||
vSpan[i] = result.Value;
|
||||
}
|
||||
@@ -330,7 +330,7 @@ public sealed class Vama : AbstractBase
|
||||
Reset();
|
||||
foreach (double val in source)
|
||||
{
|
||||
Update(new TValue(DateTime.MinValue, val), true);
|
||||
Update(new TValue(DateTime.MinValue, val), isNew: true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ public sealed class Yzvama : AbstractBase
|
||||
{
|
||||
public static YzvamaState New() => new()
|
||||
{
|
||||
ShortVar = new RmaState(0, 1.0, false),
|
||||
LongVar = new RmaState(0, 1.0, false),
|
||||
ShortVar = new RmaState(Ema: 0, E: 1.0, IsCompensated: false),
|
||||
LongVar = new RmaState(Ema: 0, E: 1.0, IsCompensated: false),
|
||||
PrevClose = double.NaN,
|
||||
SourceHead = 0,
|
||||
SourceSum = 0,
|
||||
@@ -390,7 +390,7 @@ public sealed class Yzvama : AbstractBase
|
||||
validCount,
|
||||
yzvHead,
|
||||
yzvCount,
|
||||
true);
|
||||
IsInitialized: true);
|
||||
|
||||
Last = new TValue(input.Time, result);
|
||||
PubEvent(Last, isNew);
|
||||
@@ -428,7 +428,7 @@ public sealed class Yzvama : AbstractBase
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
var bar = source[i];
|
||||
var result = Update(bar, true);
|
||||
var result = Update(bar, isNew: true);
|
||||
tSpan[i] = bar.Time;
|
||||
vSpan[i] = result.Value;
|
||||
}
|
||||
@@ -457,7 +457,7 @@ public sealed class Yzvama : AbstractBase
|
||||
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
var result = Update(new TValue(sourceTimes[i], sourceValues[i]), true);
|
||||
var result = Update(new TValue(sourceTimes[i], sourceValues[i]), isNew: true);
|
||||
tSpan[i] = sourceTimes[i];
|
||||
vSpan[i] = result.Value;
|
||||
}
|
||||
@@ -473,7 +473,7 @@ public sealed class Yzvama : AbstractBase
|
||||
{
|
||||
Reset();
|
||||
foreach (double val in source)
|
||||
Update(new TValue(DateTime.MinValue, val), true);
|
||||
Update(new TValue(DateTime.MinValue, val), isNew: true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -484,7 +484,7 @@ public sealed class Yzvama : AbstractBase
|
||||
{
|
||||
Reset();
|
||||
foreach (TValue tv in source)
|
||||
Update(tv, true);
|
||||
Update(tv, isNew: true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -7,7 +7,7 @@ public class ZlemaValidationTests
|
||||
[Fact]
|
||||
public void Zlema_Streaming_MatchesReference()
|
||||
{
|
||||
int period = 20;
|
||||
const int period = 20;
|
||||
TSeries series = BuildSeries(300, seed: 5);
|
||||
double[] reference = new double[series.Count];
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ZlemaValidationTests
|
||||
[Fact]
|
||||
public void Zlema_Batch_MatchesReference()
|
||||
{
|
||||
int period = 14;
|
||||
const int period = 14;
|
||||
TSeries series = BuildSeries(250, seed: 9);
|
||||
double[] reference = new double[series.Count];
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ZlemaValidationTests
|
||||
[Fact]
|
||||
public void Zlema_Span_MatchesReference()
|
||||
{
|
||||
int period = 30;
|
||||
const int period = 30;
|
||||
TSeries series = BuildSeries(200, seed: 12);
|
||||
double[] values = series.Values.ToArray();
|
||||
var output = new double[values.Length];
|
||||
|
||||
Reference in New Issue
Block a user