From 5df1ffdb56983ccccf55fe8133d789f9d3fa18e0 Mon Sep 17 00:00:00 2001 From: Dave Skender <8432125+DaveSkender@users.noreply.github.com> Date: Sun, 13 Oct 2024 22:34:51 -0400 Subject: [PATCH] use IReadOnly result inputs --- src/_common/Generics/Pruning.cs | 4 +- src/_common/Generics/Transforms.cs | 5 +- src/_common/Math/Numerical.cs | 22 ++----- src/_common/ObsoleteV3.cs | 2 +- src/_common/Quotes/Quote.Converters.cs | 2 - src/_common/Quotes/Quote.Validation.cs | 57 +++++-------------- src/_common/Quotes/info.xml | 17 +----- src/_common/Reusable/Reusable.Utilities.cs | 7 +-- src/a-d/Adx/Adx.Utilities.cs | 4 +- src/a-d/Alligator/Alligator.Utilities.cs | 2 +- src/a-d/Alma/Alma.Api.cs | 2 +- src/a-d/Alma/Alma.Utilities.cs | 4 +- src/a-d/Aroon/Aroon.Utilities.cs | 4 +- src/a-d/Atr/Atr.Utilities.cs | 2 +- src/a-d/AtrStop/AtrStop.Utilities.cs | 8 +-- src/a-d/Awesome/Awesome.Utilities.cs | 4 +- src/a-d/Beta/Beta.Utilities.cs | 4 +- src/a-d/BollingerBands/BollingerBands.Api.cs | 2 +- .../BollingerBands.Utilities.cs | 4 +- src/a-d/Bop/Bop.Utilities.cs | 4 +- src/a-d/Cci/Cci.Utilities.cs | 4 +- src/a-d/ChaikinOsc/ChaikinOsc.StaticSeries.cs | 4 +- src/a-d/ChaikinOsc/ChaikinOsc.Utilities.cs | 4 +- src/a-d/Chandelier/Chandelier.Utilities.cs | 4 +- src/a-d/Chop/Chop.Utilities.cs | 4 +- src/a-d/Cmf/Cmf.Utilities.cs | 4 +- src/a-d/Cmo/Cmo.Utilities.cs | 4 +- src/a-d/ConnorsRsi/ConnorsRsi.Api.cs | 2 +- src/a-d/ConnorsRsi/ConnorsRsi.Utilities.cs | 4 +- src/a-d/Correlation/Correlation.Utilities.cs | 4 +- src/a-d/Dema/Dema.Api.cs | 2 +- src/a-d/Dema/Dema.Utilities.cs | 4 +- src/a-d/Donchian/Donchian.Utilities.cs | 8 +-- src/a-d/Dpo/Dpo.Api.cs | 2 +- src/a-d/Dpo/Dpo.StaticSeries.cs | 2 +- src/a-d/Dynamic/Dynamic.Api.cs | 2 +- src/e-k/ElderRay/ElderRay.StaticSeries.cs | 4 +- src/e-k/ElderRay/ElderRay.Utilities.cs | 4 +- src/e-k/Ema/Ema.Api.cs | 15 +---- src/e-k/Ema/Ema.StaticSeries.cs | 5 +- src/e-k/Ema/Ema.Utilities.cs | 2 +- src/e-k/Epma/Epma.Api.cs | 2 +- src/e-k/Epma/Epma.Utilities.cs | 4 +- src/e-k/Fcb/Fcb.Utilities.cs | 8 +-- .../FisherTransform/FisherTransform.Api.cs | 2 +- src/e-k/ForceIndex/ForceIndex.Utilities.cs | 4 +- src/e-k/Fractal/Fractal.Utilities.cs | 4 +- src/e-k/Gator/Gator.Utilities.cs | 8 +-- src/e-k/Hma/Hma.Api.cs | 2 +- src/e-k/Hma/Hma.Utilities.cs | 4 +- src/e-k/HtTrendline/HtTrendline.Utilities.cs | 4 +- src/e-k/Hurst/Hurst.Api.cs | 2 +- src/e-k/Hurst/Hurst.Utilities.cs | 4 +- src/e-k/Ichimoku/Ichimoku.Utilities.cs | 4 +- src/e-k/Kama/Kama.Utilities.cs | 4 +- src/e-k/Keltner/Keltner.StaticSeries.cs | 2 +- src/e-k/Keltner/Keltner.Utilities.cs | 8 +-- src/e-k/Kvo/Kvo.Utilities.cs | 4 +- src/m-r/MaEnvelopes/MaEnvelopes.Api.cs | 2 +- .../MaEnvelopes/MaEnvelopes.StaticSeries.cs | 4 +- src/m-r/MaEnvelopes/MaEnvelopes.Utilities.cs | 4 +- src/m-r/Macd/Macd.Utilities.cs | 4 +- src/m-r/Macd/MacdApi.cs | 2 +- src/m-r/Mama/Mama.Api.cs | 2 +- src/m-r/Mama/Mama.Utilities.cs | 4 +- src/m-r/Mfi/Mfi.Utilities.cs | 4 +- .../ParabolicSar/ParabolicSar.Utilities.cs | 4 +- src/m-r/PivotPoints/PivotPoints.Utilities.cs | 4 +- src/m-r/Pivots/Pivots.Utilities.cs | 4 +- src/m-r/Pmo/Pmo.Api.cs | 2 +- src/m-r/Pmo/Pmo.Utilities.cs | 4 +- src/m-r/Pvo/Pvo.Utilities.cs | 4 +- src/m-r/Roc/Roc.Api.cs | 2 +- src/m-r/Roc/Roc.Utilities.cs | 4 +- src/m-r/RocWb/RocWb.Api.cs | 2 +- src/m-r/RocWb/RocWb.Utilities.cs | 4 +- .../RollingPivots/RollingPivots.Utilities.cs | 4 +- src/m-r/Rsi/Rsi.Api.cs | 2 +- src/m-r/Rsi/Rsi.Utilities.cs | 4 +- src/s-z/Slope/Slope.Api.cs | 2 +- src/s-z/Slope/Slope.Utilities.cs | 4 +- src/s-z/Sma/Sma.Api.cs | 9 --- src/s-z/Sma/Sma.StaticSeries.cs | 7 ++- .../SmaAnalysis/SmaAnalysis.StaticSeries.cs | 2 +- src/s-z/Smi/Smi.Utilities.cs | 4 +- src/s-z/Smma/Smma.Api.cs | 2 +- src/s-z/Smma/Smma.Utilities.cs | 4 +- src/s-z/StarcBands/StarcBands.StaticSeries.cs | 6 +- src/s-z/StarcBands/StarcBands.Utilities.cs | 8 +-- src/s-z/Stc/Stc.Api.cs | 2 +- src/s-z/Stc/Stc.Utilities.cs | 4 +- src/s-z/StdDev/StdDev.Api.cs | 2 +- src/s-z/StdDev/StdDev.Utilities.cs | 4 +- src/s-z/StdDevChannels/StdDevChannels.Api.cs | 2 +- .../StdDevChannels.Utilities.cs | 8 +-- src/s-z/Stoch/Stoch.Utilities.cs | 4 +- src/s-z/StochRsi/StochRsi.Api.cs | 2 +- src/s-z/StochRsi/StochRsi.Utilities.cs | 4 +- src/s-z/SuperTrend/SuperTrend.Utilities.cs | 8 +-- src/s-z/T3/T3.Api.cs | 2 +- src/s-z/Tema/Tema.Api.cs | 2 +- src/s-z/Tema/Tema.Utilities.cs | 4 +- src/s-z/Trix/Trix.Api.cs | 2 +- src/s-z/Trix/Trix.Utilities.cs | 4 +- src/s-z/Tsi/Tsi.Api.cs | 2 +- src/s-z/Tsi/Tsi.Utilities.cs | 4 +- src/s-z/UlcerIndex/UlcerIndex.Api.cs | 2 +- src/s-z/UlcerIndex/UlcerIndex.Utilities.cs | 4 +- src/s-z/Ultimate/Ultimate.Utilities.cs | 4 +- .../VolatilityStop.Utilities.cs | 4 +- src/s-z/Vortex/Vortex.Utilities.cs | 8 +-- src/s-z/Vwap/Vwap.Utilities.cs | 4 +- src/s-z/Vwma/Vwma.Utilities.cs | 4 +- src/s-z/WilliamsR/WilliamsR.Utilities.cs | 4 +- src/s-z/Wma/Wma.Api.cs | 2 +- src/s-z/Wma/Wma.Utilities.cs | 4 +- src/s-z/ZigZag/ZigZag.Utilities.cs | 4 +- .../Observables/StreamHub.Observable.Tests.cs | 2 +- .../_common/Quotes/Quote.StreamHub.Tests.cs | 2 +- .../_common/Quotes/Quote.Validation.Tests.cs | 4 +- .../QuotePart.StaticSeries.Tests.cs | 2 +- .../QuotePart.StreamHub.Tests.cs | 2 +- .../a-d/Adl/Adl.StaticSeries.Tests.cs | 2 +- .../indicators/a-d/Adl/Adl.StreamHub.Tests.cs | 2 +- .../a-d/Adx/Adx.StaticSeries.Tests.cs | 2 +- .../Alligator/Alligator.StaticSeries.Tests.cs | 2 +- .../Alligator/Alligator.StreamHub.Tests.cs | 2 +- .../a-d/Alma/Alma.StaticSeries.Tests.cs | 4 +- .../a-d/Aroon/Aroon.StaticSeries.Tests.cs | 2 +- .../a-d/Atr/Atr.StaticSeries.Tests.cs | 2 +- .../indicators/a-d/Atr/Atr.StreamHub.Tests.cs | 2 +- .../a-d/Awesome/Awesome.StaticSeries.Tests.cs | 4 +- .../a-d/Beta/Beta.StaticSeries.Tests.cs | 6 +- .../BollingerBands.StaticSeries.Tests.cs | 4 +- .../a-d/Bop/Bop.StaticSeries.Tests.cs | 2 +- .../a-d/Cci/Cci.StaticSeries.Tests.cs | 2 +- .../ChaikinOsc.StaticSeries.Tests.cs | 2 +- .../Chandelier.StaticSeries.Tests.cs | 2 +- .../a-d/Chop/Chop.StaticSeries.Tests.cs | 2 +- .../a-d/Cmf/Cmf.StaticSeries.Tests.cs | 2 +- .../a-d/Cmo/Cmo.StaticSeries.Tests.cs | 4 +- .../ConnorsRsi.StaticSeries.Tests.cs | 4 +- .../Correlation.StaticSeries.Tests.cs | 6 +- .../a-d/Dema/Dema.StaticSeries.Tests.cs | 4 +- .../a-d/Dpo/Dpo.StaticSeries.Tests.cs | 4 +- .../a-d/Dynamic/Dynamic.StaticSeries.Tests.cs | 4 +- .../ElderRay/ElderRay.StaticSeries.Tests.cs | 2 +- .../e-k/Ema/Ema.Increments.Tests.cs | 5 +- .../e-k/Ema/Ema.StaticSeries.Tests.cs | 33 +++++------ .../indicators/e-k/Ema/Ema.StreamHub.Tests.cs | 12 ++-- .../e-k/Epma/Epma.StaticSeries.Tests.cs | 4 +- .../FisherTransform.StaticSeries.Tests.cs | 4 +- .../ForceIndex.StaticSeries.Tests.cs | 2 +- .../e-k/Gator/Gator.StaticSeries.Tests.cs | 2 +- .../HeikinAshi.StaticSeries.Tests.cs | 4 +- .../e-k/Hma/Hma.StaticSeries.Tests.cs | 4 +- .../HtTrendline.StaticSeries.Tests.cs | 4 +- .../e-k/Hurst/Hurst.StaticSeries.Tests.cs | 4 +- .../e-k/Kama/Kama.StaticSeries.Tests.cs | 4 +- .../e-k/Kvo/Kvo.StaticSeries.Tests.cs | 2 +- .../MaEnvelopes.StaticSeries.Tests.cs | 2 +- .../m-r/Macd/Macd.StaticSeries.Tests.cs | 4 +- .../m-r/Mama/Mama.StaticSeries.Tests.cs | 4 +- .../m-r/Mfi/Mfi.StaticSeries.Tests.cs | 2 +- .../m-r/Obv/Obv.StaticSeries.Tests.cs | 2 +- .../ParabolicSar.StaticSeries.Tests.cs | 2 +- .../m-r/Pmo/Pmo.StaticSeries.Tests.cs | 4 +- .../m-r/Prs/Prs.StaticSeries.Tests.cs | 6 +- .../m-r/Pvo/Pvo.StaticSeries.Tests.cs | 2 +- .../m-r/Renko/Renko.StaticSeries.Tests.cs | 4 +- .../m-r/Renko/Renko.StreamHub.Tests.cs | 2 +- .../m-r/Roc/Roc.StaticSeries.Tests.cs | 4 +- .../m-r/RocWb/RocWb.StaticSeries.Tests.cs | 4 +- .../m-r/Rsi/Rsi.StaticSeries.Tests.cs | 8 +-- .../s-z/Slope/Slope.StaticSeries.Tests.cs | 4 +- .../s-z/Sma/Sma.StaticSeries.Tests.cs | 22 +++---- .../indicators/s-z/Sma/Sma.StreamHub.Tests.cs | 8 +-- .../SmaAnalysis.StaticSeries.Tests.cs | 4 +- .../s-z/Smi/Smi.StaticSeries.Tests.cs | 2 +- .../s-z/Smma/Smma.StaticSeries.Tests.cs | 4 +- .../s-z/Stc/Stc.StaticSeries.Tests.cs | 4 +- .../s-z/StdDev/StdDev.StaticSeries.Tests.cs | 4 +- .../StdDevChannels.StaticSeries.Tests.cs | 2 +- .../s-z/Stoch/Stoch.StaticSeries.Tests.cs | 2 +- .../StochRsi/StochRsi.StaticSeries.Tests.cs | 4 +- .../s-z/T3/T3.StaticSeries.Tests.cs | 4 +- .../s-z/Tema/Tema.StaticSeries.Tests.cs | 4 +- tests/indicators/s-z/Tr/Tr.StreamHub.Tests.cs | 2 +- .../s-z/Trix/Trix.StaticSeries.Tests.cs | 4 +- .../s-z/Tsi/Tsi.StaticSeries.Tests.cs | 4 +- .../UlcerIndex.StaticSeries.Tests.cs | 4 +- .../Ultimate/Ultimate.StaticSeries.Tests.cs | 2 +- .../VolatilityStop.StaticSeries.Tests.cs | 2 +- .../s-z/Vwap/Vwap.StaticSeries.Tests.cs | 2 +- .../s-z/Vwma/Vwma.StaticSeries.Tests.cs | 2 +- .../WilliamsR/WilliamsR.StaticSeries.Tests.cs | 2 +- .../s-z/Wma/Wma.StaticSeries.Tests.cs | 4 +- .../s-z/ZigZag/ZigZag.StaticSeries.Tests.cs | 2 +- tests/other/Convergence.Tests.cs | 2 +- tests/other/Custom.Indicator.Tests.cs | 2 +- tests/other/Custom.Quotes.Tests.cs | 6 +- tests/other/Custom.Results.Tests.cs | 4 +- tests/other/PublicApi.Interface.Tests.cs | 28 ++++----- tests/other/Sut.CustomItems.cs | 2 +- tests/performance/Perf.Increments.cs | 15 ++--- tests/performance/Perf.StaticSeries.cs | 4 +- tests/performance/Perf.StreamHub.Externals.cs | 2 +- 207 files changed, 406 insertions(+), 517 deletions(-) diff --git a/src/_common/Generics/Pruning.cs b/src/_common/Generics/Pruning.cs index c6d58f089..997957a91 100644 --- a/src/_common/Generics/Pruning.cs +++ b/src/_common/Generics/Pruning.cs @@ -6,7 +6,7 @@ public static partial class Utility { // REMOVE SPECIFIC PERIODS public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable series, + this IReadOnlyList series, int removePeriods) => removePeriods < 0 ? throw new ArgumentOutOfRangeException(nameof(removePeriods), removePeriods, @@ -15,7 +15,7 @@ public static IReadOnlyList RemoveWarmupPeriods( // REMOVE PERIODS internal static List Remove( - this IEnumerable series, + this IReadOnlyList series, int removePeriods) { List seriesList = series.ToList(); diff --git a/src/_common/Generics/Transforms.cs b/src/_common/Generics/Transforms.cs index eb2f63415..11e6b3ffd 100644 --- a/src/_common/Generics/Transforms.cs +++ b/src/_common/Generics/Transforms.cs @@ -9,10 +9,7 @@ public static partial class Utility // TO COLLECTION internal static Collection ToCollection(this IEnumerable source) { - if (source is null) - { - throw new ArgumentNullException(nameof(source)); - } + ArgumentNullException.ThrowIfNull(source); Collection collection = [.. source]; diff --git a/src/_common/Math/Numerical.cs b/src/_common/Math/Numerical.cs index b9e68e69b..bba184344 100644 --- a/src/_common/Math/Numerical.cs +++ b/src/_common/Math/Numerical.cs @@ -5,13 +5,8 @@ public static class Numerical // STANDARD DEVIATION public static double StdDev(this double[] values) { - // validate parameters - if (values is null) - { - throw new ArgumentNullException( - nameof(values), - "StdDev values cannot be null."); - } + ArgumentNullException.ThrowIfNull( + values, "StdDev values cannot be null."); int n = values.Length; @@ -43,17 +38,8 @@ public static double StdDev(this double[] values) public static double Slope(double[] x, double[] y) { // validate parameters - if (x is null) - { - throw new ArgumentNullException( - nameof(x), "Slope X values cannot be null."); - } - - if (y is null) - { - throw new ArgumentNullException( - nameof(y), "Slope Y values cannot be null."); - } + ArgumentNullException.ThrowIfNull(x, "Slope X values cannot be null."); + ArgumentNullException.ThrowIfNull(y, "Slope Y values cannot be null."); if (x.Length != y.Length) { diff --git a/src/_common/ObsoleteV3.cs b/src/_common/ObsoleteV3.cs index e5fed2b73..a9f881db2 100644 --- a/src/_common/ObsoleteV3.cs +++ b/src/_common/ObsoleteV3.cs @@ -33,7 +33,7 @@ public static IEnumerable GetAlligator( public static IEnumerable GetEma( this IEnumerable quotes, int lookbackPeriods) where TQuote : IQuote - => Api.GetEma(quotes, lookbackPeriods); + => quotes.ToSortedList().ToEma(lookbackPeriods); // REMOVAL OF INTEGRATED SMAs (evaluates to ERRORs) diff --git a/src/_common/Quotes/Quote.Converters.cs b/src/_common/Quotes/Quote.Converters.cs index d78bbdd97..3aa55d0c1 100644 --- a/src/_common/Quotes/Quote.Converters.cs +++ b/src/_common/Quotes/Quote.Converters.cs @@ -6,8 +6,6 @@ namespace Skender.Stock.Indicators; public static partial class Utility { - private static readonly CultureInfo NativeCulture = Thread.CurrentThread.CurrentUICulture; - /* LISTS */ // convert TQuote type list to built-in Quote type list diff --git a/src/_common/Quotes/Quote.Validation.cs b/src/_common/Quotes/Quote.Validation.cs index b0197e78b..8063da563 100644 --- a/src/_common/Quotes/Quote.Validation.cs +++ b/src/_common/Quotes/Quote.Validation.cs @@ -2,38 +2,10 @@ namespace Skender.Stock.Indicators; -// QUOTE UTILITIES +// QUOTE UTILITIES: VALIDATION public static partial class Utility { - // VALIDATION - /// - /// - public static IReadOnlyList Validate( - this IEnumerable quotes) - where TQuote : IQuote - { - // we cannot rely on date consistency when looking back, so we force sort - - List quotesList = quotes.ToSortedList(); - - // check for duplicates - DateTime lastDate = DateTime.MinValue; - foreach (TQuote q in quotesList) - { - // check for duplicates - if (lastDate == q.Timestamp) - { - throw new InvalidQuotesException( - string.Format(NativeCulture, "Duplicate date found on {0}.", q.Timestamp)); - } - - lastDate = q.Timestamp; - } - - return quotesList; - } - /// /// Check that quotes are valid and in ascending order. /// @@ -50,34 +22,33 @@ public static IReadOnlyList Validate( this IReadOnlyList quotes) where TQuote : IQuote { - // assumes already sorted - if (quotes is null) + ArgumentNullException.ThrowIfNull(quotes); + + if (quotes.Count == 0) { - throw new ArgumentNullException(nameof(quotes)); + return quotes; } - // check for duplicates/sequence - DateTime lastDate = DateTime.MinValue; - foreach (TQuote q in quotes) + DateTime lastDate = quotes[0].Timestamp; + for (int i = 1; i < quotes.Count; i++) { - // check for duplicates - if (lastDate == q.Timestamp) + DateTime currentDate = quotes[i].Timestamp; + + if (lastDate == currentDate) { throw new InvalidQuotesException( - string.Format(CultureInfo.InvariantCulture, "Duplicate date found on {0}.", q.Timestamp)); + string.Format(CultureInfo.InvariantCulture, "Duplicate date found on {0}.", currentDate)); } - // check for sequence - if (lastDate > q.Timestamp) + if (lastDate > currentDate) { throw new InvalidQuotesException( - string.Format(NativeCulture, "Quotes are out of sequence on {0}.", q.Timestamp)); + string.Format(CultureInfo.InvariantCulture, "Quotes are out of sequence on {0}.", currentDate)); } - lastDate = q.Timestamp; + lastDate = currentDate; } return quotes; } - } diff --git a/src/_common/Quotes/info.xml b/src/_common/Quotes/info.xml index d172a60d0..721479e5b 100644 --- a/src/_common/Quotes/info.xml +++ b/src/_common/Quotes/info.xml @@ -2,21 +2,6 @@ - - - Validate historical quotes. - - See - documentation - for more information. - - - Configurable Quote type. See Guide for more information. - Historical price quotes. - Time series of historical quote values. - Validation check failed. - - Converts historical quotes into larger bar sizes. @@ -49,4 +34,4 @@ Invalid parameter value provided. - \ No newline at end of file + diff --git a/src/_common/Reusable/Reusable.Utilities.cs b/src/_common/Reusable/Reusable.Utilities.cs index d49655a27..00a729560 100644 --- a/src/_common/Reusable/Reusable.Utilities.cs +++ b/src/_common/Reusable/Reusable.Utilities.cs @@ -26,7 +26,7 @@ public static IReadOnlyList ToReusableList( /// Indicator results to evaluate. /// Time series of indicator results, condensed. public static IReadOnlyList Condense( - this IEnumerable results) + this IReadOnlyList results) where T : IReusable { List resultsList = results @@ -37,9 +37,6 @@ public static IReadOnlyList Condense( x => double.IsNaN(x.Value)); return resultsList; - - // TODO: remove specific indicator 'Condense()' methods - // that are now redundant to this generic method (not all are) } /// @@ -54,7 +51,7 @@ public static IReadOnlyList Condense( /// Indicator results to evaluate. /// Time series of results, pruned. internal static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) where T : IReusable { // this is the default implementation, it will diff --git a/src/a-d/Adx/Adx.Utilities.cs b/src/a-d/Adx/Adx.Utilities.cs index 67e984948..ff9a1d40f 100644 --- a/src/a-d/Adx/Adx.Utilities.cs +++ b/src/a-d/Adx/Adx.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int n = results .ToList() diff --git a/src/a-d/Alligator/Alligator.Utilities.cs b/src/a-d/Alligator/Alligator.Utilities.cs index 59cae1a79..b0a1fd257 100644 --- a/src/a-d/Alligator/Alligator.Utilities.cs +++ b/src/a-d/Alligator/Alligator.Utilities.cs @@ -18,7 +18,7 @@ public static IReadOnlyList Condense( // remove recommended periods public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/a-d/Alma/Alma.Api.cs b/src/a-d/Alma/Alma.Api.cs index 64b49785a..ffb1e3555 100644 --- a/src/a-d/Alma/Alma.Api.cs +++ b/src/a-d/Alma/Alma.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetAlma( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods = 9, double offset = 0.85, double sigma = 6) diff --git a/src/a-d/Alma/Alma.Utilities.cs b/src/a-d/Alma/Alma.Utilities.cs index bdf32d6ab..13542b0e0 100644 --- a/src/a-d/Alma/Alma.Utilities.cs +++ b/src/a-d/Alma/Alma.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/a-d/Aroon/Aroon.Utilities.cs b/src/a-d/Aroon/Aroon.Utilities.cs index d9819d84f..66eb9d036 100644 --- a/src/a-d/Aroon/Aroon.Utilities.cs +++ b/src/a-d/Aroon/Aroon.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/a-d/Atr/Atr.Utilities.cs b/src/a-d/Atr/Atr.Utilities.cs index 14239d69a..3b5790747 100644 --- a/src/a-d/Atr/Atr.Utilities.cs +++ b/src/a-d/Atr/Atr.Utilities.cs @@ -41,7 +41,7 @@ public static AtrResult Increment( // remove recommended periods public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/a-d/AtrStop/AtrStop.Utilities.cs b/src/a-d/AtrStop/AtrStop.Utilities.cs index a96b27fd5..8f2bd1c5f 100644 --- a/src/a-d/AtrStop/AtrStop.Utilities.cs +++ b/src/a-d/AtrStop/AtrStop.Utilities.cs @@ -5,9 +5,9 @@ namespace Skender.Stock.Indicators; public static partial class AtrStop { // CONDENSE (REMOVE null results) - /// + /// public static IReadOnlyList Condense( - this IEnumerable results) + this IReadOnlyList results) { List resultsList = results .ToList(); @@ -18,9 +18,9 @@ public static IReadOnlyList Condense( } // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/a-d/Awesome/Awesome.Utilities.cs b/src/a-d/Awesome/Awesome.Utilities.cs index 63333ebeb..cd8ec64ee 100644 --- a/src/a-d/Awesome/Awesome.Utilities.cs +++ b/src/a-d/Awesome/Awesome.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/a-d/Beta/Beta.Utilities.cs b/src/a-d/Beta/Beta.Utilities.cs index ac1a1434c..9cb071a21 100644 --- a/src/a-d/Beta/Beta.Utilities.cs +++ b/src/a-d/Beta/Beta.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/a-d/BollingerBands/BollingerBands.Api.cs b/src/a-d/BollingerBands/BollingerBands.Api.cs index 28fa8dda8..aa4c0a99d 100644 --- a/src/a-d/BollingerBands/BollingerBands.Api.cs +++ b/src/a-d/BollingerBands/BollingerBands.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetBollingerBands( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods = 20, double standardDeviations = 2) where T : IReusable diff --git a/src/a-d/BollingerBands/BollingerBands.Utilities.cs b/src/a-d/BollingerBands/BollingerBands.Utilities.cs index 167fee2b7..b8d3906cb 100644 --- a/src/a-d/BollingerBands/BollingerBands.Utilities.cs +++ b/src/a-d/BollingerBands/BollingerBands.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/a-d/Bop/Bop.Utilities.cs b/src/a-d/Bop/Bop.Utilities.cs index 08a059ba9..cb36acf08 100644 --- a/src/a-d/Bop/Bop.Utilities.cs +++ b/src/a-d/Bop/Bop.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/a-d/Cci/Cci.Utilities.cs b/src/a-d/Cci/Cci.Utilities.cs index e71456947..fee230bb7 100644 --- a/src/a-d/Cci/Cci.Utilities.cs +++ b/src/a-d/Cci/Cci.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/a-d/ChaikinOsc/ChaikinOsc.StaticSeries.cs b/src/a-d/ChaikinOsc/ChaikinOsc.StaticSeries.cs index 00b2ea54a..0cc49d026 100644 --- a/src/a-d/ChaikinOsc/ChaikinOsc.StaticSeries.cs +++ b/src/a-d/ChaikinOsc/ChaikinOsc.StaticSeries.cs @@ -21,8 +21,8 @@ private static List CalcChaikinOsc( List adlResults = source.CalcAdl(); // fast/slow EMA of ADL - List adlEmaSlow = adlResults.CalcEma(slowPeriods); - List adlEmaFast = adlResults.CalcEma(fastPeriods); + IReadOnlyList adlEmaSlow = adlResults.ToEma(slowPeriods); + IReadOnlyList adlEmaFast = adlResults.ToEma(fastPeriods); // roll through source values for (int i = 0; i < length; i++) diff --git a/src/a-d/ChaikinOsc/ChaikinOsc.Utilities.cs b/src/a-d/ChaikinOsc/ChaikinOsc.Utilities.cs index 6f11abc34..edfeb413e 100644 --- a/src/a-d/ChaikinOsc/ChaikinOsc.Utilities.cs +++ b/src/a-d/ChaikinOsc/ChaikinOsc.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int s = results .ToList() diff --git a/src/a-d/Chandelier/Chandelier.Utilities.cs b/src/a-d/Chandelier/Chandelier.Utilities.cs index a7ff84bcb..5ac5dc0b9 100644 --- a/src/a-d/Chandelier/Chandelier.Utilities.cs +++ b/src/a-d/Chandelier/Chandelier.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/a-d/Chop/Chop.Utilities.cs b/src/a-d/Chop/Chop.Utilities.cs index 7b93a5d31..bc05a29ba 100644 --- a/src/a-d/Chop/Chop.Utilities.cs +++ b/src/a-d/Chop/Chop.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/a-d/Cmf/Cmf.Utilities.cs b/src/a-d/Cmf/Cmf.Utilities.cs index 02954b3d6..2fd812d8e 100644 --- a/src/a-d/Cmf/Cmf.Utilities.cs +++ b/src/a-d/Cmf/Cmf.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/a-d/Cmo/Cmo.Utilities.cs b/src/a-d/Cmo/Cmo.Utilities.cs index 3c9b23628..715694baf 100644 --- a/src/a-d/Cmo/Cmo.Utilities.cs +++ b/src/a-d/Cmo/Cmo.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/a-d/ConnorsRsi/ConnorsRsi.Api.cs b/src/a-d/ConnorsRsi/ConnorsRsi.Api.cs index 5cb943377..949647b72 100644 --- a/src/a-d/ConnorsRsi/ConnorsRsi.Api.cs +++ b/src/a-d/ConnorsRsi/ConnorsRsi.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetConnorsRsi( - this IEnumerable results, + this IReadOnlyList results, int rsiPeriods = 3, int streakPeriods = 2, int rankPeriods = 100) diff --git a/src/a-d/ConnorsRsi/ConnorsRsi.Utilities.cs b/src/a-d/ConnorsRsi/ConnorsRsi.Utilities.cs index b4d79d2d1..313953e5b 100644 --- a/src/a-d/ConnorsRsi/ConnorsRsi.Utilities.cs +++ b/src/a-d/ConnorsRsi/ConnorsRsi.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int n = results .ToList() diff --git a/src/a-d/Correlation/Correlation.Utilities.cs b/src/a-d/Correlation/Correlation.Utilities.cs index a6be6eb7e..dafbf54fa 100644 --- a/src/a-d/Correlation/Correlation.Utilities.cs +++ b/src/a-d/Correlation/Correlation.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/a-d/Dema/Dema.Api.cs b/src/a-d/Dema/Dema.Api.cs index fdbfca629..bbabc1acb 100644 --- a/src/a-d/Dema/Dema.Api.cs +++ b/src/a-d/Dema/Dema.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetDema( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods) where T : IReusable => results diff --git a/src/a-d/Dema/Dema.Utilities.cs b/src/a-d/Dema/Dema.Utilities.cs index 60f63a390..c31646de2 100644 --- a/src/a-d/Dema/Dema.Utilities.cs +++ b/src/a-d/Dema/Dema.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int n = results .ToList() diff --git a/src/a-d/Donchian/Donchian.Utilities.cs b/src/a-d/Donchian/Donchian.Utilities.cs index bc74a5da2..4c7b45533 100644 --- a/src/a-d/Donchian/Donchian.Utilities.cs +++ b/src/a-d/Donchian/Donchian.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // CONDENSE (REMOVE null results) - /// + /// public static IReadOnlyList Condense( - this IEnumerable results) + this IReadOnlyList results) { List resultsList = results .ToList(); @@ -18,9 +18,9 @@ public static IReadOnlyList Condense( } // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/a-d/Dpo/Dpo.Api.cs b/src/a-d/Dpo/Dpo.Api.cs index 38a81aea1..740f3b503 100644 --- a/src/a-d/Dpo/Dpo.Api.cs +++ b/src/a-d/Dpo/Dpo.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetDpo( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods) where T : IReusable => results diff --git a/src/a-d/Dpo/Dpo.StaticSeries.cs b/src/a-d/Dpo/Dpo.StaticSeries.cs index 6f55dd35a..2c79a189d 100644 --- a/src/a-d/Dpo/Dpo.StaticSeries.cs +++ b/src/a-d/Dpo/Dpo.StaticSeries.cs @@ -20,7 +20,7 @@ private static List CalcDpo( int offset = (lookbackPeriods / 2) + 1; IReadOnlyList sma - = source.CalcSma(lookbackPeriods); + = source.ToSma(lookbackPeriods); // roll through source values for (int i = 0; i < length; i++) diff --git a/src/a-d/Dynamic/Dynamic.Api.cs b/src/a-d/Dynamic/Dynamic.Api.cs index 55f47ec05..9a953f59f 100644 --- a/src/a-d/Dynamic/Dynamic.Api.cs +++ b/src/a-d/Dynamic/Dynamic.Api.cs @@ -6,7 +6,7 @@ public static partial class MgDynamic { // SERIES, from CHAIN public static IReadOnlyList GetDynamic( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods, double kFactor = 0.6) where T : IReusable diff --git a/src/e-k/ElderRay/ElderRay.StaticSeries.cs b/src/e-k/ElderRay/ElderRay.StaticSeries.cs index 0400056bb..3935caa6a 100644 --- a/src/e-k/ElderRay/ElderRay.StaticSeries.cs +++ b/src/e-k/ElderRay/ElderRay.StaticSeries.cs @@ -16,8 +16,8 @@ private static List CalcElderRay( List results = new(length); // EMA - List emaResults - = source.CalcEma(lookbackPeriods); + IReadOnlyList emaResults + = source.ToEma(lookbackPeriods); // roll through source values for (int i = 0; i < length; i++) diff --git a/src/e-k/ElderRay/ElderRay.Utilities.cs b/src/e-k/ElderRay/ElderRay.Utilities.cs index e38e79590..052844eea 100644 --- a/src/e-k/ElderRay/ElderRay.Utilities.cs +++ b/src/e-k/ElderRay/ElderRay.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int n = results .ToList() diff --git a/src/e-k/Ema/Ema.Api.cs b/src/e-k/Ema/Ema.Api.cs index 10bac357f..bf9d82f37 100644 --- a/src/e-k/Ema/Ema.Api.cs +++ b/src/e-k/Ema/Ema.Api.cs @@ -2,21 +2,8 @@ namespace Skender.Stock.Indicators; // EXPONENTIAL MOVING AVERAGE (API) -public static partial class Api +public static partial class Ema { - //SERIES, from CHAIN - public static IReadOnlyList GetEma( - - // FIX: Use "Ema" instead of "Api" class name - // It fails when renaming this to ToEma() - - this IEnumerable results, - int lookbackPeriods) - where T : IReusable - => results - .ToSortedList() - .CalcEma(lookbackPeriods); - // HUB, from Chain Provider public static EmaHub ToEma( this IChainProvider chainProvider, diff --git a/src/e-k/Ema/Ema.StaticSeries.cs b/src/e-k/Ema/Ema.StaticSeries.cs index ae46fa361..49ad66637 100644 --- a/src/e-k/Ema/Ema.StaticSeries.cs +++ b/src/e-k/Ema/Ema.StaticSeries.cs @@ -4,12 +4,13 @@ namespace Skender.Stock.Indicators; public static partial class Ema { - internal static List CalcEma( - this List source, + public static IReadOnlyList ToEma( + this IReadOnlyList source, int lookbackPeriods) where T : IReusable { // check parameter arguments + ArgumentNullException.ThrowIfNull(source); Validate(lookbackPeriods); // initialize diff --git a/src/e-k/Ema/Ema.Utilities.cs b/src/e-k/Ema/Ema.Utilities.cs index eb922d370..6a8f8f1f0 100644 --- a/src/e-k/Ema/Ema.Utilities.cs +++ b/src/e-k/Ema/Ema.Utilities.cs @@ -27,7 +27,7 @@ public static double Increment( // remove recommended periods public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int n = results .ToList() diff --git a/src/e-k/Epma/Epma.Api.cs b/src/e-k/Epma/Epma.Api.cs index 932ccea70..0937ac444 100644 --- a/src/e-k/Epma/Epma.Api.cs +++ b/src/e-k/Epma/Epma.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetEpma( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods) where T : IReusable => results diff --git a/src/e-k/Epma/Epma.Utilities.cs b/src/e-k/Epma/Epma.Utilities.cs index 1376bb215..b0e7bbdf1 100644 --- a/src/e-k/Epma/Epma.Utilities.cs +++ b/src/e-k/Epma/Epma.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/e-k/Fcb/Fcb.Utilities.cs b/src/e-k/Fcb/Fcb.Utilities.cs index 989961b6d..b1ac461a7 100644 --- a/src/e-k/Fcb/Fcb.Utilities.cs +++ b/src/e-k/Fcb/Fcb.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // CONDENSE (REMOVE null results) - /// + /// public static IReadOnlyList Condense( - this IEnumerable results) + this IReadOnlyList results) { List resultsList = results .ToList(); @@ -18,9 +18,9 @@ public static IReadOnlyList Condense( } // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/e-k/FisherTransform/FisherTransform.Api.cs b/src/e-k/FisherTransform/FisherTransform.Api.cs index 0a8ba4f0c..51cec1dc9 100644 --- a/src/e-k/FisherTransform/FisherTransform.Api.cs +++ b/src/e-k/FisherTransform/FisherTransform.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetFisherTransform( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods = 10) where T : IReusable => results diff --git a/src/e-k/ForceIndex/ForceIndex.Utilities.cs b/src/e-k/ForceIndex/ForceIndex.Utilities.cs index 428b8dcfc..9c8ce8899 100644 --- a/src/e-k/ForceIndex/ForceIndex.Utilities.cs +++ b/src/e-k/ForceIndex/ForceIndex.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int n = results .ToList() diff --git a/src/e-k/Fractal/Fractal.Utilities.cs b/src/e-k/Fractal/Fractal.Utilities.cs index 5926ae46a..be6e56385 100644 --- a/src/e-k/Fractal/Fractal.Utilities.cs +++ b/src/e-k/Fractal/Fractal.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // CONDENSE (REMOVE null results) - /// + /// public static IReadOnlyList Condense( - this IEnumerable results) + this IReadOnlyList results) { List resultsList = results .ToList(); diff --git a/src/e-k/Gator/Gator.Utilities.cs b/src/e-k/Gator/Gator.Utilities.cs index e8be0f046..d2ce6e2a6 100644 --- a/src/e-k/Gator/Gator.Utilities.cs +++ b/src/e-k/Gator/Gator.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // CONDENSE (REMOVE null results) - /// + /// public static IReadOnlyList Condense( - this IEnumerable results) + this IReadOnlyList results) { List resultsList = results .ToList(); @@ -18,7 +18,7 @@ public static IReadOnlyList Condense( } // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) => results.Remove(150); + this IReadOnlyList results) => results.Remove(150); } diff --git a/src/e-k/Hma/Hma.Api.cs b/src/e-k/Hma/Hma.Api.cs index 2ea9d317d..8d11e4041 100644 --- a/src/e-k/Hma/Hma.Api.cs +++ b/src/e-k/Hma/Hma.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetHma( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods) where T : IReusable => results diff --git a/src/e-k/Hma/Hma.Utilities.cs b/src/e-k/Hma/Hma.Utilities.cs index d22ef9ffe..bbed74d40 100644 --- a/src/e-k/Hma/Hma.Utilities.cs +++ b/src/e-k/Hma/Hma.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/e-k/HtTrendline/HtTrendline.Utilities.cs b/src/e-k/HtTrendline/HtTrendline.Utilities.cs index b4fe28e15..ad7ef3c75 100644 --- a/src/e-k/HtTrendline/HtTrendline.Utilities.cs +++ b/src/e-k/HtTrendline/HtTrendline.Utilities.cs @@ -3,7 +3,7 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) => results.Remove(100); + this IReadOnlyList results) => results.Remove(100); } diff --git a/src/e-k/Hurst/Hurst.Api.cs b/src/e-k/Hurst/Hurst.Api.cs index 18789abed..ae882f69c 100644 --- a/src/e-k/Hurst/Hurst.Api.cs +++ b/src/e-k/Hurst/Hurst.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetHurst( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods = 100) where T : IReusable => results diff --git a/src/e-k/Hurst/Hurst.Utilities.cs b/src/e-k/Hurst/Hurst.Utilities.cs index 827f95467..bbce8e52a 100644 --- a/src/e-k/Hurst/Hurst.Utilities.cs +++ b/src/e-k/Hurst/Hurst.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/e-k/Ichimoku/Ichimoku.Utilities.cs b/src/e-k/Ichimoku/Ichimoku.Utilities.cs index 0e5f7891e..b09b048f0 100644 --- a/src/e-k/Ichimoku/Ichimoku.Utilities.cs +++ b/src/e-k/Ichimoku/Ichimoku.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // CONDENSE (REMOVE null results) - /// + /// public static IReadOnlyList Condense( - this IEnumerable results) + this IReadOnlyList results) { List resultsList = results .ToList(); diff --git a/src/e-k/Kama/Kama.Utilities.cs b/src/e-k/Kama/Kama.Utilities.cs index 3f844acab..ec2dada62 100644 --- a/src/e-k/Kama/Kama.Utilities.cs +++ b/src/e-k/Kama/Kama.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Kama { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int erPeriods = results .ToList() diff --git a/src/e-k/Keltner/Keltner.StaticSeries.cs b/src/e-k/Keltner/Keltner.StaticSeries.cs index 922d44401..f9fabdee9 100644 --- a/src/e-k/Keltner/Keltner.StaticSeries.cs +++ b/src/e-k/Keltner/Keltner.StaticSeries.cs @@ -18,7 +18,7 @@ private static List CalcKeltner( List results = new(length); IReadOnlyList emaResults - = source.CalcEma(emaPeriods); + = source.ToEma(emaPeriods); IReadOnlyList atrResults = source.CalcAtr(atrPeriods); diff --git a/src/e-k/Keltner/Keltner.Utilities.cs b/src/e-k/Keltner/Keltner.Utilities.cs index b97b5e68e..450152548 100644 --- a/src/e-k/Keltner/Keltner.Utilities.cs +++ b/src/e-k/Keltner/Keltner.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // CONDENSE (REMOVE null results) - /// + /// public static IReadOnlyList Condense( - this IEnumerable results) + this IReadOnlyList results) { List resultsList = results .ToList(); @@ -18,9 +18,9 @@ public static IReadOnlyList Condense( } // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int n = results .ToList() diff --git a/src/e-k/Kvo/Kvo.Utilities.cs b/src/e-k/Kvo/Kvo.Utilities.cs index b57303ac8..35d18ee9b 100644 --- a/src/e-k/Kvo/Kvo.Utilities.cs +++ b/src/e-k/Kvo/Kvo.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int l = results .ToList() diff --git a/src/m-r/MaEnvelopes/MaEnvelopes.Api.cs b/src/m-r/MaEnvelopes/MaEnvelopes.Api.cs index 477c7006c..d83d0b2f8 100644 --- a/src/m-r/MaEnvelopes/MaEnvelopes.Api.cs +++ b/src/m-r/MaEnvelopes/MaEnvelopes.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetMaEnvelopes( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods, double percentOffset = 2.5, MaType movingAverageType = MaType.SMA) diff --git a/src/m-r/MaEnvelopes/MaEnvelopes.StaticSeries.cs b/src/m-r/MaEnvelopes/MaEnvelopes.StaticSeries.cs index c2c065a0e..41736bb0e 100644 --- a/src/m-r/MaEnvelopes/MaEnvelopes.StaticSeries.cs +++ b/src/m-r/MaEnvelopes/MaEnvelopes.StaticSeries.cs @@ -72,7 +72,7 @@ private static IEnumerable MaEnvEma( int lookbackPeriods, double offsetRatio) where T : IReusable - => source.CalcEma(lookbackPeriods) + => source.ToEma(lookbackPeriods) .Select(x => new MaEnvelopeResult( Timestamp: x.Timestamp, Centerline: x.Ema, @@ -108,7 +108,7 @@ private static IEnumerable MaEnvSma( int lookbackPeriods, double offsetRatio) where T : IReusable - => source.CalcSma(lookbackPeriods) + => source.ToSma(lookbackPeriods) .Select(x => new MaEnvelopeResult( Timestamp: x.Timestamp, Centerline: x.Sma, diff --git a/src/m-r/MaEnvelopes/MaEnvelopes.Utilities.cs b/src/m-r/MaEnvelopes/MaEnvelopes.Utilities.cs index 55937c355..e2f6bdca5 100644 --- a/src/m-r/MaEnvelopes/MaEnvelopes.Utilities.cs +++ b/src/m-r/MaEnvelopes/MaEnvelopes.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // CONDENSE (REMOVE null results) - /// + /// public static IReadOnlyList Condense( - this IEnumerable results) + this IReadOnlyList results) { List resultsList = results .ToList(); diff --git a/src/m-r/Macd/Macd.Utilities.cs b/src/m-r/Macd/Macd.Utilities.cs index 53c0a5227..981a844a7 100644 --- a/src/m-r/Macd/Macd.Utilities.cs +++ b/src/m-r/Macd/Macd.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int n = results .ToList() diff --git a/src/m-r/Macd/MacdApi.cs b/src/m-r/Macd/MacdApi.cs index db9759211..a5d342aea 100644 --- a/src/m-r/Macd/MacdApi.cs +++ b/src/m-r/Macd/MacdApi.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetMacd( - this IEnumerable results, + this IReadOnlyList results, int fastPeriods = 12, int slowPeriods = 26, int signalPeriods = 9) diff --git a/src/m-r/Mama/Mama.Api.cs b/src/m-r/Mama/Mama.Api.cs index 5b4d98e0a..34264484d 100644 --- a/src/m-r/Mama/Mama.Api.cs +++ b/src/m-r/Mama/Mama.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetMama( - this IEnumerable results, + this IReadOnlyList results, double fastLimit = 0.5, double slowLimit = 0.05) where T : IReusable diff --git a/src/m-r/Mama/Mama.Utilities.cs b/src/m-r/Mama/Mama.Utilities.cs index 3789e8d72..6ccb00e26 100644 --- a/src/m-r/Mama/Mama.Utilities.cs +++ b/src/m-r/Mama/Mama.Utilities.cs @@ -3,7 +3,7 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) => results.Remove(50); + this IReadOnlyList results) => results.Remove(50); } diff --git a/src/m-r/Mfi/Mfi.Utilities.cs b/src/m-r/Mfi/Mfi.Utilities.cs index 07a1ba3c9..a3e420448 100644 --- a/src/m-r/Mfi/Mfi.Utilities.cs +++ b/src/m-r/Mfi/Mfi.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/m-r/ParabolicSar/ParabolicSar.Utilities.cs b/src/m-r/ParabolicSar/ParabolicSar.Utilities.cs index 4c9db1b4b..e08d805dd 100644 --- a/src/m-r/ParabolicSar/ParabolicSar.Utilities.cs +++ b/src/m-r/ParabolicSar/ParabolicSar.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/m-r/PivotPoints/PivotPoints.Utilities.cs b/src/m-r/PivotPoints/PivotPoints.Utilities.cs index 0de695e83..56ef7fd2e 100644 --- a/src/m-r/PivotPoints/PivotPoints.Utilities.cs +++ b/src/m-r/PivotPoints/PivotPoints.Utilities.cs @@ -4,9 +4,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/m-r/Pivots/Pivots.Utilities.cs b/src/m-r/Pivots/Pivots.Utilities.cs index 65417f95a..620d15622 100644 --- a/src/m-r/Pivots/Pivots.Utilities.cs +++ b/src/m-r/Pivots/Pivots.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // CONDENSE (REMOVE null results) - /// + /// public static IReadOnlyList Condense( - this IEnumerable results) + this IReadOnlyList results) { List resultsList = results .ToList(); diff --git a/src/m-r/Pmo/Pmo.Api.cs b/src/m-r/Pmo/Pmo.Api.cs index 6dd0e9481..99801c5d0 100644 --- a/src/m-r/Pmo/Pmo.Api.cs +++ b/src/m-r/Pmo/Pmo.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetPmo( - this IEnumerable results, + this IReadOnlyList results, int timePeriods = 35, int smoothPeriods = 20, int signalPeriods = 10) diff --git a/src/m-r/Pmo/Pmo.Utilities.cs b/src/m-r/Pmo/Pmo.Utilities.cs index 388388b4c..02e0e10c0 100644 --- a/src/m-r/Pmo/Pmo.Utilities.cs +++ b/src/m-r/Pmo/Pmo.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int ts = results .ToList() diff --git a/src/m-r/Pvo/Pvo.Utilities.cs b/src/m-r/Pvo/Pvo.Utilities.cs index 05729ea59..efd19f3ee 100644 --- a/src/m-r/Pvo/Pvo.Utilities.cs +++ b/src/m-r/Pvo/Pvo.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int n = results .ToList() diff --git a/src/m-r/Roc/Roc.Api.cs b/src/m-r/Roc/Roc.Api.cs index f087095af..a6759f4e5 100644 --- a/src/m-r/Roc/Roc.Api.cs +++ b/src/m-r/Roc/Roc.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetRoc( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods) where T : IReusable => results diff --git a/src/m-r/Roc/Roc.Utilities.cs b/src/m-r/Roc/Roc.Utilities.cs index 132642fe7..a16969444 100644 --- a/src/m-r/Roc/Roc.Utilities.cs +++ b/src/m-r/Roc/Roc.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/m-r/RocWb/RocWb.Api.cs b/src/m-r/RocWb/RocWb.Api.cs index a32ec46f0..ed5f5bed1 100644 --- a/src/m-r/RocWb/RocWb.Api.cs +++ b/src/m-r/RocWb/RocWb.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetRocWb( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods, int emaPeriods, int stdDevPeriods) diff --git a/src/m-r/RocWb/RocWb.Utilities.cs b/src/m-r/RocWb/RocWb.Utilities.cs index 60cbc8c64..c2f0321bc 100644 --- a/src/m-r/RocWb/RocWb.Utilities.cs +++ b/src/m-r/RocWb/RocWb.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int n = results .ToList() diff --git a/src/m-r/RollingPivots/RollingPivots.Utilities.cs b/src/m-r/RollingPivots/RollingPivots.Utilities.cs index 420fdd5c7..43ad0a3d7 100644 --- a/src/m-r/RollingPivots/RollingPivots.Utilities.cs +++ b/src/m-r/RollingPivots/RollingPivots.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/m-r/Rsi/Rsi.Api.cs b/src/m-r/Rsi/Rsi.Api.cs index a12cfeea7..85f27accd 100644 --- a/src/m-r/Rsi/Rsi.Api.cs +++ b/src/m-r/Rsi/Rsi.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetRsi( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods = 14) where T : IReusable => results diff --git a/src/m-r/Rsi/Rsi.Utilities.cs b/src/m-r/Rsi/Rsi.Utilities.cs index ed81fd4a4..25ecc15ca 100644 --- a/src/m-r/Rsi/Rsi.Utilities.cs +++ b/src/m-r/Rsi/Rsi.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int n = results .ToList() diff --git a/src/s-z/Slope/Slope.Api.cs b/src/s-z/Slope/Slope.Api.cs index 5b3a7ec7e..1760f9ae2 100644 --- a/src/s-z/Slope/Slope.Api.cs +++ b/src/s-z/Slope/Slope.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetSlope( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods) where T : IReusable => results diff --git a/src/s-z/Slope/Slope.Utilities.cs b/src/s-z/Slope/Slope.Utilities.cs index bbe498ed9..99ce32fd9 100644 --- a/src/s-z/Slope/Slope.Utilities.cs +++ b/src/s-z/Slope/Slope.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/s-z/Sma/Sma.Api.cs b/src/s-z/Sma/Sma.Api.cs index d8b39b6fc..e1eaf6712 100644 --- a/src/s-z/Sma/Sma.Api.cs +++ b/src/s-z/Sma/Sma.Api.cs @@ -4,15 +4,6 @@ namespace Skender.Stock.Indicators; public static partial class Sma { - // SERIES, from CHAIN - public static IReadOnlyList GetSma( - this IEnumerable source, - int lookbackPeriods) - where T : IReusable - => source - .ToSortedList() - .CalcSma(lookbackPeriods); - // OBSERVER, from Chain Provider public static SmaHub ToSma( this IChainProvider chainProvider, diff --git a/src/s-z/Sma/Sma.StaticSeries.cs b/src/s-z/Sma/Sma.StaticSeries.cs index 06de8a4f1..a0b7a5c39 100644 --- a/src/s-z/Sma/Sma.StaticSeries.cs +++ b/src/s-z/Sma/Sma.StaticSeries.cs @@ -4,13 +4,14 @@ namespace Skender.Stock.Indicators; public static partial class Sma { - internal static List CalcSma( - this List source, + public static IReadOnlyList ToSma( + this IReadOnlyList source, int lookbackPeriods) where T : IReusable { // check parameter arguments - Sma.Validate(lookbackPeriods); + ArgumentNullException.ThrowIfNull(source); + Validate(lookbackPeriods); // initialize int length = source.Count; diff --git a/src/s-z/SmaAnalysis/SmaAnalysis.StaticSeries.cs b/src/s-z/SmaAnalysis/SmaAnalysis.StaticSeries.cs index cf9486374..b52cc6c08 100644 --- a/src/s-z/SmaAnalysis/SmaAnalysis.StaticSeries.cs +++ b/src/s-z/SmaAnalysis/SmaAnalysis.StaticSeries.cs @@ -10,7 +10,7 @@ private static List CalcSmaAnalysis( { // initialize List results = source - .CalcSma(lookbackPeriods) + .ToSma(lookbackPeriods) .Select(s => new SmaAnalysis(s.Timestamp, s.Sma)) .ToList(); diff --git a/src/s-z/Smi/Smi.Utilities.cs b/src/s-z/Smi/Smi.Utilities.cs index 77b41759e..3b4b3a5af 100644 --- a/src/s-z/Smi/Smi.Utilities.cs +++ b/src/s-z/Smi/Smi.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/s-z/Smma/Smma.Api.cs b/src/s-z/Smma/Smma.Api.cs index d614d06f9..b792078a9 100644 --- a/src/s-z/Smma/Smma.Api.cs +++ b/src/s-z/Smma/Smma.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetSmma( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods) where T : IReusable => results diff --git a/src/s-z/Smma/Smma.Utilities.cs b/src/s-z/Smma/Smma.Utilities.cs index 5681a3e18..f77205627 100644 --- a/src/s-z/Smma/Smma.Utilities.cs +++ b/src/s-z/Smma/Smma.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int n = results .ToList() diff --git a/src/s-z/StarcBands/StarcBands.StaticSeries.cs b/src/s-z/StarcBands/StarcBands.StaticSeries.cs index 92bb409f2..106f5f753 100644 --- a/src/s-z/StarcBands/StarcBands.StaticSeries.cs +++ b/src/s-z/StarcBands/StarcBands.StaticSeries.cs @@ -17,7 +17,7 @@ private static List CalcStarcBands( int length = source.Count; List results = new(length); List atrResults = source.CalcAtr(atrPeriods); - List smaResults = source.CalcSma(smaPeriods); + IReadOnlyList smaResults = source.ToSma(smaPeriods); // roll through source values for (int i = 0; i < length; i++) @@ -28,8 +28,8 @@ private static List CalcStarcBands( results.Add(new( Timestamp: s.Timestamp, Centerline: s.Sma, - UpperBand: s.Sma + multiplier * a.Atr, - LowerBand: s.Sma - multiplier * a.Atr)); + UpperBand: s.Sma + (multiplier * a.Atr), + LowerBand: s.Sma - (multiplier * a.Atr))); } return results; diff --git a/src/s-z/StarcBands/StarcBands.Utilities.cs b/src/s-z/StarcBands/StarcBands.Utilities.cs index 8eb9c85c1..92e05adc5 100644 --- a/src/s-z/StarcBands/StarcBands.Utilities.cs +++ b/src/s-z/StarcBands/StarcBands.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // CONDENSE (REMOVE null results) - /// + /// public static IReadOnlyList Condense( - this IEnumerable results) + this IReadOnlyList results) { List resultsList = results .ToList(); @@ -18,9 +18,9 @@ public static IReadOnlyList Condense( } // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int n = results .ToList() diff --git a/src/s-z/Stc/Stc.Api.cs b/src/s-z/Stc/Stc.Api.cs index 199a5c519..aa8b638b5 100644 --- a/src/s-z/Stc/Stc.Api.cs +++ b/src/s-z/Stc/Stc.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetStc( - this IEnumerable results, + this IReadOnlyList results, int cyclePeriods = 10, int fastPeriods = 23, int slowPeriods = 50) diff --git a/src/s-z/Stc/Stc.Utilities.cs b/src/s-z/Stc/Stc.Utilities.cs index 96763e7a9..390492324 100644 --- a/src/s-z/Stc/Stc.Utilities.cs +++ b/src/s-z/Stc/Stc.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int n = results .ToList() diff --git a/src/s-z/StdDev/StdDev.Api.cs b/src/s-z/StdDev/StdDev.Api.cs index 3488c082a..6bc98569e 100644 --- a/src/s-z/StdDev/StdDev.Api.cs +++ b/src/s-z/StdDev/StdDev.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetStdDev( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods) where T : IReusable => results diff --git a/src/s-z/StdDev/StdDev.Utilities.cs b/src/s-z/StdDev/StdDev.Utilities.cs index 90648f99b..7f519e639 100644 --- a/src/s-z/StdDev/StdDev.Utilities.cs +++ b/src/s-z/StdDev/StdDev.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/s-z/StdDevChannels/StdDevChannels.Api.cs b/src/s-z/StdDevChannels/StdDevChannels.Api.cs index d063b151b..5557f4274 100644 --- a/src/s-z/StdDevChannels/StdDevChannels.Api.cs +++ b/src/s-z/StdDevChannels/StdDevChannels.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetStdDevChannels( - this IEnumerable results, + this IReadOnlyList results, int? lookbackPeriods = 20, double stdDeviations = 2) where T : IReusable diff --git a/src/s-z/StdDevChannels/StdDevChannels.Utilities.cs b/src/s-z/StdDevChannels/StdDevChannels.Utilities.cs index 881f7381c..228ff78d4 100644 --- a/src/s-z/StdDevChannels/StdDevChannels.Utilities.cs +++ b/src/s-z/StdDevChannels/StdDevChannels.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // CONDENSE (REMOVE null results) - /// + /// public static IReadOnlyList Condense( - this IEnumerable results) + this IReadOnlyList results) { List resultsList = results .ToList(); @@ -21,9 +21,9 @@ x.UpperChannel is null } // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/s-z/Stoch/Stoch.Utilities.cs b/src/s-z/Stoch/Stoch.Utilities.cs index 61df7f848..5b3eb2806 100644 --- a/src/s-z/Stoch/Stoch.Utilities.cs +++ b/src/s-z/Stoch/Stoch.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/s-z/StochRsi/StochRsi.Api.cs b/src/s-z/StochRsi/StochRsi.Api.cs index 83c3985ae..cb0c41945 100644 --- a/src/s-z/StochRsi/StochRsi.Api.cs +++ b/src/s-z/StochRsi/StochRsi.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetStochRsi( - this IEnumerable results, + this IReadOnlyList results, int rsiPeriods, int stochPeriods, int signalPeriods, diff --git a/src/s-z/StochRsi/StochRsi.Utilities.cs b/src/s-z/StochRsi/StochRsi.Utilities.cs index 03ace36c6..00dd324b4 100644 --- a/src/s-z/StochRsi/StochRsi.Utilities.cs +++ b/src/s-z/StochRsi/StochRsi.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int n = results .ToList() diff --git a/src/s-z/SuperTrend/SuperTrend.Utilities.cs b/src/s-z/SuperTrend/SuperTrend.Utilities.cs index 749f35339..d5bf857dc 100644 --- a/src/s-z/SuperTrend/SuperTrend.Utilities.cs +++ b/src/s-z/SuperTrend/SuperTrend.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // CONDENSE (REMOVE null results) - /// + /// public static IReadOnlyList Condense( - this IEnumerable results) + this IReadOnlyList results) { List resultsList = results .ToList(); @@ -18,9 +18,9 @@ public static IReadOnlyList Condense( } // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/s-z/T3/T3.Api.cs b/src/s-z/T3/T3.Api.cs index 610f3008b..fbfb6794d 100644 --- a/src/s-z/T3/T3.Api.cs +++ b/src/s-z/T3/T3.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetT3( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods = 5, double volumeFactor = 0.7) where T : IReusable diff --git a/src/s-z/Tema/Tema.Api.cs b/src/s-z/Tema/Tema.Api.cs index 5cbb96ad7..b3b6f0107 100644 --- a/src/s-z/Tema/Tema.Api.cs +++ b/src/s-z/Tema/Tema.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetTema( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods) where T : IReusable => results diff --git a/src/s-z/Tema/Tema.Utilities.cs b/src/s-z/Tema/Tema.Utilities.cs index 594228578..e0a559dc3 100644 --- a/src/s-z/Tema/Tema.Utilities.cs +++ b/src/s-z/Tema/Tema.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int n = results .ToList() diff --git a/src/s-z/Trix/Trix.Api.cs b/src/s-z/Trix/Trix.Api.cs index a08e53bb5..3b114888d 100644 --- a/src/s-z/Trix/Trix.Api.cs +++ b/src/s-z/Trix/Trix.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetTrix( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods) where T : IReusable => results diff --git a/src/s-z/Trix/Trix.Utilities.cs b/src/s-z/Trix/Trix.Utilities.cs index 97f041a6d..8aeaac921 100644 --- a/src/s-z/Trix/Trix.Utilities.cs +++ b/src/s-z/Trix/Trix.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int n = results .ToList() diff --git a/src/s-z/Tsi/Tsi.Api.cs b/src/s-z/Tsi/Tsi.Api.cs index 029928648..4d688f345 100644 --- a/src/s-z/Tsi/Tsi.Api.cs +++ b/src/s-z/Tsi/Tsi.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetTsi( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods = 25, int smoothPeriods = 13, int signalPeriods = 7) diff --git a/src/s-z/Tsi/Tsi.Utilities.cs b/src/s-z/Tsi/Tsi.Utilities.cs index 04d622781..1d8921bd2 100644 --- a/src/s-z/Tsi/Tsi.Utilities.cs +++ b/src/s-z/Tsi/Tsi.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int nm = results .ToList() diff --git a/src/s-z/UlcerIndex/UlcerIndex.Api.cs b/src/s-z/UlcerIndex/UlcerIndex.Api.cs index ed6fab72a..bb5322f22 100644 --- a/src/s-z/UlcerIndex/UlcerIndex.Api.cs +++ b/src/s-z/UlcerIndex/UlcerIndex.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetUlcerIndex( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods = 14) where T : IReusable => results diff --git a/src/s-z/UlcerIndex/UlcerIndex.Utilities.cs b/src/s-z/UlcerIndex/UlcerIndex.Utilities.cs index da03ac1a7..eb66129de 100644 --- a/src/s-z/UlcerIndex/UlcerIndex.Utilities.cs +++ b/src/s-z/UlcerIndex/UlcerIndex.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/s-z/Ultimate/Ultimate.Utilities.cs b/src/s-z/Ultimate/Ultimate.Utilities.cs index bb1ce4389..187318b1f 100644 --- a/src/s-z/Ultimate/Ultimate.Utilities.cs +++ b/src/s-z/Ultimate/Ultimate.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/s-z/VolatilityStop/VolatilityStop.Utilities.cs b/src/s-z/VolatilityStop/VolatilityStop.Utilities.cs index 6713b93ee..203926f57 100644 --- a/src/s-z/VolatilityStop/VolatilityStop.Utilities.cs +++ b/src/s-z/VolatilityStop/VolatilityStop.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/s-z/Vortex/Vortex.Utilities.cs b/src/s-z/Vortex/Vortex.Utilities.cs index 0b49878f1..db723ca83 100644 --- a/src/s-z/Vortex/Vortex.Utilities.cs +++ b/src/s-z/Vortex/Vortex.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // CONDENSE (REMOVE null results) - /// + /// public static IReadOnlyList Condense( - this IEnumerable results) + this IReadOnlyList results) { List resultsList = results .ToList(); @@ -18,9 +18,9 @@ public static IReadOnlyList Condense( } // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/s-z/Vwap/Vwap.Utilities.cs b/src/s-z/Vwap/Vwap.Utilities.cs index 10c8cc564..1b2de2b61 100644 --- a/src/s-z/Vwap/Vwap.Utilities.cs +++ b/src/s-z/Vwap/Vwap.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/s-z/Vwma/Vwma.Utilities.cs b/src/s-z/Vwma/Vwma.Utilities.cs index aeee25851..dcb253ac3 100644 --- a/src/s-z/Vwma/Vwma.Utilities.cs +++ b/src/s-z/Vwma/Vwma.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/s-z/WilliamsR/WilliamsR.Utilities.cs b/src/s-z/WilliamsR/WilliamsR.Utilities.cs index a7cdaab47..ab1d51037 100644 --- a/src/s-z/WilliamsR/WilliamsR.Utilities.cs +++ b/src/s-z/WilliamsR/WilliamsR.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/s-z/Wma/Wma.Api.cs b/src/s-z/Wma/Wma.Api.cs index f3af400ea..f6d77132d 100644 --- a/src/s-z/Wma/Wma.Api.cs +++ b/src/s-z/Wma/Wma.Api.cs @@ -5,7 +5,7 @@ public static partial class Indicator { // SERIES, from CHAIN public static IReadOnlyList GetWma( - this IEnumerable results, + this IReadOnlyList results, int lookbackPeriods) where T : IReusable => results diff --git a/src/s-z/Wma/Wma.Utilities.cs b/src/s-z/Wma/Wma.Utilities.cs index d9225ffde..44c72b402 100644 --- a/src/s-z/Wma/Wma.Utilities.cs +++ b/src/s-z/Wma/Wma.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // remove recommended periods - /// + /// public static IReadOnlyList RemoveWarmupPeriods( - this IEnumerable results) + this IReadOnlyList results) { int removePeriods = results .ToList() diff --git a/src/s-z/ZigZag/ZigZag.Utilities.cs b/src/s-z/ZigZag/ZigZag.Utilities.cs index c35be15d0..5bd39608a 100644 --- a/src/s-z/ZigZag/ZigZag.Utilities.cs +++ b/src/s-z/ZigZag/ZigZag.Utilities.cs @@ -3,9 +3,9 @@ namespace Skender.Stock.Indicators; public static partial class Indicator { // CONDENSE (REMOVE null results) - /// + /// public static IReadOnlyList Condense( - this IEnumerable results) + this IReadOnlyList results) { List resultsList = results .ToList(); diff --git a/tests/indicators/_common/Observables/StreamHub.Observable.Tests.cs b/tests/indicators/_common/Observables/StreamHub.Observable.Tests.cs index def163d9f..8dcb6f73c 100644 --- a/tests/indicators/_common/Observables/StreamHub.Observable.Tests.cs +++ b/tests/indicators/_common/Observables/StreamHub.Observable.Tests.cs @@ -100,7 +100,7 @@ IReadOnlyList streamList // time-series, for comparison IReadOnlyList seriesList = Quotes .Use(CandlePart.HL2) - .GetEma(11); + .ToEma(11); // assert, should equal series streamList.Should().HaveCount(Quotes.Count); diff --git a/tests/indicators/_common/Quotes/Quote.StreamHub.Tests.cs b/tests/indicators/_common/Quotes/Quote.StreamHub.Tests.cs index c9871b9cc..36dd4ef05 100644 --- a/tests/indicators/_common/Quotes/Quote.StreamHub.Tests.cs +++ b/tests/indicators/_common/Quotes/Quote.StreamHub.Tests.cs @@ -73,7 +73,7 @@ IReadOnlyList streamList // time-series, for comparison IReadOnlyList seriesList = quotesList - .GetSma(smaPeriods); + .ToSma(smaPeriods); // assert, should equal series streamList.Should().HaveCount(length - 1); diff --git a/tests/indicators/_common/Quotes/Quote.Validation.Tests.cs b/tests/indicators/_common/Quotes/Quote.Validation.Tests.cs index 2dcc1d0aa..a4f27eb64 100644 --- a/tests/indicators/_common/Quotes/Quote.Validation.Tests.cs +++ b/tests/indicators/_common/Quotes/Quote.Validation.Tests.cs @@ -48,7 +48,7 @@ public void ValidateCut() Assert.AreEqual(200, h.Count); // should be 20 results and no index corruption - IReadOnlyList r1 = h.TakeLast(20).GetSma(14).ToList(); + IReadOnlyList r1 = h.TakeLast(20).ToList().ToSma(14).ToList(); Assert.AreEqual(20, r1.Count); for (int i = 1; i < r1.Count; i++) @@ -57,7 +57,7 @@ public void ValidateCut() } // should be 50 results and no index corruption - IReadOnlyList r2 = h.TakeLast(50).GetSma(14).ToList(); + IReadOnlyList r2 = h.TakeLast(50).ToList().ToSma(14).ToList(); Assert.AreEqual(50, r2.Count); for (int i = 1; i < r2.Count; i++) diff --git a/tests/indicators/_common/Use (QuotePart)/QuotePart.StaticSeries.Tests.cs b/tests/indicators/_common/Use (QuotePart)/QuotePart.StaticSeries.Tests.cs index 3f879cd3c..720328894 100644 --- a/tests/indicators/_common/Use (QuotePart)/QuotePart.StaticSeries.Tests.cs +++ b/tests/indicators/_common/Use (QuotePart)/QuotePart.StaticSeries.Tests.cs @@ -56,7 +56,7 @@ public void Chainor() { IReadOnlyList results = Quotes .Use(CandlePart.Close) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(493, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/_common/Use (QuotePart)/QuotePart.StreamHub.Tests.cs b/tests/indicators/_common/Use (QuotePart)/QuotePart.StreamHub.Tests.cs index f5b8a1405..4aa893bdb 100644 --- a/tests/indicators/_common/Use (QuotePart)/QuotePart.StreamHub.Tests.cs +++ b/tests/indicators/_common/Use (QuotePart)/QuotePart.StreamHub.Tests.cs @@ -116,7 +116,7 @@ IReadOnlyList streamList IReadOnlyList seriesList = quotesList .Use(candlePart) - .GetSma(smaPeriods); + .ToSma(smaPeriods); // assert, should equal series for (int i = 0; i < length - 1; i++) diff --git a/tests/indicators/a-d/Adl/Adl.StaticSeries.Tests.cs b/tests/indicators/a-d/Adl/Adl.StaticSeries.Tests.cs index 94f245bc7..d336216fa 100644 --- a/tests/indicators/a-d/Adl/Adl.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/Adl/Adl.StaticSeries.Tests.cs @@ -29,7 +29,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetAdl() - .GetSma(10); + .ToSma(10); // assertions diff --git a/tests/indicators/a-d/Adl/Adl.StreamHub.Tests.cs b/tests/indicators/a-d/Adl/Adl.StreamHub.Tests.cs index 4554a8b83..db3ba55b1 100644 --- a/tests/indicators/a-d/Adl/Adl.StreamHub.Tests.cs +++ b/tests/indicators/a-d/Adl/Adl.StreamHub.Tests.cs @@ -103,7 +103,7 @@ IReadOnlyList streamList // time-series, for comparison IReadOnlyList seriesList = quotesList .GetAdl() - .GetSma(smaPeriods); + .ToSma(smaPeriods); // assert, should equal series streamList.Should().HaveCount(length - 1); diff --git a/tests/indicators/a-d/Adx/Adx.StaticSeries.Tests.cs b/tests/indicators/a-d/Adx/Adx.StaticSeries.Tests.cs index fdd6e89c1..fbf8b2a65 100644 --- a/tests/indicators/a-d/Adx/Adx.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/Adx/Adx.StaticSeries.Tests.cs @@ -47,7 +47,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetAdx() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(466, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/a-d/Alligator/Alligator.StaticSeries.Tests.cs b/tests/indicators/a-d/Alligator/Alligator.StaticSeries.Tests.cs index ab84e4578..50399eeb0 100644 --- a/tests/indicators/a-d/Alligator/Alligator.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/Alligator/Alligator.StaticSeries.Tests.cs @@ -46,7 +46,7 @@ public override void Standard() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetAlligator(); Assert.AreEqual(502, results.Count); diff --git a/tests/indicators/a-d/Alligator/Alligator.StreamHub.Tests.cs b/tests/indicators/a-d/Alligator/Alligator.StreamHub.Tests.cs index 5d9ce4f3a..bfe92a4e1 100644 --- a/tests/indicators/a-d/Alligator/Alligator.StreamHub.Tests.cs +++ b/tests/indicators/a-d/Alligator/Alligator.StreamHub.Tests.cs @@ -117,7 +117,7 @@ IReadOnlyList streamList // time-series, for comparison IReadOnlyList seriesList = quotesList - .GetSma(10) + .ToSma(10) .GetAlligator(); // assert, should equal series diff --git a/tests/indicators/a-d/Alma/Alma.StaticSeries.Tests.cs b/tests/indicators/a-d/Alma/Alma.StaticSeries.Tests.cs index 75a77bb66..de8e61331 100644 --- a/tests/indicators/a-d/Alma/Alma.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/Alma/Alma.StaticSeries.Tests.cs @@ -55,7 +55,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetAlma(10); Assert.AreEqual(502, results.Count); @@ -71,7 +71,7 @@ public void Chainor() IReadOnlyList results = Quotes .GetAlma(lookbackPeriods, offset, sigma) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(484, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/a-d/Aroon/Aroon.StaticSeries.Tests.cs b/tests/indicators/a-d/Aroon/Aroon.StaticSeries.Tests.cs index 4a193d5c6..79e77cc5b 100644 --- a/tests/indicators/a-d/Aroon/Aroon.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/Aroon/Aroon.StaticSeries.Tests.cs @@ -47,7 +47,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetAroon() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(468, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/a-d/Atr/Atr.StaticSeries.Tests.cs b/tests/indicators/a-d/Atr/Atr.StaticSeries.Tests.cs index 1fe4b8944..8e7fbab50 100644 --- a/tests/indicators/a-d/Atr/Atr.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/Atr/Atr.StaticSeries.Tests.cs @@ -66,7 +66,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetAtr(10) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(502 - 19, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/a-d/Atr/Atr.StreamHub.Tests.cs b/tests/indicators/a-d/Atr/Atr.StreamHub.Tests.cs index f05843c9a..ba3ca5f7c 100644 --- a/tests/indicators/a-d/Atr/Atr.StreamHub.Tests.cs +++ b/tests/indicators/a-d/Atr/Atr.StreamHub.Tests.cs @@ -103,7 +103,7 @@ IReadOnlyList streamList // time-series, for comparison IReadOnlyList seriesList = quotesList .GetAtr(14) - .GetSma(smaPeriods); + .ToSma(smaPeriods); // assert, should equal series streamList.Should().HaveCount(length - 1); diff --git a/tests/indicators/a-d/Awesome/Awesome.StaticSeries.Tests.cs b/tests/indicators/a-d/Awesome/Awesome.StaticSeries.Tests.cs index e08f291d9..49eab3994 100644 --- a/tests/indicators/a-d/Awesome/Awesome.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/Awesome/Awesome.StaticSeries.Tests.cs @@ -46,7 +46,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetAwesome(); Assert.AreEqual(502, results.Count); @@ -58,7 +58,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetAwesome() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(460, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/a-d/Beta/Beta.StaticSeries.Tests.cs b/tests/indicators/a-d/Beta/Beta.StaticSeries.Tests.cs index 49a660630..cfced403d 100644 --- a/tests/indicators/a-d/Beta/Beta.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/Beta/Beta.StaticSeries.Tests.cs @@ -108,7 +108,7 @@ public void Chainor() { IReadOnlyList results = OtherQuotes .GetBeta(Quotes, 20) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(473, results.Count(x => x.Sma != null)); @@ -118,8 +118,8 @@ public void Chainor() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) - .GetBeta(OtherQuotes.GetSma(2), 20); + .ToSma(2) + .GetBeta(OtherQuotes.ToSma(2), 20); Assert.AreEqual(502, results.Count); Assert.AreEqual(481, results.Count(x => x.Beta != null)); diff --git a/tests/indicators/a-d/BollingerBands/BollingerBands.StaticSeries.Tests.cs b/tests/indicators/a-d/BollingerBands/BollingerBands.StaticSeries.Tests.cs index dac11b87c..b8e028e06 100644 --- a/tests/indicators/a-d/BollingerBands/BollingerBands.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/BollingerBands/BollingerBands.StaticSeries.Tests.cs @@ -51,7 +51,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetBollingerBands(); Assert.AreEqual(502, results.Count); @@ -63,7 +63,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetBollingerBands() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(474, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/a-d/Bop/Bop.StaticSeries.Tests.cs b/tests/indicators/a-d/Bop/Bop.StaticSeries.Tests.cs index b9e1dd932..10ea4d8e9 100644 --- a/tests/indicators/a-d/Bop/Bop.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/Bop/Bop.StaticSeries.Tests.cs @@ -35,7 +35,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetBop() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(480, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/a-d/Cci/Cci.StaticSeries.Tests.cs b/tests/indicators/a-d/Cci/Cci.StaticSeries.Tests.cs index afcacf1fe..2807b47c7 100644 --- a/tests/indicators/a-d/Cci/Cci.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/Cci/Cci.StaticSeries.Tests.cs @@ -23,7 +23,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetCci() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(474, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/a-d/ChaikinOsc/ChaikinOsc.StaticSeries.Tests.cs b/tests/indicators/a-d/ChaikinOsc/ChaikinOsc.StaticSeries.Tests.cs index c55f4df4a..a9cc6474f 100644 --- a/tests/indicators/a-d/ChaikinOsc/ChaikinOsc.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/ChaikinOsc/ChaikinOsc.StaticSeries.Tests.cs @@ -29,7 +29,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetChaikinOsc() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(484, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/a-d/Chandelier/Chandelier.StaticSeries.Tests.cs b/tests/indicators/a-d/Chandelier/Chandelier.StaticSeries.Tests.cs index 8c3de54ec..727f00fdb 100644 --- a/tests/indicators/a-d/Chandelier/Chandelier.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/Chandelier/Chandelier.StaticSeries.Tests.cs @@ -35,7 +35,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetChandelier() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(471, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/a-d/Chop/Chop.StaticSeries.Tests.cs b/tests/indicators/a-d/Chop/Chop.StaticSeries.Tests.cs index 871e0f5d5..5610f776f 100644 --- a/tests/indicators/a-d/Chop/Chop.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/Chop/Chop.StaticSeries.Tests.cs @@ -32,7 +32,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetChop() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(479, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/a-d/Cmf/Cmf.StaticSeries.Tests.cs b/tests/indicators/a-d/Cmf/Cmf.StaticSeries.Tests.cs index e8f3b80b7..30120cfcb 100644 --- a/tests/indicators/a-d/Cmf/Cmf.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/Cmf/Cmf.StaticSeries.Tests.cs @@ -35,7 +35,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetCmf() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(474, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/a-d/Cmo/Cmo.StaticSeries.Tests.cs b/tests/indicators/a-d/Cmo/Cmo.StaticSeries.Tests.cs index cbbef590a..ad5aa350a 100644 --- a/tests/indicators/a-d/Cmo/Cmo.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/Cmo/Cmo.StaticSeries.Tests.cs @@ -42,7 +42,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetCmo(20); Assert.AreEqual(502, results.Count); @@ -54,7 +54,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetCmo(20) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(473, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/a-d/ConnorsRsi/ConnorsRsi.StaticSeries.Tests.cs b/tests/indicators/a-d/ConnorsRsi/ConnorsRsi.StaticSeries.Tests.cs index 6839702c4..5d8bd2bd3 100644 --- a/tests/indicators/a-d/ConnorsRsi/ConnorsRsi.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/ConnorsRsi/ConnorsRsi.StaticSeries.Tests.cs @@ -49,7 +49,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetConnorsRsi(); Assert.AreEqual(502, results.Count); @@ -61,7 +61,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetConnorsRsi() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(392, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/a-d/Correlation/Correlation.StaticSeries.Tests.cs b/tests/indicators/a-d/Correlation/Correlation.StaticSeries.Tests.cs index 7c97e4d1a..3a203c39b 100644 --- a/tests/indicators/a-d/Correlation/Correlation.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/Correlation/Correlation.StaticSeries.Tests.cs @@ -48,7 +48,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetCorrelation(OtherQuotes, 20) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(474, results.Count(x => x.Sma != null)); @@ -58,8 +58,8 @@ public void Chainor() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) - .GetCorrelation(OtherQuotes.GetSma(2), 20); + .ToSma(2) + .GetCorrelation(OtherQuotes.ToSma(2), 20); Assert.AreEqual(502, results.Count); Assert.AreEqual(482, results.Count(x => x.Correlation != null)); diff --git a/tests/indicators/a-d/Dema/Dema.StaticSeries.Tests.cs b/tests/indicators/a-d/Dema/Dema.StaticSeries.Tests.cs index 683f8531f..2ec06a281 100644 --- a/tests/indicators/a-d/Dema/Dema.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/Dema/Dema.StaticSeries.Tests.cs @@ -42,7 +42,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetDema(20); Assert.AreEqual(502, results.Count); @@ -54,7 +54,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetDema(20) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(474, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/a-d/Dpo/Dpo.StaticSeries.Tests.cs b/tests/indicators/a-d/Dpo/Dpo.StaticSeries.Tests.cs index f279d237b..5694b4f84 100644 --- a/tests/indicators/a-d/Dpo/Dpo.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/Dpo/Dpo.StaticSeries.Tests.cs @@ -56,7 +56,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetDpo(14); Assert.AreEqual(502, results.Count); @@ -68,7 +68,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetDpo(14) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(480, results.Count(x => x.Sma is not null and not double.NaN)); diff --git a/tests/indicators/a-d/Dynamic/Dynamic.StaticSeries.Tests.cs b/tests/indicators/a-d/Dynamic/Dynamic.StaticSeries.Tests.cs index 5fbd7b8b6..5baf359bf 100644 --- a/tests/indicators/a-d/Dynamic/Dynamic.StaticSeries.Tests.cs +++ b/tests/indicators/a-d/Dynamic/Dynamic.StaticSeries.Tests.cs @@ -43,7 +43,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(10) + .ToSma(10) .GetDynamic(14); Assert.AreEqual(502, results.Count); @@ -55,7 +55,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetDynamic(14) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(492, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/e-k/ElderRay/ElderRay.StaticSeries.Tests.cs b/tests/indicators/e-k/ElderRay/ElderRay.StaticSeries.Tests.cs index 8bef0f2d7..5f3d300eb 100644 --- a/tests/indicators/e-k/ElderRay/ElderRay.StaticSeries.Tests.cs +++ b/tests/indicators/e-k/ElderRay/ElderRay.StaticSeries.Tests.cs @@ -51,7 +51,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetElderRay() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(481, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/e-k/Ema/Ema.Increments.Tests.cs b/tests/indicators/e-k/Ema/Ema.Increments.Tests.cs index 5e6b5bc4e..b19ce4c69 100644 --- a/tests/indicators/e-k/Ema/Ema.Increments.Tests.cs +++ b/tests/indicators/e-k/Ema/Ema.Increments.Tests.cs @@ -11,8 +11,7 @@ private static readonly IReadOnlyList reusables .ToList(); private static readonly IReadOnlyList series - = Api.GetEma(Quotes -, lookbackPeriods); + = Quotes.ToEma(lookbackPeriods); [TestMethod] public void FromReusableSplit() @@ -65,7 +64,7 @@ public override void FromQuoteBatch() EmaList sut = new(lookbackPeriods) { Quotes }; IReadOnlyList series - = Api.GetEma(Quotes, lookbackPeriods); + = Quotes.ToEma(lookbackPeriods); sut.Should().HaveCount(Quotes.Count); sut.Should().BeEquivalentTo(series); diff --git a/tests/indicators/e-k/Ema/Ema.StaticSeries.Tests.cs b/tests/indicators/e-k/Ema/Ema.StaticSeries.Tests.cs index d17760174..71b1a5d69 100644 --- a/tests/indicators/e-k/Ema/Ema.StaticSeries.Tests.cs +++ b/tests/indicators/e-k/Ema/Ema.StaticSeries.Tests.cs @@ -14,8 +14,7 @@ public void Increment() [TestMethod] public override void Standard() { - IReadOnlyList results = Api.GetEma(Quotes -, 20); + IReadOnlyList results = Quotes.ToEma(20); // proper quantities Assert.AreEqual(502, results.Count); @@ -37,7 +36,7 @@ public void UsePart() { IReadOnlyList results = Quotes .Use(CandlePart.Open) - .GetEma(20); + .ToEma(20); // assertions @@ -62,7 +61,7 @@ public void UseReusable() { IReadOnlyList results = Quotes .Use(CandlePart.Close) - .GetEma(20); + .ToEma(20); Assert.AreEqual(502, results.Count); Assert.AreEqual(483, results.Count(x => x.Ema != null)); @@ -73,8 +72,8 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) - .GetEma(20); + .ToSma(2) + .ToEma(20); Assert.AreEqual(502, results.Count); Assert.AreEqual(482, results.Count(x => x.Ema != null)); @@ -84,9 +83,9 @@ public void Chainee() [TestMethod] public void Chainor() { - IReadOnlyList results = Api.GetEma(Quotes -, 20) - .GetSma(10); + IReadOnlyList results = Quotes + .ToEma(20) + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(474, results.Count(x => x.Sma != null)); @@ -98,7 +97,7 @@ public void ChaineeMore() { IReadOnlyList results = Quotes .GetRsi() - .GetEma(20); + .ToEma(20); // assertions Assert.AreEqual(502, results.Count); @@ -122,8 +121,7 @@ public void ChaineeMore() [TestMethod] public override void BadData() { - IReadOnlyList r = Api.GetEma(BadQuotes -, 15); + IReadOnlyList r = BadQuotes.ToEma(15); Assert.AreEqual(502, r.Count); Assert.AreEqual(0, r.Count(x => x.Ema is double.NaN)); @@ -132,13 +130,11 @@ public override void BadData() [TestMethod] public override void NoQuotes() { - IReadOnlyList r0 = Api.GetEma(Noquotes -, 10); + IReadOnlyList r0 = Noquotes.ToEma(10); Assert.AreEqual(0, r0.Count); - IReadOnlyList r1 = Api.GetEma(Onequote -, 10); + IReadOnlyList r1 = Onequote.ToEma(10); Assert.AreEqual(1, r1.Count); } @@ -146,8 +142,7 @@ public override void NoQuotes() [TestMethod] public void Removed() { - IReadOnlyList results = Api.GetEma(Quotes -, 20) + IReadOnlyList results = Quotes.ToEma(20) .RemoveWarmupPeriods(); // assertions @@ -161,5 +156,5 @@ public void Removed() [TestMethod] public void Exceptions() => Assert.ThrowsException(() - => Api.GetEma(Quotes, 0)); + => Quotes.ToEma(0)); } diff --git a/tests/indicators/e-k/Ema/Ema.StreamHub.Tests.cs b/tests/indicators/e-k/Ema/Ema.StreamHub.Tests.cs index 71f29b64f..5e4e1f2c4 100644 --- a/tests/indicators/e-k/Ema/Ema.StreamHub.Tests.cs +++ b/tests/indicators/e-k/Ema/Ema.StreamHub.Tests.cs @@ -55,8 +55,7 @@ IReadOnlyList streamList quotesList.RemoveAt(400); // time-series, for comparison - IReadOnlyList seriesList = Api.GetEma(quotesList -, 5); + IReadOnlyList seriesList = quotesList.ToEma(5); // assert, should equal series streamList.Should().HaveCount(length - 1); @@ -98,8 +97,8 @@ IReadOnlyList streamList // time-series, for comparison IReadOnlyList seriesList = quotesList - .GetSma(smaPeriods) - .GetEma(emaPeriods); + .ToSma(smaPeriods) + .ToEma(emaPeriods); // assert, should equal series streamList.Should().HaveCount(length); @@ -160,9 +159,8 @@ IReadOnlyList streamList // time-series, for comparison IReadOnlyList seriesList - = Api.GetEma(quotesList -, emaPeriods) - .GetSma(smaPeriods); + = quotesList.ToEma(emaPeriods) + .ToSma(smaPeriods); // assert, should equal series streamList.Should().HaveCount(length - 1); diff --git a/tests/indicators/e-k/Epma/Epma.StaticSeries.Tests.cs b/tests/indicators/e-k/Epma/Epma.StaticSeries.Tests.cs index 98be869cd..d1d8fc1f0 100644 --- a/tests/indicators/e-k/Epma/Epma.StaticSeries.Tests.cs +++ b/tests/indicators/e-k/Epma/Epma.StaticSeries.Tests.cs @@ -45,7 +45,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetEpma(20); Assert.AreEqual(502, results.Count); @@ -57,7 +57,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetEpma(20) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(474, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/e-k/FisherTransform/FisherTransform.StaticSeries.Tests.cs b/tests/indicators/e-k/FisherTransform/FisherTransform.StaticSeries.Tests.cs index 8ed431cb4..c0649936e 100644 --- a/tests/indicators/e-k/FisherTransform/FisherTransform.StaticSeries.Tests.cs +++ b/tests/indicators/e-k/FisherTransform/FisherTransform.StaticSeries.Tests.cs @@ -60,7 +60,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetFisherTransform(); Assert.AreEqual(502, results.Count); @@ -72,7 +72,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetFisherTransform() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(493, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/e-k/ForceIndex/ForceIndex.StaticSeries.Tests.cs b/tests/indicators/e-k/ForceIndex/ForceIndex.StaticSeries.Tests.cs index 48ef7077d..a5d6d6e64 100644 --- a/tests/indicators/e-k/ForceIndex/ForceIndex.StaticSeries.Tests.cs +++ b/tests/indicators/e-k/ForceIndex/ForceIndex.StaticSeries.Tests.cs @@ -27,7 +27,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetForceIndex(13) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(480, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/e-k/Gator/Gator.StaticSeries.Tests.cs b/tests/indicators/e-k/Gator/Gator.StaticSeries.Tests.cs index 7f433e3ab..fff0d1027 100644 --- a/tests/indicators/e-k/Gator/Gator.StaticSeries.Tests.cs +++ b/tests/indicators/e-k/Gator/Gator.StaticSeries.Tests.cs @@ -157,7 +157,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetGator(); Assert.AreEqual(502, results.Count); diff --git a/tests/indicators/e-k/HeikinAshi/HeikinAshi.StaticSeries.Tests.cs b/tests/indicators/e-k/HeikinAshi/HeikinAshi.StaticSeries.Tests.cs index 26e3816dc..0c6e0e1e3 100644 --- a/tests/indicators/e-k/HeikinAshi/HeikinAshi.StaticSeries.Tests.cs +++ b/tests/indicators/e-k/HeikinAshi/HeikinAshi.StaticSeries.Tests.cs @@ -24,8 +24,8 @@ public override void Standard() [TestMethod] public void UseAsQuotes() { - IEnumerable haQuotes = Quotes.GetHeikinAshi(); - IEnumerable haSma = haQuotes.GetSma(5); + IReadOnlyList haQuotes = Quotes.GetHeikinAshi(); + IReadOnlyList haSma = haQuotes.ToSma(5); Assert.AreEqual(498, haSma.Count(x => x.Sma != null)); } diff --git a/tests/indicators/e-k/Hma/Hma.StaticSeries.Tests.cs b/tests/indicators/e-k/Hma/Hma.StaticSeries.Tests.cs index 9bceb5d16..6e196317c 100644 --- a/tests/indicators/e-k/Hma/Hma.StaticSeries.Tests.cs +++ b/tests/indicators/e-k/Hma/Hma.StaticSeries.Tests.cs @@ -36,7 +36,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetHma(19); Assert.AreEqual(502, results.Count); @@ -48,7 +48,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetHma(20) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(471, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/e-k/HtTrendline/HtTrendline.StaticSeries.Tests.cs b/tests/indicators/e-k/HtTrendline/HtTrendline.StaticSeries.Tests.cs index 463b781f3..0e0572559 100644 --- a/tests/indicators/e-k/HtTrendline/HtTrendline.StaticSeries.Tests.cs +++ b/tests/indicators/e-k/HtTrendline/HtTrendline.StaticSeries.Tests.cs @@ -71,7 +71,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetHtTrendline(); Assert.AreEqual(502, results.Count); @@ -83,7 +83,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetHtTrendline() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(493, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/e-k/Hurst/Hurst.StaticSeries.Tests.cs b/tests/indicators/e-k/Hurst/Hurst.StaticSeries.Tests.cs index db69cc2b5..e44dc3060 100644 --- a/tests/indicators/e-k/Hurst/Hurst.StaticSeries.Tests.cs +++ b/tests/indicators/e-k/Hurst/Hurst.StaticSeries.Tests.cs @@ -36,7 +36,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetHurst() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(393, results.Count(x => x.Sma != null)); @@ -46,7 +46,7 @@ public void Chainor() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(10) + .ToSma(10) .GetHurst(); Assert.AreEqual(502, results.Count); diff --git a/tests/indicators/e-k/Kama/Kama.StaticSeries.Tests.cs b/tests/indicators/e-k/Kama/Kama.StaticSeries.Tests.cs index 1a03ba4fd..82f5ba206 100644 --- a/tests/indicators/e-k/Kama/Kama.StaticSeries.Tests.cs +++ b/tests/indicators/e-k/Kama/Kama.StaticSeries.Tests.cs @@ -63,7 +63,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetKama(); Assert.AreEqual(502, results.Count); @@ -75,7 +75,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetKama() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(484, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/e-k/Kvo/Kvo.StaticSeries.Tests.cs b/tests/indicators/e-k/Kvo/Kvo.StaticSeries.Tests.cs index 2f9f24172..d68cce515 100644 --- a/tests/indicators/e-k/Kvo/Kvo.StaticSeries.Tests.cs +++ b/tests/indicators/e-k/Kvo/Kvo.StaticSeries.Tests.cs @@ -49,7 +49,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetKvo() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(437, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/m-r/MaEnvelopes/MaEnvelopes.StaticSeries.Tests.cs b/tests/indicators/m-r/MaEnvelopes/MaEnvelopes.StaticSeries.Tests.cs index de453ae75..5a24b70f5 100644 --- a/tests/indicators/m-r/MaEnvelopes/MaEnvelopes.StaticSeries.Tests.cs +++ b/tests/indicators/m-r/MaEnvelopes/MaEnvelopes.StaticSeries.Tests.cs @@ -251,7 +251,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetMaEnvelopes(10); Assert.AreEqual(502, results.Count); diff --git a/tests/indicators/m-r/Macd/Macd.StaticSeries.Tests.cs b/tests/indicators/m-r/Macd/Macd.StaticSeries.Tests.cs index 1cdcbcfdf..dbceb87eb 100644 --- a/tests/indicators/m-r/Macd/Macd.StaticSeries.Tests.cs +++ b/tests/indicators/m-r/Macd/Macd.StaticSeries.Tests.cs @@ -57,7 +57,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetMacd(); Assert.AreEqual(502, results.Count); @@ -69,7 +69,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetMacd() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(468, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/m-r/Mama/Mama.StaticSeries.Tests.cs b/tests/indicators/m-r/Mama/Mama.StaticSeries.Tests.cs index 2866f9b7d..747029e66 100644 --- a/tests/indicators/m-r/Mama/Mama.StaticSeries.Tests.cs +++ b/tests/indicators/m-r/Mama/Mama.StaticSeries.Tests.cs @@ -61,7 +61,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetMama(); Assert.AreEqual(502, results.Count); @@ -73,7 +73,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetMama() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(488, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/m-r/Mfi/Mfi.StaticSeries.Tests.cs b/tests/indicators/m-r/Mfi/Mfi.StaticSeries.Tests.cs index 34fec7d95..f79332ed8 100644 --- a/tests/indicators/m-r/Mfi/Mfi.StaticSeries.Tests.cs +++ b/tests/indicators/m-r/Mfi/Mfi.StaticSeries.Tests.cs @@ -26,7 +26,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetMfi() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(479, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/m-r/Obv/Obv.StaticSeries.Tests.cs b/tests/indicators/m-r/Obv/Obv.StaticSeries.Tests.cs index b919ed5af..ae62e85c4 100644 --- a/tests/indicators/m-r/Obv/Obv.StaticSeries.Tests.cs +++ b/tests/indicators/m-r/Obv/Obv.StaticSeries.Tests.cs @@ -25,7 +25,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetObv() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(493, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/m-r/ParabolicSar/ParabolicSar.StaticSeries.Tests.cs b/tests/indicators/m-r/ParabolicSar/ParabolicSar.StaticSeries.Tests.cs index b5ed0025d..a5510c360 100644 --- a/tests/indicators/m-r/ParabolicSar/ParabolicSar.StaticSeries.Tests.cs +++ b/tests/indicators/m-r/ParabolicSar/ParabolicSar.StaticSeries.Tests.cs @@ -78,7 +78,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetParabolicSar() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(479, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/m-r/Pmo/Pmo.StaticSeries.Tests.cs b/tests/indicators/m-r/Pmo/Pmo.StaticSeries.Tests.cs index 5b30416d7..0f1d971ac 100644 --- a/tests/indicators/m-r/Pmo/Pmo.StaticSeries.Tests.cs +++ b/tests/indicators/m-r/Pmo/Pmo.StaticSeries.Tests.cs @@ -39,7 +39,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetPmo(); Assert.AreEqual(502, results.Count); @@ -51,7 +51,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetPmo() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(439, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/m-r/Prs/Prs.StaticSeries.Tests.cs b/tests/indicators/m-r/Prs/Prs.StaticSeries.Tests.cs index 3e15b23f6..14a6b43ad 100644 --- a/tests/indicators/m-r/Prs/Prs.StaticSeries.Tests.cs +++ b/tests/indicators/m-r/Prs/Prs.StaticSeries.Tests.cs @@ -45,7 +45,7 @@ public void Chainor() { IReadOnlyList results = OtherQuotes .GetPrs(Quotes, 20) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(493, results.Count(x => x.Sma != null)); @@ -55,8 +55,8 @@ public void Chainor() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) - .GetPrs(OtherQuotes.GetSma(2), 20); + .ToSma(2) + .GetPrs(OtherQuotes.ToSma(2), 20); Assert.AreEqual(502, results.Count); Assert.AreEqual(501, results.Count(x => x.Prs != null)); diff --git a/tests/indicators/m-r/Pvo/Pvo.StaticSeries.Tests.cs b/tests/indicators/m-r/Pvo/Pvo.StaticSeries.Tests.cs index a871a561e..866c40d04 100644 --- a/tests/indicators/m-r/Pvo/Pvo.StaticSeries.Tests.cs +++ b/tests/indicators/m-r/Pvo/Pvo.StaticSeries.Tests.cs @@ -51,7 +51,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetPvo() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(468, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/m-r/Renko/Renko.StaticSeries.Tests.cs b/tests/indicators/m-r/Renko/Renko.StaticSeries.Tests.cs index a0d4c9f52..df8046942 100644 --- a/tests/indicators/m-r/Renko/Renko.StaticSeries.Tests.cs +++ b/tests/indicators/m-r/Renko/Renko.StaticSeries.Tests.cs @@ -107,8 +107,8 @@ public void Atr() [TestMethod] public void UseAsQuotes() { - IEnumerable renkoQuotes = Quotes.GetRenko(2.5m); - IEnumerable renkoSma = renkoQuotes.GetSma(5); + IReadOnlyList renkoQuotes = Quotes.GetRenko(2.5m); + IReadOnlyList renkoSma = renkoQuotes.ToSma(5); Assert.AreEqual(108, renkoSma.Count(x => x.Sma != null)); } diff --git a/tests/indicators/m-r/Renko/Renko.StreamHub.Tests.cs b/tests/indicators/m-r/Renko/Renko.StreamHub.Tests.cs index b0e7832b8..8899267f2 100644 --- a/tests/indicators/m-r/Renko/Renko.StreamHub.Tests.cs +++ b/tests/indicators/m-r/Renko/Renko.StreamHub.Tests.cs @@ -106,7 +106,7 @@ IReadOnlyList streamList // time-series, for comparison IReadOnlyList seriesList = quotesList .GetRenko(brickSize, endType) - .GetSma(smaPeriods); + .ToSma(smaPeriods); // assert, should equal series streamList.Should().BeEquivalentTo(seriesList); diff --git a/tests/indicators/m-r/Roc/Roc.StaticSeries.Tests.cs b/tests/indicators/m-r/Roc/Roc.StaticSeries.Tests.cs index dd8179ad8..a246ab33d 100644 --- a/tests/indicators/m-r/Roc/Roc.StaticSeries.Tests.cs +++ b/tests/indicators/m-r/Roc/Roc.StaticSeries.Tests.cs @@ -43,7 +43,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetRoc(20); Assert.AreEqual(502, results.Count); @@ -55,7 +55,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetRoc(20) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(473, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/m-r/RocWb/RocWb.StaticSeries.Tests.cs b/tests/indicators/m-r/RocWb/RocWb.StaticSeries.Tests.cs index d4838b8bd..584af10ae 100644 --- a/tests/indicators/m-r/RocWb/RocWb.StaticSeries.Tests.cs +++ b/tests/indicators/m-r/RocWb/RocWb.StaticSeries.Tests.cs @@ -81,7 +81,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetRocWb(20, 3, 20); Assert.AreEqual(502, results.Count); @@ -93,7 +93,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetRocWb(20, 3, 20) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(473, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/m-r/Rsi/Rsi.StaticSeries.Tests.cs b/tests/indicators/m-r/Rsi/Rsi.StaticSeries.Tests.cs index 416bf9f88..de79ccff7 100644 --- a/tests/indicators/m-r/Rsi/Rsi.StaticSeries.Tests.cs +++ b/tests/indicators/m-r/Rsi/Rsi.StaticSeries.Tests.cs @@ -49,7 +49,7 @@ public void SmallLookback() [TestMethod] public void CryptoData() { - IEnumerable btc = Data.GetBitcoin(); + IReadOnlyList btc = Data.GetBitcoin(); IReadOnlyList r = btc .GetRsi(1); @@ -72,7 +72,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetRsi(); Assert.AreEqual(502, results.Count); @@ -84,7 +84,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetRsi() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(479, results.Count(x => x.Sma != null)); @@ -131,7 +131,7 @@ public void Removed() .RemoveWarmupPeriods(); // assertions - Assert.AreEqual(502 - 10 * 14, results.Count); + Assert.AreEqual(502 - (10 * 14), results.Count); RsiResult last = results[^1]; Assert.AreEqual(42.0773, last.Rsi.Round(4)); diff --git a/tests/indicators/s-z/Slope/Slope.StaticSeries.Tests.cs b/tests/indicators/s-z/Slope/Slope.StaticSeries.Tests.cs index 60e32f9ab..168aed275 100644 --- a/tests/indicators/s-z/Slope/Slope.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/Slope/Slope.StaticSeries.Tests.cs @@ -53,7 +53,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetSlope(20); Assert.AreEqual(502, results.Count); @@ -65,7 +65,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetSlope(20) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(474, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/s-z/Sma/Sma.StaticSeries.Tests.cs b/tests/indicators/s-z/Sma/Sma.StaticSeries.Tests.cs index 526eea09b..beb01d021 100644 --- a/tests/indicators/s-z/Sma/Sma.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/Sma/Sma.StaticSeries.Tests.cs @@ -7,7 +7,7 @@ public class Sma : StaticSeriesTestBase public override void Standard() { IReadOnlyList results = Quotes - .GetSma(20); + .ToSma(20); // proper quantities Assert.AreEqual(502, results.Count); @@ -27,7 +27,7 @@ public void CandlePartOpen() { IReadOnlyList results = Quotes .Use(CandlePart.Open) - .GetSma(20); + .ToSma(20); Assert.AreEqual(502, results.Count); Assert.AreEqual(483, results.Count(x => x.Sma != null)); @@ -46,7 +46,7 @@ public void CandlePartVolume() { IReadOnlyList results = Quotes .Use(CandlePart.Volume) - .GetSma(20); + .ToSma(20); Assert.AreEqual(502, results.Count); Assert.AreEqual(483, results.Count(x => x.Sma != null)); @@ -67,8 +67,8 @@ public void CandlePartVolume() public void Chainor() { IReadOnlyList results = Quotes - .GetSma(10) - .GetEma(10); + .ToSma(10) + .ToEma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(484, results.Count(x => x.Ema != null)); @@ -78,7 +78,7 @@ public void Chainor() public void NaN() { IReadOnlyList r = Data.GetBtcUsdNan() - .GetSma(50); + .ToSma(50); Assert.AreEqual(0, r.Count(x => x.Sma is double.NaN)); } @@ -87,7 +87,7 @@ public void NaN() public override void BadData() { IReadOnlyList r = BadQuotes - .GetSma(15); + .ToSma(15); Assert.AreEqual(502, r.Count); Assert.AreEqual(0, r.Count(x => x.Sma is double.NaN)); @@ -97,12 +97,12 @@ public override void BadData() public override void NoQuotes() { IReadOnlyList r0 = Noquotes - .GetSma(5); + .ToSma(5); Assert.AreEqual(0, r0.Count); IReadOnlyList r1 = Onequote - .GetSma(5); + .ToSma(5); Assert.AreEqual(1, r1.Count); } @@ -111,7 +111,7 @@ public override void NoQuotes() public void Removed() { IReadOnlyList results = Quotes - .GetSma(20) + .ToSma(20) .RemoveWarmupPeriods(); // assertions @@ -145,5 +145,5 @@ public void Equality() [TestMethod] public void Exceptions() => Assert.ThrowsException(() - => Quotes.GetSma(0)); + => Quotes.ToSma(0)); } diff --git a/tests/indicators/s-z/Sma/Sma.StreamHub.Tests.cs b/tests/indicators/s-z/Sma/Sma.StreamHub.Tests.cs index 8580bbbc4..ff1efc058 100644 --- a/tests/indicators/s-z/Sma/Sma.StreamHub.Tests.cs +++ b/tests/indicators/s-z/Sma/Sma.StreamHub.Tests.cs @@ -57,7 +57,7 @@ IReadOnlyList streamList // time-series, for comparison IReadOnlyList seriesList = quotesList - .GetSma(5); + .ToSma(5); // assert, should equal series streamList.Should().HaveCount(length - 1); @@ -102,7 +102,7 @@ public void ChainObserver() IReadOnlyList seriesList = quotesList .Use(CandlePart.OC2) - .GetSma(11); + .ToSma(11); // assert, should equal series streamList.Should().HaveCount(length); @@ -149,8 +149,8 @@ IReadOnlyList streamList // time-series, for comparison IReadOnlyList seriesList = quotesList - .GetSma(smaPeriods) - .GetEma(emaPeriods); + .ToSma(smaPeriods) + .ToEma(emaPeriods); // assert, should equal series streamList.Should().HaveCount(length - 1); diff --git a/tests/indicators/s-z/SmaAnalysis/SmaAnalysis.StaticSeries.Tests.cs b/tests/indicators/s-z/SmaAnalysis/SmaAnalysis.StaticSeries.Tests.cs index 9da59b2e9..31452ea82 100644 --- a/tests/indicators/s-z/SmaAnalysis/SmaAnalysis.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/SmaAnalysis/SmaAnalysis.StaticSeries.Tests.cs @@ -36,7 +36,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetSmaAnalysis(20); Assert.AreEqual(502, results.Count); @@ -48,7 +48,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetSmaAnalysis(10) - .GetEma(10); + .ToEma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(484, results.Count(x => x.Ema != null)); diff --git a/tests/indicators/s-z/Smi/Smi.StaticSeries.Tests.cs b/tests/indicators/s-z/Smi/Smi.StaticSeries.Tests.cs index c9955776d..46ea3bc3e 100644 --- a/tests/indicators/s-z/Smi/Smi.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/Smi/Smi.StaticSeries.Tests.cs @@ -49,7 +49,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetSmi(14, 20, 5) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(480, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/s-z/Smma/Smma.StaticSeries.Tests.cs b/tests/indicators/s-z/Smma/Smma.StaticSeries.Tests.cs index 49a25790e..aad46502e 100644 --- a/tests/indicators/s-z/Smma/Smma.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/Smma/Smma.StaticSeries.Tests.cs @@ -40,7 +40,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetSmma(20); Assert.AreEqual(502, results.Count); @@ -52,7 +52,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetSmma(20) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(474, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/s-z/Stc/Stc.StaticSeries.Tests.cs b/tests/indicators/s-z/Stc/Stc.StaticSeries.Tests.cs index 287e5d03d..37480617f 100644 --- a/tests/indicators/s-z/Stc/Stc.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/Stc/Stc.StaticSeries.Tests.cs @@ -49,7 +49,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetStc(9, 12, 26); Assert.AreEqual(502, results.Count); @@ -61,7 +61,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetStc(9, 12, 26) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(458, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/s-z/StdDev/StdDev.StaticSeries.Tests.cs b/tests/indicators/s-z/StdDev/StdDev.StaticSeries.Tests.cs index fe2a399e6..ab4eb254e 100644 --- a/tests/indicators/s-z/StdDev/StdDev.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/StdDev/StdDev.StaticSeries.Tests.cs @@ -51,7 +51,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetStdDev(10); Assert.AreEqual(502, results.Count); @@ -63,7 +63,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetStdDev(10) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(484, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/s-z/StdDevChannels/StdDevChannels.StaticSeries.Tests.cs b/tests/indicators/s-z/StdDevChannels/StdDevChannels.StaticSeries.Tests.cs index 26e4f21fc..14b5e5af3 100644 --- a/tests/indicators/s-z/StdDevChannels/StdDevChannels.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/StdDevChannels/StdDevChannels.StaticSeries.Tests.cs @@ -110,7 +110,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetStdDevChannels(); Assert.AreEqual(502, results.Count); diff --git a/tests/indicators/s-z/Stoch/Stoch.StaticSeries.Tests.cs b/tests/indicators/s-z/Stoch/Stoch.StaticSeries.Tests.cs index f871e1a7e..bb5f2cf90 100644 --- a/tests/indicators/s-z/Stoch/Stoch.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/Stoch/Stoch.StaticSeries.Tests.cs @@ -116,7 +116,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetStoch() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(478, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/s-z/StochRsi/StochRsi.StaticSeries.Tests.cs b/tests/indicators/s-z/StochRsi/StochRsi.StaticSeries.Tests.cs index 856009de1..71cdf7289 100644 --- a/tests/indicators/s-z/StochRsi/StochRsi.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/StochRsi/StochRsi.StaticSeries.Tests.cs @@ -91,7 +91,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetStochRsi(14, 14, 3); Assert.AreEqual(502, results.Count); @@ -103,7 +103,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetStochRsi(14, 14, 3, 3) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(464, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/s-z/T3/T3.StaticSeries.Tests.cs b/tests/indicators/s-z/T3/T3.StaticSeries.Tests.cs index 6b90394fc..5b10b3763 100644 --- a/tests/indicators/s-z/T3/T3.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/T3/T3.StaticSeries.Tests.cs @@ -48,7 +48,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetT3(); Assert.AreEqual(502, results.Count); @@ -60,7 +60,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetT3() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); } diff --git a/tests/indicators/s-z/Tema/Tema.StaticSeries.Tests.cs b/tests/indicators/s-z/Tema/Tema.StaticSeries.Tests.cs index a2e2f483c..2878835ae 100644 --- a/tests/indicators/s-z/Tema/Tema.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/Tema/Tema.StaticSeries.Tests.cs @@ -42,7 +42,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetTema(20); Assert.AreEqual(502, results.Count); @@ -54,7 +54,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetTema(20) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(474, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/s-z/Tr/Tr.StreamHub.Tests.cs b/tests/indicators/s-z/Tr/Tr.StreamHub.Tests.cs index 82c802a19..3b94e3cd0 100644 --- a/tests/indicators/s-z/Tr/Tr.StreamHub.Tests.cs +++ b/tests/indicators/s-z/Tr/Tr.StreamHub.Tests.cs @@ -103,7 +103,7 @@ IReadOnlyList streamList // time-series, for comparison IReadOnlyList seriesList = quotesList .GetTr() - .GetSma(smaPeriods); + .ToSma(smaPeriods); // assert, should equal series streamList.Should().HaveCount(length - 1); diff --git a/tests/indicators/s-z/Trix/Trix.StaticSeries.Tests.cs b/tests/indicators/s-z/Trix/Trix.StaticSeries.Tests.cs index da1623b0d..88b041932 100644 --- a/tests/indicators/s-z/Trix/Trix.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/Trix/Trix.StaticSeries.Tests.cs @@ -47,7 +47,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetTrix(20); Assert.AreEqual(502, results.Count); @@ -59,7 +59,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetTrix(20) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(473, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/s-z/Tsi/Tsi.StaticSeries.Tests.cs b/tests/indicators/s-z/Tsi/Tsi.StaticSeries.Tests.cs index 4b13e4f66..1557345d0 100644 --- a/tests/indicators/s-z/Tsi/Tsi.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/Tsi/Tsi.StaticSeries.Tests.cs @@ -55,7 +55,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetTsi(); Assert.AreEqual(502, results.Count); @@ -67,7 +67,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetTsi() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(456, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/s-z/UlcerIndex/UlcerIndex.StaticSeries.Tests.cs b/tests/indicators/s-z/UlcerIndex/UlcerIndex.StaticSeries.Tests.cs index bd37fb6d6..d38b6646b 100644 --- a/tests/indicators/s-z/UlcerIndex/UlcerIndex.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/UlcerIndex/UlcerIndex.StaticSeries.Tests.cs @@ -33,7 +33,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetUlcerIndex(); Assert.AreEqual(502, results.Count); @@ -45,7 +45,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetUlcerIndex() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(480, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/s-z/Ultimate/Ultimate.StaticSeries.Tests.cs b/tests/indicators/s-z/Ultimate/Ultimate.StaticSeries.Tests.cs index 4d1e5532b..e2ab1a19a 100644 --- a/tests/indicators/s-z/Ultimate/Ultimate.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/Ultimate/Ultimate.StaticSeries.Tests.cs @@ -29,7 +29,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetUltimate() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(465, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/s-z/VolatilityStop/VolatilityStop.StaticSeries.Tests.cs b/tests/indicators/s-z/VolatilityStop/VolatilityStop.StaticSeries.Tests.cs index 7cb17f5be..5e5198956 100644 --- a/tests/indicators/s-z/VolatilityStop/VolatilityStop.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/VolatilityStop/VolatilityStop.StaticSeries.Tests.cs @@ -65,7 +65,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetVolatilityStop() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(439, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/s-z/Vwap/Vwap.StaticSeries.Tests.cs b/tests/indicators/s-z/Vwap/Vwap.StaticSeries.Tests.cs index aa31fe8d5..041b4ea1c 100644 --- a/tests/indicators/s-z/Vwap/Vwap.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/Vwap/Vwap.StaticSeries.Tests.cs @@ -62,7 +62,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetVwap() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(493, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/s-z/Vwma/Vwma.StaticSeries.Tests.cs b/tests/indicators/s-z/Vwma/Vwma.StaticSeries.Tests.cs index c3fed2674..8b3e75ec0 100644 --- a/tests/indicators/s-z/Vwma/Vwma.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/Vwma/Vwma.StaticSeries.Tests.cs @@ -29,7 +29,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetVwma(10) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(484, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/s-z/WilliamsR/WilliamsR.StaticSeries.Tests.cs b/tests/indicators/s-z/WilliamsR/WilliamsR.StaticSeries.Tests.cs index 36c855f79..cee2ffdea 100644 --- a/tests/indicators/s-z/WilliamsR/WilliamsR.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/WilliamsR/WilliamsR.StaticSeries.Tests.cs @@ -38,7 +38,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetWilliamsR() - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(480, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/s-z/Wma/Wma.StaticSeries.Tests.cs b/tests/indicators/s-z/Wma/Wma.StaticSeries.Tests.cs index 014820658..adaa328d7 100644 --- a/tests/indicators/s-z/Wma/Wma.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/Wma/Wma.StaticSeries.Tests.cs @@ -36,7 +36,7 @@ public void UseReusable() public void Chainee() { IReadOnlyList results = Quotes - .GetSma(2) + .ToSma(2) .GetWma(20); Assert.AreEqual(502, results.Count); @@ -48,7 +48,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetWma(20) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(474, results.Count(x => x.Sma != null)); diff --git a/tests/indicators/s-z/ZigZag/ZigZag.StaticSeries.Tests.cs b/tests/indicators/s-z/ZigZag/ZigZag.StaticSeries.Tests.cs index abdedebde..0a57b7b76 100644 --- a/tests/indicators/s-z/ZigZag/ZigZag.StaticSeries.Tests.cs +++ b/tests/indicators/s-z/ZigZag/ZigZag.StaticSeries.Tests.cs @@ -112,7 +112,7 @@ public void Chainor() { IReadOnlyList results = Quotes .GetZigZag(EndType.Close, 3) - .GetSma(10); + .ToSma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(225, results.Count(x => x.Sma != null)); diff --git a/tests/other/Convergence.Tests.cs b/tests/other/Convergence.Tests.cs index 2b709899e..232a52a47 100644 --- a/tests/other/Convergence.Tests.cs +++ b/tests/other/Convergence.Tests.cs @@ -105,7 +105,7 @@ public void Ema() foreach (int qty in QuotesQuantities) { IReadOnlyList qts = Data.GetLongish(qty); - IReadOnlyList r = Api.GetEma(qts, 15); + IReadOnlyList r = qts.ToEma(15); EmaResult l = r[^1]; Console.WriteLine($"EMA(15) on {l.Timestamp:d} with {qts.Count,4} periods: {l.Ema:N8}"); diff --git a/tests/other/Custom.Indicator.Tests.cs b/tests/other/Custom.Indicator.Tests.cs index 352e740dd..261064fe7 100644 --- a/tests/other/Custom.Indicator.Tests.cs +++ b/tests/other/Custom.Indicator.Tests.cs @@ -81,7 +81,7 @@ public void Chainor() { IReadOnlyList results = quotes .GetIndicator(10) - .GetEma(10); + .ToEma(10); Assert.AreEqual(502, results.Count); Assert.AreEqual(484, results.Count(x => x.Ema != null)); diff --git a/tests/other/Custom.Quotes.Tests.cs b/tests/other/Custom.Quotes.Tests.cs index 1db53373a..3b50b542d 100644 --- a/tests/other/Custom.Quotes.Tests.cs +++ b/tests/other/Custom.Quotes.Tests.cs @@ -33,8 +33,7 @@ public void CustomQuoteSeries() }) .ToList(); - IReadOnlyList results = Api.GetEma(myGenericHistory -, 20); + IReadOnlyList results = Ema.ToEma(myGenericHistory, 20); // proper quantities Assert.AreEqual(502, results.Count); @@ -160,8 +159,7 @@ public void CustomQuoteInheritedSeries() MyOtherProperty: 123456)) .ToList(); - IReadOnlyList results = Api.GetEma(myGenericHistory -, 20); + IReadOnlyList results = myGenericHistory.ToEma(20); // proper quantities Assert.AreEqual(502, results.Count); diff --git a/tests/other/Custom.Results.Tests.cs b/tests/other/Custom.Results.Tests.cs index f2204ef88..a45bd6264 100644 --- a/tests/other/Custom.Results.Tests.cs +++ b/tests/other/Custom.Results.Tests.cs @@ -29,7 +29,7 @@ public void CustomSeriesClass() [TestMethod] public void CustomSeriesClassLinq() { - IEnumerable emaResults = Api.GetEma(quotes, 14); + IEnumerable emaResults = quotes.ToEma(14); // can use a derive Indicator class using Linq @@ -48,7 +48,7 @@ public void CustomSeriesClassLinq() public void CustomSeriesClassFind() { List emaResults - = Api.GetEma(quotes, 20).ToList(); + = quotes.ToEma(20).ToList(); // can use a derive Indicator class using Linq diff --git a/tests/other/PublicApi.Interface.Tests.cs b/tests/other/PublicApi.Interface.Tests.cs index ae9a96cc0..7e66e061e 100644 --- a/tests/other/PublicApi.Interface.Tests.cs +++ b/tests/other/PublicApi.Interface.Tests.cs @@ -12,31 +12,23 @@ public class UserInterface private static readonly IReadOnlyList quotesBad = Data.GetBad(); [TestMethod] - public void QuoteValidationEnumerable() - { - IEnumerable enumerable = quotes; - - enumerable.Validate(); - enumerable.GetSma(6); - Api.GetEma(enumerable, 5); - - Assert.ThrowsException( - () => quotesBad.Validate()); - } - - [TestMethod] - public void QuoteValidationReadOnlyList() + public void QuoteValidation() { IReadOnlyList clean = quotes; clean.Validate(); - clean.GetSma(6); - Api.GetEma(clean, 5); + clean.ToSma(6); + clean.ToEma(5); IReadOnlyList reverse = quotes .OrderByDescending(x => x.Timestamp) .ToList(); + // has duplicates + Assert.ThrowsException( + () => quotesBad.Validate()); + + // out of order Assert.ThrowsException( () => reverse.Validate()); } @@ -111,9 +103,9 @@ public void StreamMany() // from quote provider IReadOnlyList staticAtr = quotes.GetAtr(); IReadOnlyList staticAtrStop = quotes.GetAtrStop(); IEnumerable staticAlligator = quotes.GetAlligator(); - IEnumerable staticEma = Api.GetEma(quotes, 20); + IEnumerable staticEma = quotes.ToEma(20); IEnumerable staticQuotePart = quotes.Use(CandlePart.OHL3); - IEnumerable staticSma = quotes.GetSma(20); + IEnumerable staticSma = quotes.ToSma(20); IReadOnlyList staticTr = quotes.GetTr(); // final results should persist in scope diff --git a/tests/other/Sut.CustomItems.cs b/tests/other/Sut.CustomItems.cs index 4b051c35a..dcc922fd1 100644 --- a/tests/other/Sut.CustomItems.cs +++ b/tests/other/Sut.CustomItems.cs @@ -80,7 +80,7 @@ public static class CustomIndicator { // SERIES, from CHAIN public static IReadOnlyList GetIndicator( - this IEnumerable source, + this IReadOnlyList source, int lookbackPeriods) where T : IReusable => source diff --git a/tests/performance/Perf.Increments.cs b/tests/performance/Perf.Increments.cs index 348c9c74c..cb4ffdef1 100644 --- a/tests/performance/Perf.Increments.cs +++ b/tests/performance/Perf.Increments.cs @@ -8,10 +8,6 @@ public class Incrementals private static readonly IReadOnlyList quotes = Data.GetDefault(); - private static readonly List quotesList - = quotes - .ToSortedList(); - private static readonly IReadOnlyList reusables = quotes .Cast() @@ -85,18 +81,15 @@ public object EmaIncQot() // TIME-SERIES EQUIVALENTS [Benchmark] - public object EmaSeriesEqiv() => quotesList.CalcEma(14); - - [Benchmark] - public object EmaSeriesOrig() => Api.GetEma(quotes, 14); + public object EmaSeries() => quotes.ToEma(14); [Benchmark] - public object EmaIncremEqiv() + public object EmaIncrem() { - EmaList ema = new(14) { quotes.ToSortedList() }; + EmaList ema = new(14) { quotes }; return ema; } [Benchmark] - public object EmaStreamEqiv() => provider.ToEma(14).Results; + public object EmaStream() => provider.ToEma(14).Results; } diff --git a/tests/performance/Perf.StaticSeries.cs b/tests/performance/Perf.StaticSeries.cs index b3a8aff78..cdecc570e 100644 --- a/tests/performance/Perf.StaticSeries.cs +++ b/tests/performance/Perf.StaticSeries.cs @@ -93,7 +93,7 @@ public class SeriesIndicators public object GetElderRay() => q.GetElderRay(); [Benchmark] - public object GetEma() => Api.GetEma(q, 14); + public object GetEma() => q.ToEma(14); [Benchmark] public object GetEpma() => q.GetEpma(14); @@ -198,7 +198,7 @@ public class SeriesIndicators public object GetSlope() => q.GetSlope(20); [Benchmark] - public object GetSma() => q.GetSma(10); + public object GetSma() => q.ToSma(10); [Benchmark] public object GetSmaAnalysis() => q.GetSmaAnalysis(10); diff --git a/tests/performance/Perf.StreamHub.Externals.cs b/tests/performance/Perf.StreamHub.Externals.cs index c3f258a0c..3a2dd4eb0 100644 --- a/tests/performance/Perf.StreamHub.Externals.cs +++ b/tests/performance/Perf.StreamHub.Externals.cs @@ -35,7 +35,7 @@ public void Cleanup() // TODO: replace with external data cache model, when available [Benchmark(Baseline = true)] - public object EmaSeries() => Api.GetEma(quotes, 14); + public object EmaSeries() => quotes.ToEma(14); [Benchmark] public object EmaStream() => provider.ToEma(14).Results;