pull request changes

This commit is contained in:
Miha Kralj
2024-10-08 10:31:04 -07:00
parent af234594cc
commit 931bbdb6a0
5 changed files with 38 additions and 41 deletions
+6 -9
View File
@@ -26,8 +26,7 @@ jobs:
- name: Setup .NET SDK - name: Setup .NET SDK
uses: actions/setup-dotnet@v3 uses: actions/setup-dotnet@v3
with: with:
dotnet-version: '9.x' dotnet-version: '8.x'
dotnet-quality: 'preview'
- name: Install JDK11 for Sonar Scanner - name: Install JDK11 for Sonar Scanner
uses: actions/setup-java@v3 uses: actions/setup-java@v3
@@ -80,8 +79,7 @@ jobs:
- name: Setup .NET SDK - name: Setup .NET SDK
uses: actions/setup-dotnet@v3 uses: actions/setup-dotnet@v3
with: with:
dotnet-version: '9.x' dotnet-version: '8.x'
dotnet-quality: 'preview'
- name: Install dotnet tools - name: Install dotnet tools
run: | run: |
@@ -136,8 +134,7 @@ jobs:
- name: Setup .NET SDK - name: Setup .NET SDK
uses: actions/setup-dotnet@v3 uses: actions/setup-dotnet@v3
with: with:
dotnet-version: '9.x' dotnet-version: '8.x'
dotnet-quality: 'preview'
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v3 uses: github/codeql-action/init@v3
@@ -153,6 +150,7 @@ jobs:
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3 uses: github/codeql-action/analyze@v3
# converting SARIF action not working yet.
#SecurityCodeScan: #SecurityCodeScan:
# runs-on: windows-latest # runs-on: windows-latest
# steps: # steps:
@@ -171,7 +169,7 @@ jobs:
# uses: actions/setup-dotnet@v3 # uses: actions/setup-dotnet@v3
# with: # with:
# dotnet-version: | # dotnet-version: |
# 9.x # 8.x
# 3.1.x # 3.1.x
# dotnet-quality: 'preview' # dotnet-quality: 'preview'
# #
@@ -229,8 +227,7 @@ jobs:
- name: Setup .NET SDK - name: Setup .NET SDK
uses: actions/setup-dotnet@v3 uses: actions/setup-dotnet@v3
with: with:
dotnet-version: '9.x' dotnet-version: '8.x'
dotnet-quality: 'preview'
- name: Install GitVersion - name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0 uses: gittools/actions/gitversion/setup@v0
+1 -1
View File
@@ -33,7 +33,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Using Include="Xunit" /> <PackageReference Include="xunit" Version="2.4.1" />
<ProjectReference Include="..\lib\quantalib.csproj" /> <ProjectReference Include="..\lib\quantalib.csproj" />
</ItemGroup> </ItemGroup>
+2
View File
@@ -1,3 +1,5 @@
using Xunit;
namespace QuanTAlib; namespace QuanTAlib;
public class EventingTests public class EventingTests
+4 -5
View File
@@ -289,7 +289,6 @@ public class SkenderTests
{ {
for (int run = 0; run < iterations; run++) for (int run = 0; run < iterations; run++)
{ {
//period = rnd.Next(50) + 5;
Mama ma = new(fastLimit: 0.5, slowLimit: 0.05); Mama ma = new(fastLimit: 0.5, slowLimit: 0.05);
TSeries QL = new(); TSeries QL = new();
foreach (TBar item in feed) foreach (TBar item in feed)
@@ -336,12 +335,12 @@ public class SkenderTests
TSeries QL = new(); TSeries QL = new();
foreach (TBar item in bars) { QL.Add(ma.Calc(item)); } foreach (TBar item in bars) { QL.Add(ma.Calc(item)); }
var SK = quotes.GetAtr(lookbackPeriods: period).Select(i => i.Atr.Null2NaN()!); var atrValues = quotes.GetAtr(lookbackPeriods: period).Select(i => i.Atr.Null2NaN()!);
Assert.Equal(QL.Length, QL.Length); const int AdditionalPeriods = 500;
for (int i = QL.Length - 1; i > period + 500; i--) for (int i = QL.Length - 1; i > period + AdditionalPeriods; i--)
{ {
Assert.InRange(SK.ElementAt(i) - QL[i].Value, -range, range); Assert.InRange(atrValues.ElementAt(i) - QL[i].Value, -range, range);
} }
} }
} }
+11 -12
View File
@@ -39,17 +39,16 @@ public class Rma : AbstractBase
protected override void ManageState(bool isNew) protected override void ManageState(bool isNew)
{ {
if (isNew) if (!isNew)
{ {
_lastRMA = _savedLastRMA;
return;
}
_savedLastRMA = _lastRMA; _savedLastRMA = _lastRMA;
_lastValidValue = Input.Value; _lastValidValue = Input.Value;
_index++; _index++;
} }
else
{
_lastRMA = _savedLastRMA;
}
}
protected override double Calculation() protected override double Calculation()
{ {
@@ -59,17 +58,17 @@ public class Rma : AbstractBase
if (_index == 1) if (_index == 1)
{ {
rma = Input.Value; return Input.Value;
} }
else if (_index <= _period)
if (_index <= _period)
{ {
// Simple average during initial period // Simple average during initial period
rma = (_lastRMA * (_index - 1) + Input.Value) / _index; return (_lastRMA * (_index - 1) + Input.Value) / _index;
} }
else
{
// Wilder's smoothing method // Wilder's smoothing method
rma = _alpha * (Input.Value - _lastRMA) + _lastRMA; return _alpha * (Input.Value - _lastRMA) + _lastRMA;
} }
_lastRMA = rma; _lastRMA = rma;