-
-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
157 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Binance.Net" Version="9.5.0" /> | ||
<PackageReference Include="Bitfinex.Net" Version="7.1.0" /> | ||
<PackageReference Include="Bittrex.Net" Version="8.0.3" /> | ||
<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="10.5.0" /> | ||
<PackageReference Include="Bitfinex.Net" Version="7.8.0" /> | ||
<PackageReference Include="BitMart.Net" Version="1.2.0" /> | ||
<PackageReference Include="Bybit.Net" Version="3.14.0" /> | ||
<PackageReference Include="CoinEx.Net" Version="7.7.0" /> | ||
<PackageReference Include="GateIo.Net" Version="1.6.0" /> | ||
<PackageReference Include="JK.Bitget.Net" Version="1.10.0" /> | ||
<PackageReference Include="JK.Mexc.Net" Version="1.8.0" /> | ||
<PackageReference Include="JK.OKX.Net" Version="2.4.0" /> | ||
<PackageReference Include="JKorf.HTX.Net" Version="6.1.0" /> | ||
<PackageReference Include="KrakenExchange.Net" Version="4.12.0" /> | ||
<PackageReference Include="Kucoin.Net" Version="5.14.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using Binance.Net.Clients; | ||
using BitMart.Net.Clients; | ||
using CryptoExchange.Net.SharedApis; | ||
using OKX.Net.Clients; | ||
|
||
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT"); | ||
var binanceSpotRestClient = new BinanceRestClient().SpotApi.SharedClient; | ||
var okxSpotRestClient = new OKXRestClient().UnifiedApi.SharedClient; | ||
var bitmartSpotRestClient = new BitMartRestClient().SpotApi.SharedClient; | ||
|
||
var binanceSpotSocketClient = new BinanceSocketClient().SpotApi.SharedClient; | ||
var okxSpotSocketClient = new OKXSocketClient().UnifiedApi.SharedClient; | ||
var bitmartSpotSocketClient = new BitMartSocketClient().SpotApi.SharedClient; | ||
|
||
await GetLastTradePriceAsync(binanceSpotRestClient, symbol); | ||
await GetLastTradePriceAsync(okxSpotRestClient, symbol); | ||
await GetLastTradePriceAsync(bitmartSpotRestClient, symbol); | ||
|
||
Console.WriteLine(); | ||
Console.WriteLine("Press enter to start websocket"); | ||
Console.ReadLine(); | ||
|
||
await SubscribeTickerUpdatesAsync(binanceSpotSocketClient, symbol); | ||
await SubscribeTickerUpdatesAsync(okxSpotSocketClient, symbol); | ||
await SubscribeTickerUpdatesAsync(bitmartSpotSocketClient, symbol); | ||
|
||
Console.ReadLine(); | ||
|
||
async Task GetLastTradePriceAsync(ISpotTickerRestClient client, SharedSymbol symbol) | ||
{ | ||
var result = await client.GetSpotTickerAsync(new GetTickerRequest(symbol)); | ||
if (!result.Success) | ||
{ | ||
Console.WriteLine($"Failed to get ticker: {result.Error}"); | ||
return; | ||
} | ||
|
||
Console.WriteLine($"{client.Exchange} {result.Data.Symbol}: {result.Data.LastPrice}"); | ||
} | ||
|
||
async Task SubscribeTickerUpdatesAsync(ITickerSocketClient client, SharedSymbol symbol) | ||
{ | ||
var result = await client.SubscribeToTickerUpdatesAsync(new SubscribeTickerRequest(symbol), update => | ||
{ | ||
Console.WriteLine($"{client.Exchange} {update.Data.Symbol} {update.Data.LastPrice}"); | ||
}); | ||
|
||
if (!result.Success) | ||
Console.WriteLine($"Failed to subscribe ticker: {result.Error}"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Binance.Net" Version="10.5.0" /> | ||
<PackageReference Include="BitMart.Net" Version="1.2.0" /> | ||
<PackageReference Include="JK.OKX.Net" Version="2.4.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |