mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-08-20 04:42:57 +00:00
Updated example, removed global.json
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
@inject IKucoinClient kucoinClient
|
||||
|
||||
<h3>BTC-USD prices:</h3>
|
||||
@foreach(var price in _prices)
|
||||
@foreach(var price in _prices.OrderBy(p => p.Key))
|
||||
{
|
||||
<div>@price.Key: @price.Value</div>
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
@implements IDisposable
|
||||
|
||||
<h3>ETH-BTC prices, live updates:</h3>
|
||||
@foreach(var price in _prices)
|
||||
@foreach(var price in _prices.OrderBy(p => p.Key))
|
||||
{
|
||||
<div>@price.Key: @price.Value</div>
|
||||
}
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
@using Huobi.Net.SymbolOrderBooks
|
||||
@using Kraken.Net.SymbolOrderBooks
|
||||
@using Kucoin.Net.Clients
|
||||
@using Kucoin.Net.SymbolOrderBook
|
||||
@using Kucoin.Net.SymbolOrderBooks
|
||||
@using System.Collections.Concurrent
|
||||
@using System.Timers
|
||||
@implements IDisposable
|
||||
|
||||
<h3>ETH-BTC books, live updates:</h3>
|
||||
@foreach(var book in _books)
|
||||
@foreach(var book in _books.OrderBy(p => p.Key))
|
||||
{
|
||||
<div style="margin-bottom: 20px;">
|
||||
<h4>@book.Key</h4>
|
||||
@@ -25,7 +25,7 @@
|
||||
{
|
||||
for (var i = 0; i < 3; i++)
|
||||
{
|
||||
<div>@book.Value.Asks.ElementAt(i).Price - @book.Value.Bids.ElementAt(i).Price </div>
|
||||
<div>@book.Value.Bids.ElementAt(i).Price - @book.Value.Asks.ElementAt(i).Price</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
+15
-15
@@ -1,4 +1,4 @@
|
||||
@page "/ExchangeClient"
|
||||
@page "/SpotClient"
|
||||
@inject IBinanceClient binanceClient
|
||||
@inject IBitfinexClient bitfinexClient
|
||||
@inject IBittrexClient bittrexClient
|
||||
@@ -13,34 +13,34 @@
|
||||
@using Bittrex.Net.Clients.SpotApi
|
||||
@using Bybit.Net.Clients.SpotApi
|
||||
@using CoinEx.Net.Clients.SpotApi
|
||||
@using CryptoExchange.Net.ExchangeInterfaces
|
||||
@using CryptoExchange.Net.Interfaces
|
||||
@using FTX.Net.Clients.TradeApi
|
||||
@using Huobi.Net.Clients.SpotApi
|
||||
@using Kraken.Net.Clients.SpotApi
|
||||
@using Kucoin.Net.Clients.SpotApi
|
||||
|
||||
<h3>ETH-BTC prices:</h3>
|
||||
@foreach(var price in _prices)
|
||||
@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>();
|
||||
private Dictionary<string, decimal?> _prices = new Dictionary<string, decimal?>();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var clients = new IExchangeClient[]
|
||||
var clients = new ISpotClient[]
|
||||
{
|
||||
binanceClient.SpotApi.AsExchangeClient(),
|
||||
bitfinexClient.SpotApi.AsExchangeClient(),
|
||||
bittrexClient.SpotApi.AsExchangeClient(),
|
||||
bybitClient.SpotApi.AsExchangeClient(),
|
||||
coinexClient.SpotApi.AsExchangeClient(),
|
||||
ftxClient.TradeApi.AsExchangeClient(),
|
||||
huobiClient.SpotApi.AsExchangeClient(),
|
||||
krakenClient.SpotApi.AsExchangeClient(),
|
||||
kucoinClient.SpotApi.AsExchangeClient()
|
||||
binanceClient.SpotApi.ComonSpotClient,
|
||||
bitfinexClient.SpotApi.ComonSpotClient,
|
||||
bittrexClient.SpotApi.ComonSpotClient,
|
||||
bybitClient.SpotApi.ComonSpotClient,
|
||||
coinexClient.SpotApi.ComonSpotClient,
|
||||
ftxClient.TradeApi.ComonSpotClient,
|
||||
huobiClient.SpotApi.ComonSpotClient,
|
||||
krakenClient.SpotApi.ComonSpotClient,
|
||||
kucoinClient.SpotApi.ComonSpotClient
|
||||
};
|
||||
|
||||
var tasks = clients.Select(c => (c.ExchangeName, c.GetTickerAsync(c.GetSymbolName("ETH", "BTC"))));
|
||||
@@ -49,7 +49,7 @@
|
||||
{
|
||||
if(task.Item2.Result.Success)
|
||||
// TODO new version
|
||||
_prices.Add(task.Item1, task.Item2.Result.Data.CommonHighPrice);
|
||||
_prices.Add(task.Item1, task.Item2.Result.Data.HighPrice);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user