mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-20 03:28:05 +00:00
feat: Introduce ITValuePublisher interface and refactor indicators for event-driven value updates.
This commit is contained in:
@@ -153,6 +153,19 @@ public class IndicatorBenchmarks
|
||||
}
|
||||
}
|
||||
|
||||
[BenchmarkCategory("SMA")]
|
||||
[Benchmark(Description = "QuanTAlib SMA (Eventing)")]
|
||||
public void QuanTAlib_Sma_Eventing()
|
||||
{
|
||||
var source = new TSeries();
|
||||
var sma = new Sma(source, Period);
|
||||
for (int i = 0; i < _closeValues.Length; i++)
|
||||
{
|
||||
source.Add(new TValue(_closeTseries.Times[i], _closeValues[i]));
|
||||
_quantalibOutput[i] = sma.Last.Value;
|
||||
}
|
||||
}
|
||||
|
||||
[BenchmarkCategory("SMA")]
|
||||
[Benchmark(Description = "Tulip SMA")]
|
||||
public void Tulip_Sma() => Tulip.Indicators.sma.Run(_tulipSmaInputs, _tulipSmaOptions, _tulipSmaOutputs);
|
||||
@@ -193,6 +206,19 @@ public class IndicatorBenchmarks
|
||||
}
|
||||
}
|
||||
|
||||
[BenchmarkCategory("EMA")]
|
||||
[Benchmark(Description = "QuanTAlib EMA (Eventing)")]
|
||||
public void QuanTAlib_Ema_Eventing()
|
||||
{
|
||||
var source = new TSeries();
|
||||
var ema = new Ema(source, Period);
|
||||
for (int i = 0; i < _closeValues.Length; i++)
|
||||
{
|
||||
source.Add(new TValue(_closeTseries.Times[i], _closeValues[i]));
|
||||
_quantalibOutput[i] = ema.Last.Value;
|
||||
}
|
||||
}
|
||||
|
||||
[BenchmarkCategory("EMA")]
|
||||
[Benchmark(Description = "Tulip EMA")]
|
||||
public void Tulip_Ema() => Tulip.Indicators.ema.Run(_tulipEmaInputs, _tulipEmaOptions, _tulipEmaOutputs);
|
||||
@@ -233,6 +259,19 @@ public class IndicatorBenchmarks
|
||||
}
|
||||
}
|
||||
|
||||
[BenchmarkCategory("WMA")]
|
||||
[Benchmark(Description = "QuanTAlib WMA (Eventing)")]
|
||||
public void QuanTAlib_Wma_Eventing()
|
||||
{
|
||||
var source = new TSeries();
|
||||
var wma = new Wma(source, Period);
|
||||
for (int i = 0; i < _closeValues.Length; i++)
|
||||
{
|
||||
source.Add(new TValue(_closeTseries.Times[i], _closeValues[i]));
|
||||
_quantalibOutput[i] = wma.Last.Value;
|
||||
}
|
||||
}
|
||||
|
||||
[BenchmarkCategory("WMA")]
|
||||
[Benchmark(Description = "Tulip WMA")]
|
||||
public void Tulip_Wma() => Tulip.Indicators.wma.Run(_tulipWmaInputs, _tulipWmaOptions, _tulipWmaOutputs);
|
||||
@@ -273,6 +312,19 @@ public class IndicatorBenchmarks
|
||||
}
|
||||
}
|
||||
|
||||
[BenchmarkCategory("TRIMA")]
|
||||
[Benchmark(Description = "QuanTAlib TRIMA (Eventing)")]
|
||||
public void QuanTAlib_Trima_Eventing()
|
||||
{
|
||||
var source = new TSeries();
|
||||
var trima = new Trima(source, Period);
|
||||
for (int i = 0; i < _closeValues.Length; i++)
|
||||
{
|
||||
source.Add(new TValue(_closeTseries.Times[i], _closeValues[i]));
|
||||
_quantalibOutput[i] = trima.Last.Value;
|
||||
}
|
||||
}
|
||||
|
||||
[BenchmarkCategory("TRIMA")]
|
||||
[Benchmark(Description = "Tulip TRIMA")]
|
||||
public void Tulip_Trima() => Tulip.Indicators.trima.Run(_tulipTrimaInputs, _tulipTrimaOptions, _tulipTrimaOutputs);
|
||||
@@ -301,6 +353,19 @@ public class IndicatorBenchmarks
|
||||
}
|
||||
}
|
||||
|
||||
[BenchmarkCategory("DEMA")]
|
||||
[Benchmark(Description = "QuanTAlib DEMA (Eventing)")]
|
||||
public void QuanTAlib_Dema_Eventing()
|
||||
{
|
||||
var source = new TSeries();
|
||||
var dema = new Dema(source, Period);
|
||||
for (int i = 0; i < _closeValues.Length; i++)
|
||||
{
|
||||
source.Add(new TValue(_closeTseries.Times[i], _closeValues[i]));
|
||||
_quantalibOutput[i] = dema.Last.Value;
|
||||
}
|
||||
}
|
||||
|
||||
[BenchmarkCategory("DEMA")]
|
||||
[Benchmark(Description = "Tulip DEMA")]
|
||||
public void Tulip_Dema() => Tulip.Indicators.dema.Run(_tulipDemaInputs, _tulipDemaOptions, _tulipDemaOutputs);
|
||||
@@ -341,6 +406,19 @@ public class IndicatorBenchmarks
|
||||
}
|
||||
}
|
||||
|
||||
[BenchmarkCategory("TEMA")]
|
||||
[Benchmark(Description = "QuanTAlib TEMA (Eventing)")]
|
||||
public void QuanTAlib_Tema_Eventing()
|
||||
{
|
||||
var source = new TSeries();
|
||||
var tema = new Tema(source, Period);
|
||||
for (int i = 0; i < _closeValues.Length; i++)
|
||||
{
|
||||
source.Add(new TValue(_closeTseries.Times[i], _closeValues[i]));
|
||||
_quantalibOutput[i] = tema.Last.Value;
|
||||
}
|
||||
}
|
||||
|
||||
[BenchmarkCategory("TEMA")]
|
||||
[Benchmark(Description = "Tulip TEMA")]
|
||||
public void Tulip_Tema() => Tulip.Indicators.tema.Run(_tulipTemaInputs, _tulipTemaOptions, _tulipTemaOutputs);
|
||||
|
||||
Reference in New Issue
Block a user