From c7f2db5ad5081160636fd3582167a6756f02d1a1 Mon Sep 17 00:00:00 2001 From: John Date: Mon, 14 Jun 2021 22:32:17 +0100 Subject: [PATCH] Ignore Mac DS_Store (#598) * Update .gitignore Navigating to a folder using the "Finder" on Mac generates a .DS_Store file holding metadata about the folder (e.g. thumbnails etc.). These files can pollute your git commits and are annoying. * Update MovingAverageCalculator.cs Pull methods and expose accessors on base class for consistency. --- .gitignore | 5 +++- .../Traders/MovingAverageCalculator.cs | 25 +++++++++++-------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index b02e5462f..0a7060663 100644 --- a/.gitignore +++ b/.gitignore @@ -456,4 +456,7 @@ launchSettings.json **/keys.bin dist/ data/** -!data/.gitkeep \ No newline at end of file +!data/.gitkeep + +## Mac specific +.DS_Store diff --git a/src/ExchangeSharp/Traders/MovingAverageCalculator.cs b/src/ExchangeSharp/Traders/MovingAverageCalculator.cs index 02453adc3..1bf6e6bc2 100644 --- a/src/ExchangeSharp/Traders/MovingAverageCalculator.cs +++ b/src/ExchangeSharp/Traders/MovingAverageCalculator.cs @@ -30,6 +30,9 @@ public abstract class MovingAverageCalculatorBase protected T _previousMovingAverage; protected T _previousExponentialMovingAverage; + public int WindowSize => _windowSize; + + public T WeightingMultiplier => _weightingMultiplier; /// /// Current moving average /// @@ -58,6 +61,17 @@ public override string ToString() { return string.Format("{0}:{1}, {2}:{3}", MovingAverage, Slope, ExponentialMovingAverage, ExponentialSlope); } + + /// + /// Gets a value indicating whether enough values have been provided to fill the + /// specified window size. Values returned from NextValue may still be used prior + /// to IsMature returning true, however such values are not subject to the intended + /// smoothing effect of the moving average's window size. + /// + public bool IsMature + { + get { return _valuesIn == _windowSize; } + } } /// @@ -126,17 +140,6 @@ public void NextValue(double nextValue) } } - /// - /// Gets a value indicating whether enough values have been provided to fill the - /// specified window size. Values returned from NextValue may still be used prior - /// to IsMature returning true, however such values are not subject to the intended - /// smoothing effect of the moving average's window size. - /// - public bool IsMature - { - get { return _valuesIn == _windowSize; } - } - /// /// Clears any accumulated state and resets the calculator to its initial configuration. /// Calling this method is the equivalent of creating a new instance.