mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-25 22:08:05 +00:00
benchmarks
This commit is contained in:
+7
-2
@@ -1,4 +1,4 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.0.31903.59
|
VisualStudioVersion = 17.0.31903.59
|
||||||
@@ -15,6 +15,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "quantower", "quantower", "{
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Statistics", "quantower\Statistics\Statistics.csproj", "{B6D3EB11-63B6-430F-B526-E1981B3D8214}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Statistics", "quantower\Statistics\Statistics.csproj", "{B6D3EB11-63B6-430F-B526-E1981B3D8214}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "benchmark", "benchmark\benchmark.csproj", "{6629C6D2-FC34-4BDF-AEF4-A5859E05981E}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -44,9 +46,12 @@ Global
|
|||||||
{B6D3EB11-63B6-430F-B526-E1981B3D8214}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{B6D3EB11-63B6-430F-B526-E1981B3D8214}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{B6D3EB11-63B6-430F-B526-E1981B3D8214}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{B6D3EB11-63B6-430F-B526-E1981B3D8214}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{B6D3EB11-63B6-430F-B526-E1981B3D8214}.Release|Any CPU.Build.0 = Release|Any CPU
|
{B6D3EB11-63B6-430F-B526-E1981B3D8214}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{6629C6D2-FC34-4BDF-AEF4-A5859E05981E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{6629C6D2-FC34-4BDF-AEF4-A5859E05981E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{6629C6D2-FC34-4BDF-AEF4-A5859E05981E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{6629C6D2-FC34-4BDF-AEF4-A5859E05981E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{B6D3EB11-63B6-430F-B526-E1981B3D8214} = {A8D9AE68-24E3-476C-BB98-244541BB4B43}
|
{B6D3EB11-63B6-430F-B526-E1981B3D8214} = {A8D9AE68-24E3-476C-BB98-244541BB4B43}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<LangVersion>latest</LangVersion>
|
||||||
|
<GenerateProgramFile>false</GenerateProgramFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="BenchmarkDotNet" Version="0.13.5" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\lib\quantalib.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
using BenchmarkDotNet.Attributes;
|
||||||
|
using BenchmarkDotNet.Configs;
|
||||||
|
using BenchmarkDotNet.Jobs;
|
||||||
|
using BenchmarkDotNet.Running;
|
||||||
|
|
||||||
|
namespace QuanTAlib;
|
||||||
|
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var config = DefaultConfig.Instance
|
||||||
|
.WithOption(ConfigOptions.DisableOptimizationsValidator, true);
|
||||||
|
BenchmarkRunner.Run<EmaBenchmark>(config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[MemoryDiagnoser]
|
||||||
|
[SimpleJob(RuntimeMoniker.Net80, launchCount: 1, warmupCount: 3, iterationCount: 5)]
|
||||||
|
public class EmaBenchmark
|
||||||
|
{
|
||||||
|
private const int Period = 10;
|
||||||
|
private const int Length = 100_000;
|
||||||
|
private GbmFeed gbm = null!;
|
||||||
|
private TSeries inputs = null!;
|
||||||
|
|
||||||
|
[GlobalSetup]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
gbm = new GbmFeed();
|
||||||
|
inputs = new();
|
||||||
|
|
||||||
|
for (int i = 0; i < Length; i++)
|
||||||
|
{
|
||||||
|
TBar item = gbm.Generate(DateTime.Now);
|
||||||
|
inputs.Add(new TValue(item.Time, item.Close, true, true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Benchmark]
|
||||||
|
public void Afirma_bench()
|
||||||
|
{
|
||||||
|
Afirma ma1 = new(Period);
|
||||||
|
for (int i = 0; i < Length; i++)
|
||||||
|
{
|
||||||
|
TValue item = gbm.Generate(DateTime.Now).Close;
|
||||||
|
ma1.Calc(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Benchmark]
|
||||||
|
public void Alma_bench()
|
||||||
|
{
|
||||||
|
Alma ma1 = new(Period);
|
||||||
|
for (int i = 0; i < Length; i++)
|
||||||
|
{
|
||||||
|
TValue item = gbm.Generate(DateTime.Now).Close;
|
||||||
|
ma1.Calc(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Benchmark]
|
||||||
|
public void Dema_bench()
|
||||||
|
{
|
||||||
|
Dema ma1 = new(Period);
|
||||||
|
for (int i = 0; i < Length; i++)
|
||||||
|
{
|
||||||
|
TValue item = gbm.Generate(DateTime.Now).Close;
|
||||||
|
ma1.Calc(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Benchmark]
|
||||||
|
public void Ema_bench()
|
||||||
|
{
|
||||||
|
Ema ma1 = new(Period);
|
||||||
|
for (int i = 0; i < Length; i++)
|
||||||
|
{
|
||||||
|
TValue item = gbm.Generate(DateTime.Now).Close;
|
||||||
|
ma1.Calc(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
|HLCC4 - Weighted Price|`️.HLCC4`||`WclPrice`||
|
|HLCC4 - Weighted Price|`️.HLCC4`||`WclPrice`||
|
||||||
|<br>||||
|
|<br>||||
|
||||||
|**AVERAGES & TRENDS**|**QuanTALib**|Skender.Stock|TALib.NETCore|Tulip.NETCore|Trady|
|
|**AVERAGES & TRENDS**|**QuanTALib**|Skender.Stock|TALib.NETCore|Tulip.NETCore|Trady|
|
||||||
|AFIRMA - Autoregressive Finite Impulse Response Moving Average|`✔️`||||
|
|AFIRMA - Autoregressive Finite Impulse Response Moving Average|`Afirma`||||
|
||||||
|ALMA - Arnaud Legoux Moving Average|`Alma`|`✔️`|||
|
|ALMA - Arnaud Legoux Moving Average|`Alma`|`✔️`|||
|
||||||
|⭐DEMA - Double EMA Average|`Dema`|`⭐`|`⭐`|`⭐`||
|
|⭐DEMA - Double EMA Average|`Dema`|`⭐`|`⭐`|`⭐`||
|
||||||
|DSMA - Deviation Scaled Moving Average|`Dsma`||||
|
|DSMA - Deviation Scaled Moving Average|`Dsma`||||
|
||||||
|
|||||||
Reference in New Issue
Block a user