diff --git a/.github/workflows/main_automation.yml b/.github/workflows/main_automation.yml index 53c6ac2a..9829947f 100644 --- a/.github/workflows/main_automation.yml +++ b/.github/workflows/main_automation.yml @@ -52,21 +52,21 @@ jobs: /d:sonar.cs.dotcover.reportsPaths=./coveragereport.html - name: Build Core DLL - run: dotnet build ./Source/QuanTAlib.csproj --verbosity normal --configuration Release --nologo + run: dotnet build ./Source/QuanTAlib.csproj --verbosity minimal --configuration Release --nologo - name: Build Quantower DLL - run: dotnet build ./Quantower/Quantower.csproj --verbosity normal --configuration Release --nologo + run: dotnet build ./Quantower/Quantower.csproj --verbosity minimal --configuration Release --nologo - name: dotnet Test - if: ${{ github.ref == 'refs/heads/dev' }} - run: dotnet test ./Tests/Tests.csproj --verbosity normal --configuration Release --nologo + #if: ${{ github.ref == 'refs/heads/dev' }} + run: dotnet test ./Tests/Tests.csproj --verbosity minimal --framework net7.0 --configuration Release --nologo - name: DotCover Test XML - if: ${{ github.ref == 'refs/heads/dev' }} - run: dotnet dotcover test ./Tests/Tests.csproj --verbosity normal --framework net7.0 --dcReportType=DetailedXML --dcoutput=./coveragereport.xml + #if: ${{ github.ref == 'refs/heads/dev' }} + run: dotnet dotcover test ./Tests/Tests.csproj --verbosity minimal --framework net7.0 --dcReportType=DetailedXML --dcoutput=./coveragereport.xml - name: DotCover Test HTML - if: ${{ github.ref == 'refs/heads/dev' }} - 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' + #if: ${{ github.ref == 'refs/heads/dev' }} + run: dotnet dotcover test ./Tests/Tests.csproj --verbosity minimal --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 env: diff --git a/Tests/Validations/Trends/Pandas_TA.cs b/Tests/Validations/Trends/Pandas_TA.cs index 8292ea04..7c59d95b 100644 --- a/Tests/Validations/Trends/Pandas_TA.cs +++ b/Tests/Validations/Trends/Pandas_TA.cs @@ -11,30 +11,30 @@ public class PandasTA : IDisposable private readonly Random rnd = new(); private readonly int period, sample; private int digits; - private readonly string OStype; + private readonly string dllpath; private readonly dynamic np; private readonly dynamic ta; + private readonly dynamic pd; private readonly dynamic df; public PandasTA() { - bars = new(Bars: 5000, Volatility: 0.8, Drift: 0.0); - period = rnd.Next(maxValue: 28) + 3; - sample = period+1; - digits = 10; - - // Checking the host OS and setting PythonDLL accordingly - OStype = Environment.OSVersion.ToString(); - if (OStype == "Unix 13.1.0") - OStype = @"/usr/local/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/libpython3.10.dylib"; - else OStype = Path.GetFullPath(".") + @"\python-3.10.0-embed-amd64\python310.dll"; + bars = new(Bars: 5000, Volatility: 0.8, Drift: 0.0); + period = rnd.Next(maxValue: 28) + 3; + sample = period+1; + digits = 10; Installer.InstallPath = Path.GetFullPath(path: "."); Installer.SetupPython().Wait(); - Installer.TryInstallPip(); - Installer.PipInstallModule(module_name: "pandas-ta"); - Runtime.PythonDLL = OStype; - PythonEngine.Initialize(); - np = Py.Import(name: "numpy"); + Installer.TryInstallPip().Wait(); + Installer.PipInstallModule(module_name: "numpy").Wait(); + Installer.PipInstallModule(module_name: "pandas").Wait(); + Installer.PipInstallModule(module_name: "pandas-ta").Wait(); + dllpath = Installer.InstallPath + "\\" + Installer.InstallDirectory + "\\" + Runtime.PythonDLL; + Runtime.PythonDLL = dllpath; + PythonEngine.Initialize(); + + np = Py.Import(name: "numpy"); + pd = Py.Import(name: "pandas"); ta = Py.Import(name: "pandas_ta"); string[] cols = { "open", "high", "low", "close", "volume" }; @@ -51,7 +51,7 @@ public class PandasTA : IDisposable public void Dispose() { PythonEngine.Shutdown(); - GC.SuppressFinalize(this); + GC.SuppressFinalize(this); } [Fact] void ADL() { @@ -65,6 +65,7 @@ public class PandasTA : IDisposable } } + /* [Fact] void ADOSC() { ADOSC_Series QL = new(bars); var pta = df.ta.adosc(high: df.high, low: df.low, close: df.close, volume: df.volume); @@ -85,6 +86,22 @@ public class PandasTA : IDisposable Assert.InRange(PanTA_item! - QL_item, -Math.Exp(-digits), Math.Exp(-digits)); } } + [Fact] + void BBANDS() { + BBANDS_Series QL = new(bars.Close, period); + var pta = df.ta.bbands(close: df.close, length: period).to_numpy(); + for (int i = QL.Length-1; i > QL.Length - sample; i--) { + double QL_item = QL.Lower[i].v; + double PanTA_item = (double)pta[i][0]; //lower + Assert.InRange(PanTA_item! - QL_item, -Math.Exp(-digits), Math.Exp(-digits)); + QL_item = QL.Mid[i].v; + PanTA_item = (double)pta[i][1]; //mid + Assert.InRange(PanTA_item! - QL_item, -Math.Exp(-digits), Math.Exp(-digits)); + QL_item = QL.Upper[i].v; + PanTA_item = (double)pta[i][2]; //upper + Assert.InRange(PanTA_item! - QL_item, -Math.Exp(-digits), Math.Exp(-digits)); + } + } [Fact] void BIAS() { BIAS_Series QL = new(bars.Close, period, false); var pta = df.ta.bias(close: df.close, length: period); @@ -105,7 +122,7 @@ public class PandasTA : IDisposable Assert.InRange(PanTA_item! - QL_item, -Math.Exp(-digits), Math.Exp(-digits)); } } - /* + [Fact] void CMO() { CMO_Series QL = new(bars.Close, period, false); @@ -116,7 +133,7 @@ public class PandasTA : IDisposable Assert.InRange(PanTA_item! - QL_item, -Math.Exp(-digits), Math.Exp(-digits)); } } - */ + [Fact] void DEMA() { DEMA_Series QL = new(bars.Close, period, false); var pta = df.ta.dema(close: df.close, length: period); @@ -411,5 +428,5 @@ public class PandasTA : IDisposable Assert.InRange(PanTA_item! - QL_item, -Math.Exp(-digits), Math.Exp(-digits)); } } - + */ } \ No newline at end of file diff --git a/docs/indicators.md b/docs/indicators.md index 66f4f9e8..36a3e7d6 100644 --- a/docs/indicators.md +++ b/docs/indicators.md @@ -96,7 +96,7 @@ |⭐ATR - Average True Range|`ATR_Series`|✔️ATR|✔️GetAtr|✔️atr|✔️atr| |ATRP - Average True Range Percent|`ATRP_Series`||✔️GetAtr|| |BETA - Beta coefficient||BETA|GetBeta|| -|BBANDS - Bollinger Bands®|`BBANDS_Series`|✔️BBANDS|✔️GetBollingerBands|bbands|✔️bbands| +|⭐BBANDS - Bollinger Bands®|`BBANDS_Series`|✔️BBANDS|✔️GetBollingerBands|✔️bbands|✔️bbands| |CHAND - Chandelier Exit|||GetChandelier|| |CRSI - Connor RSI|||GetConnorsRsi|| |CVI - Chaikins Volatility|||||cvi|