Skip to content

Commit

Permalink
add static indicator aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveSkender committed Nov 18, 2024
1 parent 18dccd0 commit 26af67b
Show file tree
Hide file tree
Showing 9 changed files with 740 additions and 19 deletions.
729 changes: 729 additions & 0 deletions src/_common/ObsoleteV3.Indicators.cs

Large diffs are not rendered by default.

9 changes: 1 addition & 8 deletions src/_common/ObsoleteV3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Skender.Stock.Indicators;
// OBSOLETE IN v3
public static partial class Indicator
{
// GENERAL INDICATOR METHODS
// OBSOLETE TUPLE VARIANTS

[ExcludeFromCodeCoverage]
[Obsolete("Use alternate 'ToAlligator' variant. Tuple arguments were removed.", false)] // v3.0.0
Expand All @@ -29,13 +29,6 @@ public static IEnumerable<AlligatorResult> GetAlligator(
teethPeriods, teethOffset,
lipsPeriods, lipsOffset);

[ExcludeFromCodeCoverage]
[Obsolete("Replace `GetEma(..)` with `ToEma(..)`", false)] // v3.0.0
public static IEnumerable<EmaResult> GetEma<TQuote>(
this IReadOnlyList<TQuote> quotes, int lookbackPeriods)
where TQuote : IQuote
=> quotes.ToSortedList().ToEma(lookbackPeriods);

// REMOVAL OF INTEGRATED SMAs (evaluates to ERRORs)

[ExcludeFromCodeCoverage]
Expand Down
2 changes: 1 addition & 1 deletion src/m-r/ParabolicSar/ParabolicSar.StaticSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static IReadOnlyList<ParabolicSarResult> ToParabolicSar<TQuote>(
/// <returns>A list of <see cref="ParabolicSarResult"/> containing the SAR values.</returns>
/// <exception cref="ArgumentNullException">Thrown when the quotes list is null.</exception>
/// <exception cref="ArgumentOutOfRangeException">Thrown when the acceleration step, maximum acceleration factor, or initial factor are out of range.</exception>
public static IReadOnlyList<ParabolicSarResult> GetParabolicSar<TQuote>(
public static IReadOnlyList<ParabolicSarResult> ToParabolicSar<TQuote>(
this IReadOnlyList<TQuote> quotes,
double accelerationStep,
double maxAccelerationFactor,
Expand Down
2 changes: 1 addition & 1 deletion src/m-r/RenkoAtr/RenkoAtr.StaticSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static partial class Renko
/// <param name="atrPeriods">The number of periods for calculating ATR.</param>
/// <param name="endType">The price candle end type to use as the brick threshold.</param>
/// <returns>A list of Renko chart results.</returns>
public static IReadOnlyList<RenkoResult> GetRenkoAtr<TQuote>(
public static IReadOnlyList<RenkoResult> ToRenkoAtr<TQuote>(
this IReadOnlyList<TQuote> quotes,
int atrPeriods,
EndType endType = EndType.Close)
Expand Down
4 changes: 3 additions & 1 deletion src/s-z/StdDevChannels/StdDevChannels.StaticSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ public static partial class StdDevChannels
/// </summary>
/// <typeparam name="T">The type of the quote, which must implement <see cref="IReusable"/>.</typeparam>
/// <param name="source">The source series of quotes.</param>
/// <param name="lookbackPeriods">The number of periods for the lookback. Default is 20.</param>
/// <param name="lookbackPeriods">
/// The number of periods for the lookback. Default is 20.
/// Spans all provided prices when <see langword="null"/>.</param>
/// <param name="stdDeviations">The number of standard deviations for the channel width. Default is 2.</param>
/// <returns>A list of <see cref="StdDevChannelsResult"/> containing the Standard Deviation Channels values.</returns>
public static IReadOnlyList<StdDevChannelsResult> ToStdDevChannels<T>(
Expand Down
2 changes: 1 addition & 1 deletion tests/indicators/e-k/Kvo/Kvo.StaticSeries.Tests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace StaticSeries;

[TestClass]
public class Klinger : StaticSeriesTestBase
public class Kvo : StaticSeriesTestBase
{
[TestMethod]
public override void Standard()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void Extended()
double initialStep = 0.01;

List<ParabolicSarResult> results =
Quotes.GetParabolicSar(
Quotes.ToParabolicSar(
acclerationStep, maxAccelerationFactor, initialStep)
.ToList();

Expand Down Expand Up @@ -110,7 +110,7 @@ public void InsufficientQuotes()
public override void BadData()
{
IReadOnlyList<ParabolicSarResult> r = BadQuotes
.GetParabolicSar(0.2, 0.2, 0.2);
.ToParabolicSar(0.2, 0.2, 0.2);

Assert.AreEqual(502, r.Count);
Assert.AreEqual(0, r.Count(x => x.Sar is double.NaN));
Expand Down Expand Up @@ -165,6 +165,6 @@ public void Exceptions()

// insufficient initial factor
Assert.ThrowsException<ArgumentOutOfRangeException>(
() => Quotes.GetParabolicSar(0.02, 0.5, 0));
() => Quotes.ToParabolicSar(0.02, 0.5, 0));
}
}
2 changes: 1 addition & 1 deletion tests/indicators/m-r/Renko/Renko.StaticSeries.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void StandardHighLow()
public void Atr()
{
IReadOnlyList<RenkoResult> results = Quotes
.GetRenkoAtr(14);
.ToRenkoAtr(14);

// proper quantities
Assert.AreEqual(29, results.Count);
Expand Down
3 changes: 0 additions & 3 deletions tests/performance/Perf.StaticSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ public class SeriesIndicators
[Benchmark]
public object ToKama() => q.ToKama();

[Benchmark]
public object ToKlinger() => q.ToKvo();

[Benchmark]
public object ToKeltner() => q.ToKeltner();

Expand Down

0 comments on commit 26af67b

Please sign in to comment.