mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-25 05:48:06 +00:00
coverage fix
This commit is contained in:
@@ -41,7 +41,11 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
run: dotnet sonarscanner begin /o:"mihakralj" /k:"mihakralj_QuanTAlib" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths="Tests/coverage.xml"
|
#run: dotnet sonarscanner begin /o:"mihakralj" /k:"mihakralj_QuanTAlib" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths="./coverage.xml"
|
||||||
|
run: dotnet sonarscanner begin /o:"mihakralj" /k:"mihakralj_QuanTAlib"
|
||||||
|
/d:sonar.login="${{ secrets.SONAR_TOKEN }}"
|
||||||
|
/d:sonar.host.url="https://sonarcloud.io"
|
||||||
|
/d:sonar.cs.dotcover.reportsPaths=./coveragereport.html
|
||||||
|
|
||||||
- name: Build Core DLL
|
- name: Build Core DLL
|
||||||
run: dotnet build ./Source/QuanTAlib.csproj --verbosity normal --configuration Release --nologo
|
run: dotnet build ./Source/QuanTAlib.csproj --verbosity normal --configuration Release --nologo
|
||||||
@@ -50,10 +54,12 @@ jobs:
|
|||||||
|
|
||||||
- name: dotnet Test
|
- name: dotnet Test
|
||||||
run: dotnet test ./Tests/Tests.csproj --verbosity normal --configuration Release --nologo
|
run: dotnet test ./Tests/Tests.csproj --verbosity normal --configuration Release --nologo
|
||||||
- name: DotCover Test
|
- name: DotCover Test XML
|
||||||
run: dotnet dotcover test ./Tests/Tests.csproj --verbosity normal --framework net7.0 --dcReportType=DetailedXML --dcoutput=Tests/coveragereport.xml
|
run: dotnet dotcover test ./Tests/Tests.csproj --verbosity normal --framework net7.0 --dcReportType=DetailedXML --dcoutput=./coveragereport.xml
|
||||||
- name: dotnet-coverage
|
- name: DotCover Test HTML
|
||||||
run: dotnet-coverage collect 'dotnet test' -f xml -o 'Tests/coverage.xml'
|
run: dotnet dotcover test ./Tests/Tests.csproj --verbosity normal --framework net7.0 --dcReportType=HTML --dcoutput=./coveragereport.html
|
||||||
|
# - name: dotnet-coverage
|
||||||
|
# run: dotnet-coverage collect 'dotnet test' -f xml -o './coverage.xml'
|
||||||
|
|
||||||
- name: Sonar reporter
|
- name: Sonar reporter
|
||||||
env:
|
env:
|
||||||
@@ -62,38 +68,38 @@ jobs:
|
|||||||
run: dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
|
run: dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
|
||||||
|
|
||||||
- name: CodeCov run
|
- name: CodeCov run
|
||||||
run: codecov -f ./Tests/coveragereport.xml -v -t ${{ secrets.CODECOV_TOKEN }}
|
run: codecov -f ./coveragereport.xml -v -t ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
||||||
- name: Codacy coverage reporter
|
- name: Codacy coverage reporter
|
||||||
uses: codacy/codacy-coverage-reporter-action@v1
|
uses: codacy/codacy-coverage-reporter-action@v1
|
||||||
with:
|
with:
|
||||||
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
||||||
coverage-reports: ./Tests/coveragereport.xml
|
coverage-reports: ./coveragereport.xml
|
||||||
|
|
||||||
- name: Zip DLLs
|
# - name: Zip DLLs
|
||||||
uses: thedoctor0/zip-release@master
|
# uses: thedoctor0/zip-release@master
|
||||||
with:
|
# with:
|
||||||
type: 'zip'
|
# type: 'zip'
|
||||||
directory: \Quantower\Settings\Scripts\Indicators\QuanTAlib
|
# directory: \Quantower\Settings\Scripts\Indicators\QuanTAlib
|
||||||
filename: QL_Quantower.zip
|
# filename: QL_Quantower.zip
|
||||||
|
|
||||||
- name: Release
|
# - name: Release
|
||||||
uses: marvinpinto/action-automatic-releases@latest
|
# uses: marvinpinto/action-automatic-releases@latest
|
||||||
with:
|
# with:
|
||||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
# repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
automatic_release_tag: "latest"
|
# automatic_release_tag: "latest"
|
||||||
prerelease: true
|
# prerelease: true
|
||||||
title: "Pre-release Build"
|
# title: "Pre-release Build"
|
||||||
files: /Quantower/Settings/Scripts/Indicators/QuanTAlib/*.zip
|
# files: /Quantower/Settings/Scripts/Indicators/QuanTAlib/*.zip
|
||||||
|
|
||||||
- name: Push package to nuget.org
|
# - name: Push package to nuget.org
|
||||||
run: dotnet nuget push '.\Source\bin\Release\QuanTAlib.*.nupkg'
|
# run: dotnet nuget push '.\Source\bin\Release\QuanTAlib.*.nupkg'
|
||||||
--api-key ${{ secrets.NUGET_DEPLOY_KEY_QUANTLIB }}
|
# --api-key ${{ secrets.NUGET_DEPLOY_KEY_QUANTLIB }}
|
||||||
--source https://api.nuget.org/v3/index.json
|
# --source https://api.nuget.org/v3/index.json
|
||||||
--skip-duplicate
|
# --skip-duplicate
|
||||||
|
|
||||||
- name: Push package to github
|
# - name: Push package to github
|
||||||
run: dotnet nuget push '.\Source\bin\Release\QuanTAlib.*.nupkg'
|
# run: dotnet nuget push '.\Source\bin\Release\QuanTAlib.*.nupkg'
|
||||||
--api-key ${{ secrets.GITHUB_TOKEN }}
|
# --api-key ${{ secrets.GITHUB_TOKEN }}
|
||||||
--source https://nuget.pkg.github.com/mihakralj/index.json
|
# --source https://nuget.pkg.github.com/mihakralj/index.json
|
||||||
--skip-duplicate
|
# --skip-duplicate
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
VisualStudioVersion = 17.2.32210.308
|
VisualStudioVersion = 17.2.32210.308
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{5096AEA1-81BC-46E7-9F2B-B408AFAA850C} = {5096AEA1-81BC-46E7-9F2B-B408AFAA850C}
|
||||||
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QuanTAlib", "Source\QuanTAlib.csproj", "{AAE21F8A-9BC2-4647-A9EB-4DC86C569080}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QuanTAlib", "Source\QuanTAlib.csproj", "{AAE21F8A-9BC2-4647-A9EB-4DC86C569080}"
|
||||||
EndProject
|
EndProject
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,5 @@
|
|||||||
namespace QuanTAlib;
|
namespace QuanTAlib;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
/* <summary>
|
/* <summary>
|
||||||
TSeries is the cornerstone of all QuanTAlib classess.
|
TSeries is the cornerstone of all QuanTAlib classess.
|
||||||
@@ -10,7 +9,6 @@ TSeries is the cornerstone of all QuanTAlib classess.
|
|||||||
|
|
||||||
- includes Length property (to mimic array's method)
|
- includes Length property (to mimic array's method)
|
||||||
- includes publishing and subscribing methods that attach to events
|
- includes publishing and subscribing methods that attach to events
|
||||||
- uses Linq only for two transmutations - needs to be refactored out eventually (for speed)
|
|
||||||
|
|
||||||
</summary> */
|
</summary> */
|
||||||
public class TSeries : System.Collections.Generic.List<(DateTime t, double v)>
|
public class TSeries : System.Collections.Generic.List<(DateTime t, double v)>
|
||||||
@@ -24,11 +22,21 @@ public class TSeries : System.Collections.Generic.List<(DateTime t, double v)>
|
|||||||
// when asked for a (DateTime), return the DateTime part of the last tuple on the list
|
// when asked for a (DateTime), return the DateTime part of the last tuple on the list
|
||||||
public static implicit operator DateTime(TSeries l) => l[l.Count - 1].t;
|
public static implicit operator DateTime(TSeries l) => l[l.Count - 1].t;
|
||||||
|
|
||||||
public System.Collections.Generic.List<DateTime> t =>
|
//convert from tuple List(t,v) to single List(DateTime)
|
||||||
this.Select(x => (DateTime)x.t).ToList();
|
public System.Collections.Generic.List<DateTime> t {
|
||||||
|
get { System.Collections.Generic.List<DateTime> TList = new();
|
||||||
|
for (int i = 0; i < this.Count; i++) { TList.Add(this[i].t); }
|
||||||
|
return TList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public System.Collections.Generic.List<double> v =>
|
//convert from tuple List(t,v) to single List(double)
|
||||||
this.Select(x => (double)x.v).ToList();
|
public System.Collections.Generic.List<double> v {
|
||||||
|
get { System.Collections.Generic.List<double> VList = new();
|
||||||
|
for (int i = 0; i < this.Count; i++) { VList.Add(this[i].v); }
|
||||||
|
return VList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int Length => this.Count;
|
public int Length => this.Count;
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ public class JMA_Series : Single_TSeries_Indicator
|
|||||||
private double prev_ma1, prev_det0, prev_det1, prev_jma, bsmax, bsmin;
|
private double prev_ma1, prev_det0, prev_det1, prev_jma, bsmax, bsmin;
|
||||||
private double o_prev_ma1, o_prev_det0, o_prev_det1, o_prev_jma, o_bsmax, o_bsmin;
|
private double o_prev_ma1, o_prev_det0, o_prev_det1, o_prev_jma, o_bsmax, o_bsmin;
|
||||||
|
|
||||||
private readonly double pr, pow1, len2, beta, rvolty;
|
private readonly double pr, pow1, len2, beta, rvolty, _l;
|
||||||
private readonly int _l;
|
|
||||||
|
|
||||||
public JMA_Series(TSeries source, int period, double phase = 0.0, bool useNaN = false) : base(source, period, useNaN)
|
public JMA_Series(TSeries source, int period, double phase = 0.0, bool useNaN = false) : base(source, period, useNaN)
|
||||||
{
|
{
|
||||||
@@ -47,11 +46,11 @@ public class JMA_Series : Single_TSeries_Indicator
|
|||||||
if (base._data.Count > 0) { base.Add(base._data); }
|
if (base._data.Count > 0) { base.Add(base._data); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Add((System.DateTime t, double v) d, bool update)
|
public override void Add((System.DateTime t, double v) TValue, bool update)
|
||||||
{
|
{
|
||||||
if (this.Count == 0)
|
if (this.Count == 0)
|
||||||
{
|
{
|
||||||
this.prev_ma1 = this.prev_jma = d.v;
|
this.prev_ma1 = this.prev_jma = TValue.v;
|
||||||
this.bsmax = this.bsmin = this.prev_det0 = this.prev_det1 = 0;
|
this.bsmax = this.bsmin = this.prev_det0 = this.prev_det1 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,8 +73,8 @@ public class JMA_Series : Single_TSeries_Indicator
|
|||||||
this.o_bsmin = this.bsmin;
|
this.o_bsmin = this.bsmin;
|
||||||
}
|
}
|
||||||
|
|
||||||
double hprice = d.v;
|
double hprice = TValue.v;
|
||||||
double lprice = d.v;
|
double lprice = TValue.v;
|
||||||
for (int i = 0; i <= Math.Min(9, this._data.Count - 1); i++)
|
for (int i = 0; i <= Math.Min(9, this._data.Count - 1); i++)
|
||||||
{
|
{
|
||||||
var _item = this._data[this._data.Count - 1 - i].v;
|
var _item = this._data[this._data.Count - 1 - i].v;
|
||||||
@@ -139,11 +138,11 @@ public class JMA_Series : Single_TSeries_Indicator
|
|||||||
double alpha = Math.Pow(this.beta, pow);
|
double alpha = Math.Pow(this.beta, pow);
|
||||||
|
|
||||||
// 1st stage - preliminary smoothing by adaptive EMA
|
// 1st stage - preliminary smoothing by adaptive EMA
|
||||||
double ma1 = d.v * (1 - alpha) + this.prev_ma1 * alpha;
|
double ma1 = TValue.v * (1 - alpha) + this.prev_ma1 * alpha;
|
||||||
this.prev_ma1 = ma1;
|
this.prev_ma1 = ma1;
|
||||||
|
|
||||||
// 2nd stage - one more preliminary smoothing by Kalman filter
|
// 2nd stage - one more preliminary smoothing by Kalman filter
|
||||||
double det0 = (d.v - ma1) * (1 - this.beta) + this.prev_det0 * this.beta;
|
double det0 = (TValue.v - ma1) * (1 - this.beta) + this.prev_det0 * this.beta;
|
||||||
this.prev_det0 = det0;
|
this.prev_det0 = det0;
|
||||||
double ma2 = ma1 + (this.pr * det0);
|
double ma2 = ma1 + (this.pr * det0);
|
||||||
|
|
||||||
@@ -155,7 +154,7 @@ public class JMA_Series : Single_TSeries_Indicator
|
|||||||
this.prev_jma = jma;
|
this.prev_jma = jma;
|
||||||
|
|
||||||
(System.DateTime t, double v) result =
|
(System.DateTime t, double v) result =
|
||||||
(d.t, (this.Count < this._p - 1 && this._NaN) ? double.NaN : jma);
|
(TValue.t, (this.Count < this._p - 1 && this._NaN) ? double.NaN : jma);
|
||||||
base.Add(result, update);
|
base.Add(result, update);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user