@page "/SpotClient"
@inject ICryptoRestClient restClient

<h3>ETH-BTC prices:</h3>
@foreach(var price in _prices.OrderBy(p => p.Key))
{
    <div>@price.Key: @price.Value</div>
}

@code{
    private Dictionary<string, decimal?> _prices = new Dictionary<string, decimal?>();

    protected override async Task OnInitializedAsync()
    {
        var clients = restClient.GetSpotClients();
        var tasks = clients.Select(c => (c.ExchangeName, c.GetTickerAsync(c.GetSymbolName("ETH", "BTC"))));
        await Task.WhenAll(tasks.Select(t => t.Item2));
        foreach(var task in tasks)
        {
            if(task.Item2.Result.Success)
                _prices.Add(task.Item1, task.Item2.Result.Data.HighPrice);
        }
    }

}