@page "/SpotClient"
@inject ICryptoRestClient restClient
ETH-BTC prices:
@foreach(var price in _prices.OrderBy(p => p.Key))
{
@price.Key: @price.Value
}
@code{
private Dictionary _prices = new Dictionary();
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);
}
}
}