Skip to content

Commit

Permalink
Updated examples
Browse files Browse the repository at this point in the history
  • Loading branch information
JKorf committed Mar 25, 2024
1 parent 9e2910d commit f432a66
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 10 deletions.
19 changes: 10 additions & 9 deletions Examples/BlazorClient/BlazorClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Binance.Net" Version="9.5.0" />
<PackageReference Include="Bitfinex.Net" Version="7.1.0" />
<PackageReference Include="Bybit.Net" Version="3.4.0" />
<PackageReference Include="CoinEx.Net" Version="6.1.0" />
<PackageReference Include="Huobi.Net" Version="5.1.0" />
<PackageReference Include="JK.Bitget.Net" Version="1.1.0" />
<PackageReference Include="JK.OKX.Net" Version="1.6.0" />
<PackageReference Include="KrakenExchange.Net" Version="4.3.0" />
<PackageReference Include="Kucoin.Net" Version="5.2.0" />
<PackageReference Include="Binance.Net" Version="9.7.1" />
<PackageReference Include="Bitfinex.Net" Version="7.2.2" />
<PackageReference Include="Bybit.Net" Version="3.7.1" />
<PackageReference Include="CoinEx.Net" Version="6.2.1" />
<PackageReference Include="Huobi.Net" Version="5.2.1" />
<PackageReference Include="JK.BingX.Net" Version="1.0.0" />
<PackageReference Include="JK.Bitget.Net" Version="1.3.1" />
<PackageReference Include="JK.OKX.Net" Version="1.7.1" />
<PackageReference Include="KrakenExchange.Net" Version="4.4.3" />
<PackageReference Include="Kucoin.Net" Version="5.3.2" />
<PackageReference Include="Serilog.AspNetCore" Version="6.0.0" />
</ItemGroup>

