Skip to content

Commit

Permalink
Updated docs and examples, added WhiteBit reference
Browse files Browse the repository at this point in the history
  • Loading branch information
JKorf committed Nov 7, 2024
1 parent f2cf70b commit ab02434
Show file tree
Hide file tree
Showing 11 changed files with 411 additions and 63 deletions.
31 changes: 16 additions & 15 deletions Examples/BlazorClient/BlazorClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,23 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Binance.Net" Version="10.8.0" />
<PackageReference Include="Bitfinex.Net" Version="7.9.0" />
<PackageReference Include="BitMart.Net" Version="1.5.0" />
<PackageReference Include="Bybit.Net" Version="3.15.0" />
<PackageReference Include="CoinEx.Net" Version="7.8.0" />
<PackageReference Include="CryptoCom.Net" Version="1.1.0" />
<PackageReference Include="GateIo.Net" Version="1.10.0" />
<PackageReference Include="JK.BingX.Net" Version="1.12.0" />
<PackageReference Include="JK.Bitget.Net" Version="1.11.0" />
<PackageReference Include="JK.Mexc.Net" Version="1.10.0" />
<PackageReference Include="JK.OKX.Net" Version="2.7.0" />
<PackageReference Include="JKorf.Coinbase.Net" Version="1.2.0" />
<PackageReference Include="JKorf.HTX.Net" Version="6.3.0" />
<PackageReference Include="KrakenExchange.Net" Version="5.1.0" />
<PackageReference Include="Kucoin.Net" Version="5.17.0" />
<PackageReference Include="Binance.Net" Version="10.9.0" />
<PackageReference Include="Bitfinex.Net" Version="7.10.0" />
<PackageReference Include="BitMart.Net" Version="1.7.0" />
<PackageReference Include="Bybit.Net" Version="3.16.0" />
<PackageReference Include="CoinEx.Net" Version="7.9.0" />
<PackageReference Include="CryptoCom.Net" Version="1.2.0" />
<PackageReference Include="GateIo.Net" Version="1.12.0" />
<PackageReference Include="JK.BingX.Net" Version="1.14.0" />
<PackageReference Include="JK.Bitget.Net" Version="1.13.0" />
<PackageReference Include="JK.Mexc.Net" Version="1.11.0" />
<PackageReference Include="JK.OKX.Net" Version="2.8.0" />
<PackageReference Include="JKorf.Coinbase.Net" Version="1.4.0" />
<PackageReference Include="JKorf.HTX.Net" Version="6.4.0" />
<PackageReference Include="KrakenExchange.Net" Version="5.2.0" />
<PackageReference Include="Kucoin.Net" Version="5.18.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageReference Include="WhiteBit.Net" Version="1.0.0" />
</ItemGroup>

</Project>
10 changes: 9 additions & 1 deletion Examples/BlazorClient/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
@inject IKucoinRestClient kucoinClient
@inject IMexcRestClient mexcClient
@inject IOKXRestClient okxClient
@inject IWhiteBitRestClient whitebitClient

<h3>BTC-USD prices:</h3>
@foreach(var price in _prices.OrderBy(p => p.Key))
Expand Down Expand Up @@ -41,12 +42,13 @@
var kucoinTask = kucoinClient.SpotApi.ExchangeData.GetTickerAsync("BTC-USDT");
var mexcTask = mexcClient.SpotApi.ExchangeData.GetTickerAsync("BTCUSDT");
var okxTask = okxClient.UnifiedApi.ExchangeData.GetTickerAsync("BTCUSDT");
var whitebitTask = whitebitClient.V4Api.ExchangeData.GetTickersAsync();

await Task.WhenAll(binanceTask, bingXTask, bitfinexTask, bitgetTask, bitmartTask, bybitTask, coinexTask, gateioTask, htxTask, krakenTask, kucoinTask, mexcTask, okxTask);

if (binanceTask.Result.Success)
_prices.Add("Binance", binanceTask.Result.Data.LastPrice);

if (bingXTask.Result.Success)
_prices.Add("BingX", bingXTask.Result.Data.First().LastPrice);

Expand Down Expand Up @@ -88,6 +90,12 @@

if (okxTask.Result.Success)
_prices.Add("OKX", okxTask.Result.Data.LastPrice ?? 0);

