1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-06-08 00:16:27 +00:00
2024-02-11 16:47:48 +01:00

25 lines
733 B
Plaintext

@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);
}
}
}