Skip to content

Commit

Permalink
minor static EMA edits
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveSkender committed Oct 10, 2024
1 parent 25ef259 commit 8b02491
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/e-k/Ema/Ema.Api.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ public static partial class Api
{
//SERIES, from CHAIN
public static IReadOnlyList<EmaResult> ToEma<T>(
// FIX: "GetEma" or "ToEma"?
// No longer works as extension method.
// Related to "Api" vs "Ema" namespace.

// FIX: Use "Ema" instead of "Api" class name (fails).

this IEnumerable<T> results,
int lookbackPeriods)
where T : IReusable
Expand Down
4 changes: 2 additions & 2 deletions src/e-k/Ema/Ema.StaticSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ internal static List<EmaResult> CalcEma<T>(
// skip incalculable periods
if (i < lookbackPeriods - 1)
{
results[i] = new(Timestamp: s.Timestamp);
results[i] = new EmaResult(Timestamp: s.Timestamp);
continue;
}

double ema = results[i - 1].Ema is not null
double ema = !double.IsNaN(lastEma)

// calculate EMA (normally)
? Ema.Increment(k, lastEma, s.Value)
Expand Down

0 comments on commit 8b02491

Please sign in to comment.