mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-15 09:08:04 +00:00
refactor: Simplify TSeries and Dema constructors, and streamline benchmark methods for improved readability
This commit is contained in:
@@ -120,7 +120,7 @@ public sealed class Dema : ITValuePublisher
|
||||
|
||||
public TSeries Update(TSeries source)
|
||||
{
|
||||
if (source.Count == 0) return new TSeries(new List<long>(), new List<double>());
|
||||
if (source.Count == 0) return new TSeries();
|
||||
|
||||
int len = source.Count;
|
||||
var t = new List<long>(len);
|
||||
|
||||
@@ -149,7 +149,7 @@ public sealed class Ema : ITValuePublisher
|
||||
|
||||
public TSeries Update(TSeries source)
|
||||
{
|
||||
if (source.Count == 0) return new TSeries(new List<long>(), new List<double>());
|
||||
if (source.Count == 0) return new TSeries();
|
||||
|
||||
int len = source.Count;
|
||||
var t = new List<long>(len);
|
||||
@@ -291,7 +291,7 @@ public sealed class Ema : ITValuePublisher
|
||||
|
||||
if (source.Length == 0) return;
|
||||
|
||||
State state = State.New();
|
||||
var state = State.New();
|
||||
double lastValid = 0;
|
||||
|
||||
CalculateCore(source, output, alpha, ref state, ref lastValid);
|
||||
|
||||
@@ -137,7 +137,7 @@ public sealed class Sma : ITValuePublisher
|
||||
|
||||
public TSeries Update(TSeries source)
|
||||
{
|
||||
if (source.Count == 0) return new TSeries(new List<long>(), new List<double>());
|
||||
if (source.Count == 0) return new TSeries();
|
||||
|
||||
int len = source.Count;
|
||||
var t = new List<long>(len);
|
||||
|
||||
@@ -129,7 +129,7 @@ public sealed class Tema : ITValuePublisher
|
||||
|
||||
public TSeries Update(TSeries source)
|
||||
{
|
||||
if (source.Count == 0) return new TSeries(new List<long>(), new List<double>());
|
||||
if (source.Count == 0) return new TSeries();
|
||||
|
||||
int len = source.Count;
|
||||
var t = new List<long>(len);
|
||||
|
||||
@@ -141,7 +141,7 @@ public sealed class Trima : ITValuePublisher
|
||||
|
||||
public TSeries Update(TSeries source)
|
||||
{
|
||||
if (source.Count == 0) return new TSeries(new List<long>(), new List<double>());
|
||||
if (source.Count == 0) return new TSeries();
|
||||
|
||||
int len = source.Count;
|
||||
var t = new List<long>(len);
|
||||
|
||||
@@ -141,7 +141,7 @@ public sealed class Wma : ITValuePublisher
|
||||
|
||||
public TSeries Update(TSeries source)
|
||||
{
|
||||
if (source.Count == 0) return new TSeries(new List<long>(), new List<double>());
|
||||
if (source.Count == 0) return new TSeries();
|
||||
|
||||
int len = source.Count;
|
||||
var t = new List<long>(len);
|
||||
|
||||
Reference in New Issue
Block a user