mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-26 06:18:05 +00:00
Pandas-TA test engine update to Python 3.11.1
This commit is contained in:
@@ -52,21 +52,21 @@ jobs:
|
|||||||
/d:sonar.cs.dotcover.reportsPaths=./coveragereport.html
|
/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 minimal --configuration Release --nologo
|
||||||
- name: Build Quantower DLL
|
- 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
|
- name: dotnet Test
|
||||||
if: ${{ github.ref == 'refs/heads/dev' }}
|
#if: ${{ github.ref == 'refs/heads/dev' }}
|
||||||
run: dotnet test ./Tests/Tests.csproj --verbosity normal --configuration Release --nologo
|
run: dotnet test ./Tests/Tests.csproj --verbosity minimal --framework net7.0 --configuration Release --nologo
|
||||||
- name: DotCover Test XML
|
- name: DotCover Test XML
|
||||||
if: ${{ github.ref == 'refs/heads/dev' }}
|
#if: ${{ github.ref == 'refs/heads/dev' }}
|
||||||
run: dotnet dotcover test ./Tests/Tests.csproj --verbosity normal --framework net7.0 --dcReportType=DetailedXML --dcoutput=./coveragereport.xml
|
run: dotnet dotcover test ./Tests/Tests.csproj --verbosity minimal --framework net7.0 --dcReportType=DetailedXML --dcoutput=./coveragereport.xml
|
||||||
- name: DotCover Test HTML
|
- name: DotCover Test HTML
|
||||||
if: ${{ github.ref == 'refs/heads/dev' }}
|
#if: ${{ github.ref == 'refs/heads/dev' }}
|
||||||
run: dotnet dotcover test ./Tests/Tests.csproj --verbosity normal --framework net7.0 --dcReportType=HTML --dcoutput=./coveragereport.html
|
run: dotnet dotcover test ./Tests/Tests.csproj --verbosity minimal --framework net7.0 --dcReportType=HTML --dcoutput=./coveragereport.html
|
||||||
# - name: dotnet-coverage
|
- name: dotnet-coverage
|
||||||
# run: dotnet-coverage collect 'dotnet test' -f xml -o './coverage.xml'
|
run: dotnet-coverage collect 'dotnet test' -f xml -o './coverage.xml'
|
||||||
|
|
||||||
- name: Sonar reporter
|
- name: Sonar reporter
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -11,30 +11,30 @@ public class PandasTA : IDisposable
|
|||||||
private readonly Random rnd = new();
|
private readonly Random rnd = new();
|
||||||
private readonly int period, sample;
|
private readonly int period, sample;
|
||||||
private int digits;
|
private int digits;
|
||||||
private readonly string OStype;
|
private readonly string dllpath;
|
||||||
private readonly dynamic np;
|
private readonly dynamic np;
|
||||||
private readonly dynamic ta;
|
private readonly dynamic ta;
|
||||||
|
private readonly dynamic pd;
|
||||||
private readonly dynamic df;
|
private readonly dynamic df;
|
||||||
|
|
||||||
public PandasTA() {
|
public PandasTA() {
|
||||||
bars = new(Bars: 5000, Volatility: 0.8, Drift: 0.0);
|
bars = new(Bars: 5000, Volatility: 0.8, Drift: 0.0);
|
||||||
period = rnd.Next(maxValue: 28) + 3;
|
period = rnd.Next(maxValue: 28) + 3;
|
||||||
sample = period+1;
|
sample = period+1;
|
||||||
digits = 10;
|
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";
|
|
||||||
|
|
||||||
Installer.InstallPath = Path.GetFullPath(path: ".");
|
Installer.InstallPath = Path.GetFullPath(path: ".");
|
||||||
Installer.SetupPython().Wait();
|
Installer.SetupPython().Wait();
|
||||||
Installer.TryInstallPip();
|
Installer.TryInstallPip().Wait();
|
||||||
Installer.PipInstallModule(module_name: "pandas-ta");
|
Installer.PipInstallModule(module_name: "numpy").Wait();
|
||||||
Runtime.PythonDLL = OStype;
|
Installer.PipInstallModule(module_name: "pandas").Wait();
|
||||||
PythonEngine.Initialize();
|
Installer.PipInstallModule(module_name: "pandas-ta").Wait();
|
||||||
np = Py.Import(name: "numpy");
|
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");
|
ta = Py.Import(name: "pandas_ta");
|
||||||
|
|
||||||
string[] cols = { "open", "high", "low", "close", "volume" };
|
string[] cols = { "open", "high", "low", "close", "volume" };
|
||||||
@@ -51,7 +51,7 @@ public class PandasTA : IDisposable
|
|||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
PythonEngine.Shutdown();
|
PythonEngine.Shutdown();
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact] void ADL() {
|
[Fact] void ADL() {
|
||||||
@@ -65,6 +65,7 @@ public class PandasTA : IDisposable
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
[Fact] void ADOSC() {
|
[Fact] void ADOSC() {
|
||||||
ADOSC_Series QL = new(bars);
|
ADOSC_Series QL = new(bars);
|
||||||
var pta = df.ta.adosc(high: df.high, low: df.low, close: df.close, volume: df.volume);
|
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));
|
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() {
|
[Fact] void BIAS() {
|
||||||
BIAS_Series QL = new(bars.Close, period, false);
|
BIAS_Series QL = new(bars.Close, period, false);
|
||||||
var pta = df.ta.bias(close: df.close, length: period);
|
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));
|
Assert.InRange(PanTA_item! - QL_item, -Math.Exp(-digits), Math.Exp(-digits));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
[Fact]
|
[Fact]
|
||||||
void CMO() {
|
void CMO() {
|
||||||
CMO_Series QL = new(bars.Close, period, false);
|
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));
|
Assert.InRange(PanTA_item! - QL_item, -Math.Exp(-digits), Math.Exp(-digits));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
[Fact] void DEMA() {
|
[Fact] void DEMA() {
|
||||||
DEMA_Series QL = new(bars.Close, period, false);
|
DEMA_Series QL = new(bars.Close, period, false);
|
||||||
var pta = df.ta.dema(close: df.close, length: period);
|
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));
|
Assert.InRange(PanTA_item! - QL_item, -Math.Exp(-digits), Math.Exp(-digits));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
+1
-1
@@ -96,7 +96,7 @@
|
|||||||
|⭐ATR - Average True Range|`ATR_Series`|✔️ATR|✔️GetAtr|✔️atr|✔️atr|
|
|⭐ATR - Average True Range|`ATR_Series`|✔️ATR|✔️GetAtr|✔️atr|✔️atr|
|
||||||
|ATRP - Average True Range Percent|`ATRP_Series`||✔️GetAtr||
|
|ATRP - Average True Range Percent|`ATRP_Series`||✔️GetAtr||
|
||||||
|BETA - Beta coefficient||BETA|GetBeta||
|
|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||
|
|CHAND - Chandelier Exit|||GetChandelier||
|
||||||
|CRSI - Connor RSI|||GetConnorsRsi||
|
|CRSI - Connor RSI|||GetConnorsRsi||
|
||||||
|CVI - Chaikins Volatility|||||cvi|
|
|CVI - Chaikins Volatility|||||cvi|
|
||||||
|
|||||||
Reference in New Issue
Block a user