if (whitebitTask.Result.Success){
// WhiteBit API doesn't offer an endpoint to filter for a specific ticker, so we have to filter client side
var tickers = whitebitTask.Result.Data;
_prices.Add("WhiteBit", tickers.Single(x => x.Symbol == "BTC_USDT").LastPrice);
}
}

}
2 changes: 2 additions & 0 deletions Examples/BlazorClient/Pages/LiveData.razor
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
@inject IKucoinSocketClient kucoinSocketClient
@inject IMexcSocketClient mexcSocketClient
@inject IOKXSocketClient okxSocketClient
@inject IWhiteBitSocketClient whitebitSocketClient
@using System.Collections.Concurrent
@using CryptoExchange.Net.Objects
@using CryptoExchange.Net.Objects.Sockets;
Expand Down Expand Up @@ -49,6 +50,7 @@
kucoinSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETH-BTC", data => UpdateData("Kucoin", data.Data.LastPrice ?? 0)),
mexcSocketClient.SpotApi.SubscribeToMiniTickerUpdatesAsync("ETHBTC", data => UpdateData("Mexc", data.Data.LastPrice)),
okxSocketClient.UnifiedApi.ExchangeData.SubscribeToTickerUpdatesAsync("ETH-BTC", data => UpdateData("OKX", data.Data.LastPrice ?? 0)),
whitebitSocketClient.V4Api.SubscribeToTickerUpdatesAsync("ETH_BTC", data => UpdateData("WhiteBit", data.Data.Ticker.LastPrice)),
};

await Task.WhenAll(tasks);
Expand Down
5 changes: 4 additions & 1 deletion Examples/BlazorClient/Pages/OrderBooks.razor
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
@using Kucoin.Net.Interfaces
@using Mexc.Net.Interfaces
@using OKX.Net.Interfaces;
@using WhiteBit.Net.Interfaces
@inject IBinanceOrderBookFactory binanceFactory
@inject IBingXOrderBookFactory bingXFactory
@inject IBitfinexOrderBookFactory bitfinexFactory
Expand All @@ -33,6 +34,7 @@
@inject IKucoinOrderBookFactory kucoinFactory
@inject IMexcOrderBookFactory mexcFactory
@inject IOKXOrderBookFactory okxFactory
@inject IWhiteBitOrderBookFactory whitebitFactory
@implements IDisposable

<h3>ETH-BTC books, live updates:</h3>
Expand Down Expand Up @@ -77,10 +79,11 @@
{ "CryptoCom", cryptocomFactory.Create("ETH_BTC") },
{ "GateIo", gateioFactory.CreateSpot("ETH_BTC") },
{ "HTX", htxFactory.CreateSpot("ethbtc") },
{ "Kraken", krakenFactory.CreateSpot("ETH/XBT") },
{ "Kraken", krakenFactory.CreateSpot("ETH/BTC") },
{ "Kucoin", kucoinFactory.CreateSpot("ETH-BTC") },
{ "Mexc", mexcFactory.CreateSpot("ETHBTC") },
{ "OKX", okxFactory.Create("ETH-BTC") },
{ "WhiteBit", whitebitFactory.CreateV4("ETH_BTC") },
};

await Task.WhenAll(_books.Select(b => b.Value.StartAsync()));
Expand Down
3 changes: 3 additions & 0 deletions Examples/BlazorClient/Pages/Trackers.razor
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
@using Kucoin.Net.Interfaces
@using Mexc.Net.Interfaces
@using OKX.Net.Interfaces;
@using WhiteBit.Net.Interfaces
@inject IBinanceTrackerFactory binanceFactory
@inject IBingXTrackerFactory bingXFactory
@inject IBitfinexTrackerFactory bitfinexFactory
Expand All @@ -35,6 +36,7 @@
@inject IKucoinTrackerFactory kucoinFactory
@inject IMexcTrackerFactory mexcFactory
@inject IOKXTrackerFactory okxFactory
@inject IWhiteBitTrackerFactory whitebitFactory
@implements IDisposable

<h3>ETH-BTC trade Trackers, live updates:</h3>
Expand Down Expand Up @@ -76,6 +78,7 @@
{ kucoinFactory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5)) },
{ mexcFactory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5)) },
{ okxFactory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5)) },
{ whitebitFactory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5)) },
};