Expand Down
7 changes: 6 additions & 1 deletion Examples/BlazorClient/Pages/Index.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@page "/"
@inject IBinanceRestClient binanceClient
@inject IBingXRestClient bingXClient
@inject IBitfinexRestClient bitfinexClient
@inject IBitgetRestClient bitgetClient
@inject IBybitRestClient bybitClient
Expand All @@ -21,6 +22,7 @@
protected override async Task OnInitializedAsync()
{
var binanceTask = binanceClient.SpotApi.ExchangeData.GetTickerAsync("BTCUSDT");
var bingXTask = bingXClient.SpotApi.ExchangeData.GetTickersAsync("BTC-USDT");
var bitfinexTask = bitfinexClient.SpotApi.ExchangeData.GetTickerAsync("tBTCUSD");
var bitgetTask = bitgetClient.SpotApi.ExchangeData.GetTickerAsync("BTCUSDT_SPBL");
var bybitTask = bybitClient.V5Api.ExchangeData.GetSpotTickersAsync("BTCUSDT");
Expand All @@ -30,10 +32,13 @@
var kucoinTask = kucoinClient.SpotApi.ExchangeData.GetTickerAsync("BTC-USDT");
var okxTask = okxClient.UnifiedApi.ExchangeData.GetTickerAsync("BTCUSDT");

await Task.WhenAll(binanceTask, bitfinexTask, bybitTask, coinexTask, huobiTask, krakenTask, kucoinTask);
await Task.WhenAll(binanceTask, bingXTask, bitfinexTask, bybitTask, coinexTask, huobiTask, krakenTask, kucoinTask);

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

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

if (bitfinexTask.Result.Success)
_prices.Add("Bitfinex", bitfinexTask.Result.Data.LastPrice);
Expand Down
2 changes: 2 additions & 0 deletions Examples/BlazorClient/Pages/LiveData.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@page "/LiveData"
@inject IBinanceSocketClient binanceSocketClient
@inject IBingXSocketClient bingXSocketClient
@inject IBitfinexSocketClient bitfinexSocketClient
@inject IBitgetSocketClient bitgetSocketClient
@inject IBybitSocketClient bybitSocketClient
Expand Down Expand Up @@ -29,6 +30,7 @@
var tasks = new Task<CallResult<UpdateSubscription>>[]
{
binanceSocketClient.SpotApi.ExchangeData.SubscribeToTickerUpdatesAsync("ETHBTC", data => UpdateData("Binance", data.Data.LastPrice)),
bingXSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETH-BTC", data => UpdateData("BingX", data.Data.LastPrice)),
bitfinexSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("tETHBTC", data => UpdateData("Bitfinex", data.Data.LastPrice)),
bitgetSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETHBTC", data => UpdateData("Bitget", data.Data.LastPrice)),
bybitSocketClient.V5SpotApi.SubscribeToTickerUpdatesAsync("ETHBTC", data => UpdateData("Bybit", data.Data.LastPrice)),
Expand Down
3 changes: 3 additions & 0 deletions Examples/BlazorClient/Pages/OrderBooks.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@using System.Collections.Concurrent
@using System.Timers
@using Binance.Net.Interfaces
@using BingX.Net.Interfaces
@using Bitfinex.Net.Interfaces
@using Bitget.Net.Interfaces;
@using Bybit.Net.Interfaces
Expand All @@ -13,6 +14,7 @@
@using Kucoin.Net.Interfaces
@using OKX.Net.Interfaces;
@inject IBinanceOrderBookFactory binanceFactory
@inject IBingXOrderBookFactory bingXFactory
@inject IBitfinexOrderBookFactory bitfinexFactory
@inject IBitgetOrderBookFactory bitgetFactory
@inject IBybitOrderBookFactory bybitFactory
Expand Down Expand Up @@ -55,6 +57,7 @@
_books = new Dictionary<string, ISymbolOrderBook>
{
{ "Binance", binanceFactory.CreateSpot("ETHBTC") },
{ "BingX", bingXFactory.CreateSpot("ETH-BTC") },
{ "Bitfinex", bitfinexFactory.Create("tETHBTC") },
{ "Bitget", bitgetFactory.CreateSpot("ETHBTC") },
{ "Bybit", bybitFactory.Create("ETHBTC", Bybit.Net.Enums.Category.Spot) },
Expand Down
1 change: 1 addition & 0 deletions Examples/BlazorClient/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public void ConfigureServices(IServiceCollection services)
socketOptions.ApiCredentials = new ApiCredentials("KEY", "SECRET");
});

services.AddBingX();
services.AddBitfinex();
services.AddBitget();
services.AddBybit();
Expand Down
1 change: 1 addition & 0 deletions Examples/BlazorClient/_Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
@using BlazorClient
@using BlazorClient.Shared
@using Binance.Net.Interfaces.Clients;
@using BingX.Net.Interfaces.Clients;
@using Bitfinex.Net.Interfaces.Clients;
@using Bitget.Net.Interfaces.Clients;
@using Bybit.Net.Interfaces.Clients;
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The following API's are directly supported. Note that there are 3rd party implem
|Exchange|Repository|Nuget|
|--|--|--|
|Binance|[JKorf/Binance.Net](https://github.com/JKorf/Binance.Net)|[![Nuget version](https://img.shields.io/nuget/v/Binance.net.svg?style=flat-square)](https://www.nuget.org/packages/Binance.Net)|
|BingX|[JKorf/BingX.Net](https://github.com/JKorf/BingX.Net)|[![Nuget version](https://img.shields.io/nuget/v/JK.BingX.net.svg?style=flat-square)](https://www.nuget.org/packages/JK.BingX.Net)|
|Bitfinex|[JKorf/Bitfinex.Net](https://github.com/JKorf/Bitfinex.Net)|[![Nuget version](https://img.shields.io/nuget/v/Bitfinex.net.svg?style=flat-square)](https://www.nuget.org/packages/Bitfinex.Net)|
|Bitget|[JKorf/Bitget.Net](https://github.com/JKorf/Bitget.Net)|[![Nuget version](https://img.shields.io/nuget/v/JK.Bitget.net.svg?style=flat-square)](https://www.nuget.org/packages/JK.Bitget.Net)|
|Bybit|[JKorf/Bybit.Net](https://github.com/JKorf/Bybit.Net)|[![Nuget version](https://img.shields.io/nuget/v/Bybit.net.svg?style=flat-square)](https://www.nuget.org/packages/Bybit.Net)|
Expand Down

0 comments on commit f432a66

Please sign in to comment.