-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor demo app to fix analyzer issues
- Loading branch information
Showing
21 changed files
with
384 additions
and
392 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ | |
<p role="alert">Sorry, there's nothing at this address.</p> | ||
</LayoutView> | ||
</NotFound> | ||
</Router> | ||
</Router> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using Microsoft.AspNetCore.Components; | ||
using Microsoft.JSInterop; | ||
using TALib; | ||
|
||
namespace TaTooIne.Demo.DemoIndicators; | ||
|
||
public partial class IndicatorChart | ||
{ | ||
private ElementReference _chartCanvas; | ||
|
||
[Parameter] | ||
public required Function Function { get; set; } | ||
|
||
protected override async Task OnAfterRenderAsync(bool firstRender) | ||
{ | ||
if (firstRender) | ||
{ | ||
await JsRuntime.InvokeVoidAsync("SiteJsInterop.setupChart", _chartCanvas); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Microsoft.AspNetCore.Components; | ||
using TaTooIne.Demo.Models; | ||
|
||
namespace TaTooIne.Demo.DemoIndicators; | ||
|
||
public partial class IndicatorData | ||
{ | ||
[Parameter] | ||
public CalculatedState? State { get; set; } | ||
|
||
private IEnumerable<IEnumerable<Line?>> _transposedState = null!; | ||
|
||
protected override void OnParametersSet() | ||
{ | ||
if (State != null) | ||
{ | ||
_transposedState = Transpose(State.InputValues.Concat(State.OutputValues)); | ||
} | ||
} | ||
|
||
private static IEnumerable<IEnumerable<T?>> Transpose<T>(IEnumerable<IEnumerable<T?>> source) | ||
{ | ||
// ReSharper disable once NotDisposedResourceIsReturned | ||
var enumerators = source.Select(e => e.GetEnumerator()).Where(e => e.MoveNext()).ToList(); | ||
|
||
try | ||
{ | ||
while (enumerators.Count != 0) | ||
{ | ||
yield return enumerators.Select(e => e.Current); | ||
enumerators = enumerators.Where(e => e.MoveNext()).ToList(); | ||
} | ||
} | ||
finally | ||
{ | ||
enumerators.ForEach(e => e.Dispose()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Microsoft.AspNetCore.Components; | ||
using Microsoft.JSInterop; | ||
using TALib; | ||
|
||
namespace TaTooIne.Demo.DemoIndicators; | ||
|
||
public partial class IndicatorsIndex | ||
{ | ||
private bool _navMenuOpened; | ||
private List<IGrouping<string, Function>> _groups = null!; | ||
|
||
private int ActiveGroupId { get; set; } = -1; | ||
|
||
[Parameter] | ||
public EventCallback<Function> OnIndicatorSelect { get; set; } | ||
|
||
protected override void OnInitialized() | ||
{ | ||
_groups = Functions.All.Where(g => g.Group != "Math Transform").GroupBy(f => f.Group).ToList(); | ||
} | ||
|
||
private string? NavMenuCssClass(int groupId) => ActiveGroupId == groupId ? "active" : null; | ||
|
||
private void ToggleActive(int groupId) => ActiveGroupId = ActiveGroupId == groupId ? -1 : groupId; | ||
|
||
private async Task ToggleNavMenuAsync() | ||
{ | ||
_navMenuOpened = !_navMenuOpened; | ||
await JsRuntime.InvokeVoidAsync("SiteJsInterop.collapseNavMenu", _navMenuOpened, "toc"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
using System.Collections.Generic; | ||
namespace TaTooIne.Demo.Models; | ||
|
||
namespace TaTooIne.Demo.Models | ||
public sealed class CalculatedState | ||
{ | ||
public class CalculatedState | ||
{ | ||
public string FuncDescription { get; set; } | ||
public required string FuncDescription { get; init; } | ||
|
||
public IReadOnlyCollection<string> InputNames { get; set; } | ||
public required IReadOnlyCollection<string> InputNames { get; init; } | ||
|
||
public IReadOnlyCollection<string> OutputNames { get; set; } | ||
public required IReadOnlyCollection<string> OutputNames { get; init; } | ||
|
||
public IReadOnlyCollection<IReadOnlyCollection<Line>> InputValues { get; set; } | ||
public required IReadOnlyCollection<IReadOnlyCollection<Line?>> InputValues { get; init; } | ||
|
||
public IReadOnlyCollection<IReadOnlyCollection<Line>> OutputValues { get; set; } | ||
} | ||
} | ||
public required List<List<Line?>> OutputValues { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,16 @@ | ||
using System; | ||
namespace TaTooIne.Demo.Models; | ||
|
||
namespace TaTooIne.Demo.Models | ||
public sealed class Candle | ||
{ | ||
public sealed class Candle | ||
{ | ||
public DateTime Time { get; set; } | ||
public DateTime Time { get; init; } | ||
|
||
public decimal Open { get; set; } | ||
public double Open { get; init; } | ||
|
||
public decimal High { get; set; } | ||
public double High { get; init; } | ||
|
||
public decimal Low { get; set; } | ||
public double Low { get; init; } | ||
|
||
public decimal Close { get; set; } | ||
public double Close { get; init; } | ||
|
||
public decimal Volume { get; set; } | ||
} | ||
public double Volume { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
using System; | ||
using TinyCsvParser.Mapping; | ||
using TinyCsvParser.Mapping; | ||
|
||
namespace TaTooIne.Demo.Models | ||
namespace TaTooIne.Demo.Models; | ||
|
||
public class CandleCsvMapping : CsvMapping<Candle> | ||
{ | ||
public class CandleCsvMapping : CsvMapping<Candle> | ||
public CandleCsvMapping() | ||
{ | ||
public CandleCsvMapping() | ||
{ | ||
MapProperty(0, x => x.Time, new SpecifiedKindDateTimeConverter(DateTimeKind.Utc)); | ||
MapProperty(1, x => x.Open); | ||
MapProperty(2, x => x.High); | ||
MapProperty(3, x => x.Low); | ||
MapProperty(4, x => x.Close); | ||
MapProperty(5, x => x.Volume); | ||
} | ||
MapProperty(0, x => x.Time, new SpecifiedKindDateTimeConverter(DateTimeKind.Utc)); | ||
MapProperty(1, x => x.Open); | ||
MapProperty(2, x => x.High); | ||
MapProperty(3, x => x.Low); | ||
MapProperty(4, x => x.Close); | ||
MapProperty(5, x => x.Volume); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
using System; | ||
namespace TaTooIne.Demo.Models; | ||
|
||
namespace TaTooIne.Demo.Models | ||
public sealed record Line | ||
{ | ||
public sealed class Line | ||
{ | ||
public DateTime Time { get; set; } | ||
public required DateTime Time { get; init; } | ||
|
||
public decimal Value { get; set; } | ||
} | ||
public required double Value { get; init; } | ||
} |
Oops, something went wrong.