await Task.WhenAll(_trackers.Select(b => b.StartAsync()));
Expand Down
1 change: 1 addition & 0 deletions Examples/BlazorClient/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public void ConfigureServices(IServiceCollection services)
services.AddKucoin();
services.AddMexc();
services.AddOKX();
services.AddWhiteBit();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
Expand Down
1 change: 1 addition & 0 deletions Examples/BlazorClient/_Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@
@using Kucoin.Net.Interfaces.Clients;
@using Mexc.Net.Interfaces.Clients;
@using OKX.Net.Interfaces.Clients;
@using WhiteBit.Net.Interfaces.Clients
@using CryptoExchange.Net.Interfaces;
28 changes: 14 additions & 14 deletions Examples/ConsoleClient/ConsoleClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Binance.Net" Version="10.8.0" />
<PackageReference Include="Bitfinex.Net" Version="7.9.0" />
<PackageReference Include="BitMart.Net" Version="1.5.0" />
<PackageReference Include="Bybit.Net" Version="3.15.0" />
<PackageReference Include="CoinEx.Net" Version="7.8.0" />
<PackageReference Include="CryptoCom.Net" Version="1.1.0" />
<PackageReference Include="GateIo.Net" Version="1.10.0" />
<PackageReference Include="JK.Bitget.Net" Version="1.11.0" />
<PackageReference Include="JK.Mexc.Net" Version="1.10.0" />
<PackageReference Include="JK.OKX.Net" Version="2.7.0" />
<PackageReference Include="JKorf.Coinbase.Net" Version="1.2.0" />
<PackageReference Include="JKorf.HTX.Net" Version="6.3.0" />
<PackageReference Include="KrakenExchange.Net" Version="5.1.0" />
<PackageReference Include="Kucoin.Net" Version="5.17.0" />
<PackageReference Include="Binance.Net" Version="10.9.0" />
<PackageReference Include="Bitfinex.Net" Version="7.10.0" />
<PackageReference Include="BitMart.Net" Version="1.7.0" />
<PackageReference Include="Bybit.Net" Version="3.16.0" />
<PackageReference Include="CoinEx.Net" Version="7.9.0" />
<PackageReference Include="CryptoCom.Net" Version="1.2.0" />
<PackageReference Include="GateIo.Net" Version="1.12.0" />
<PackageReference Include="JK.Bitget.Net" Version="1.13.0" />
<PackageReference Include="JK.Mexc.Net" Version="1.11.0" />
<PackageReference Include="JK.OKX.Net" Version="2.8.0" />
<PackageReference Include="JKorf.Coinbase.Net" Version="1.4.0" />
<PackageReference Include="JKorf.HTX.Net" Version="6.4.0" />
<PackageReference Include="KrakenExchange.Net" Version="5.2.0" />
<PackageReference Include="Kucoin.Net" Version="5.18.0" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions Examples/SharedClients/SharedClients.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Binance.Net" Version="10.8.0" />
<PackageReference Include="BitMart.Net" Version="1.5.0" />
<PackageReference Include="JK.OKX.Net" Version="2.7.0" />
<PackageReference Include="Binance.Net" Version="10.9.0" />
<PackageReference Include="BitMart.Net" Version="1.7.0" />
<PackageReference Include="JK.OKX.Net" Version="2.8.0" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ The following API's are directly supported. Note that there are 3rd party implem
|Kucoin|[JKorf/Kucoin.Net](https://github.com/JKorf/Kucoin.Net)|[![Nuget version](https://img.shields.io/nuget/v/Kucoin.net.svg?style=flat-square)](https://www.nuget.org/packages/Kucoin.Net)|
|Mexc|[JKorf/Mexc.Net](https://github.com/JKorf/Mexc.Net)|[![Nuget version](https://img.shields.io/nuget/v/JK.Mexc.net.svg?style=flat-square)](https://www.nuget.org/packages/JK.Mexc.Net)|
|OKX|[JKorf/OKX.Net](https://github.com/JKorf/OKX.Net)|[![Nuget version](https://img.shields.io/nuget/v/JK.OKX.net.svg?style=flat-square)](https://www.nuget.org/packages/JK.OKX.Net)|
|WhiteBit|[JKorf/WhiteBit.Net](https://github.com/JKorf/WhiteBit.Net)|[![Nuget version](https://img.shields.io/nuget/v/WhiteBit.net.svg?style=flat-square)](https://www.nuget.org/packages/WhiteBit.Net)|

Any of these can be installed independently or install [CryptoClients.Net](https://github.com/jkorf/CryptoClients.Net) which includes all exchange API's.

Expand Down
Loading

0 comments on commit ab02434

Please sign in to comment.