mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-06 23:46:12 +00:00
25 lines
733 B
Plaintext
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);
|
|
}
|
|
}
|
|
|
|
} |