Refactor TBar struct for improved equality comparison and string representation; update Benchmark program structure for better organization; modify Averages project file to include specific source files; add Directory.Build.props for common project settings; implement comprehensive tests for Ema, Sma, and Wma indicators; create mock classes for TradingPlatform.BusinessLayer to facilitate testing; enhance Quantower test project configuration for better test management.

This commit is contained in:
Miha Kralj
2025-12-01 18:40:23 -08:00
parent 626a2afa9b
commit 1d145d0622
12 changed files with 1098 additions and 114175 deletions
+2 -2
View File
@@ -67,8 +67,8 @@ public readonly struct TBar : IEquatable<TBar>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString() => $"[{AsDateTime:yyyy-MM-dd HH:mm:ss}: O={Open:F2}, H={High:F2}, L={Low:F2}, C={Close:F2}, V={Volume:F2}]";
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#pragma warning disable S1244 // Floating point equality is intentional for exact struct comparison
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(TBar other) =>
Time == other.Time &&
Open == other.Open &&
@@ -76,10 +76,10 @@ public readonly struct TBar : IEquatable<TBar>
Low == other.Low &&
Close == other.Close &&
Volume == other.Volume;
#pragma warning restore S1244
public override bool Equals(object? obj) => obj is TBar other && Equals(other);
public override int GetHashCode() => HashCode.Combine(Time, Open, High, Low, Close, Volume);
public static bool operator ==(TBar left, TBar right) => left.Equals(right);
public static bool operator !=(TBar left, TBar right) => !left.Equals(right);
#pragma warning restore S1244
}