mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-07 16:06:15 +00:00
Added Coinbase reference, updated examples
This commit is contained in:
parent
613766dbca
commit
4131e563c3
@ -15,6 +15,7 @@
|
||||
<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.Coinbase.Net" Version="1.0.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" />
|
||||
|
@ -5,6 +5,7 @@
|
||||
@inject IBitMartRestClient bitmartClient
|
||||
@inject IBitgetRestClient bitgetClient
|
||||
@inject IBybitRestClient bybitClient
|
||||
@inject ICoinbaseRestClient coinbaseClient
|
||||
@inject ICoinExRestClient coinexClient
|
||||
@inject IGateIoRestClient gateioClient
|
||||
@inject IHTXRestClient huobiClient
|
||||
@ -30,6 +31,7 @@
|
||||
var bitgetTask = bitgetClient.SpotApi.ExchangeData.GetTickerAsync("BTCUSDT_SPBL");
|
||||
var bitmartTask = bitmartClient.SpotApi.ExchangeData.GetTickerAsync("BTC_USDT");
|
||||
var bybitTask = bybitClient.V5Api.ExchangeData.GetSpotTickersAsync("BTCUSDT");
|
||||
var coinbaseTask = coinbaseClient.AdvancedTradeApi.ExchangeData.GetSymbolAsync("BTC-USDT");
|
||||
var coinexTask = coinexClient.SpotApi.ExchangeData.GetTickerAsync("BTCUSDT");
|
||||
var gateioTask = gateioClient.SpotApi.ExchangeData.GetTickersAsync("BTC_USDT");
|
||||
var htxTask = huobiClient.SpotApi.ExchangeData.GetTickerAsync("btcusdt");
|
||||
@ -58,6 +60,9 @@
|
||||
if (bybitTask.Result.Success)
|
||||
_prices.Add("Bybit", bybitTask.Result.Data.List.First().LastPrice);
|
||||
|
||||
if (coinbaseTask.Result.Success)
|
||||
_prices.Add("Coinbase", coinbaseTask.Result.Data.LastPrice ?? 0);
|
||||
|
||||
if (coinexTask.Result.Success)
|
||||
_prices.Add("CoinEx", coinexTask.Result.Data.Ticker.LastPrice);
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
@inject IBitgetSocketClient bitgetSocketClient
|
||||
@inject IBitMartSocketClient bitmartSocketClient
|
||||
@inject IBybitSocketClient bybitSocketClient
|
||||
@inject ICoinbaseSocketClient coinbaseSocketClient
|
||||
@inject ICoinExSocketClient coinExSocketClient
|
||||
@inject IGateIoSocketClient gateioSocketClient
|
||||
@inject IHTXSocketClient htxSocketClient
|
||||
@ -39,6 +40,7 @@
|
||||
bitmartSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETH_BTC", data => UpdateData("BitMart", data.Data.LastPrice)),
|
||||
bybitSocketClient.V5SpotApi.SubscribeToTickerUpdatesAsync("ETHBTC", data => UpdateData("Bybit", data.Data.LastPrice)),
|
||||
coinExSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETHBTC", data => UpdateData("CoinEx", data.Data.LastPrice)),
|
||||
coinbaseSocketClient.AdvancedTradeApi.SubscribeToTickerUpdatesAsync("ETH-BTC", data => UpdateData("Coinbase", data.Data.LastPrice)),
|
||||
gateioSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETH_BTC", data => UpdateData("GateIo", data.Data.LastPrice)),
|
||||
htxSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ethbtc", data => UpdateData("HTX", data.Data.ClosePrice ?? 0)),
|
||||
krakenSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETH/XBT", data => UpdateData("Kraken", data.Data.LastTrade.Price)),
|
||||
|
@ -8,6 +8,7 @@
|
||||
@using BitMart.Net.Interfaces;
|
||||
@using Bybit.Net.Interfaces
|
||||
@using CoinEx.Net.Interfaces
|
||||
@using Coinbase.Net.Interfaces
|
||||
@using CryptoExchange.Net.Interfaces
|
||||
@using GateIo.Net.Interfaces
|
||||
@using HTX.Net.Interfaces
|
||||
@ -22,6 +23,7 @@
|
||||
@inject IBitgetOrderBookFactory bitgetFactory
|
||||
@inject IBitMartOrderBookFactory bitmartFactory
|
||||
@inject IBybitOrderBookFactory bybitFactory
|
||||
@inject ICoinbaseOrderBookFactory coinbaseFactory
|
||||
@inject ICoinExOrderBookFactory coinExFactory
|
||||
@inject IGateIoOrderBookFactory gateioFactory
|
||||
@inject IHTXOrderBookFactory htxFactory
|
||||
@ -68,6 +70,7 @@
|
||||
{ "Bitget", bitgetFactory.CreateSpot("ETHBTC") },
|
||||
{ "BitMart", bitmartFactory.CreateSpot("ETH_BTC", null) },
|
||||
{ "Bybit", bybitFactory.Create("ETHBTC", Bybit.Net.Enums.Category.Spot) },
|
||||
{ "Coinbase", coinbaseFactory.Create("ETH-BTC", null) },
|
||||
{ "CoinEx", coinExFactory.CreateSpot("ETHBTC") },
|
||||
{ "GateIo", gateioFactory.CreateSpot("ETH_BTC") },
|
||||
{ "HTX", htxFactory.CreateSpot("ethbtc") },
|
||||
|
@ -41,6 +41,7 @@ namespace BlazorClient
|
||||
services.AddBitget();
|
||||
services.AddBitMart();
|
||||
services.AddBybit();
|
||||
services.AddCoinbase();
|
||||
services.AddCoinEx();
|
||||
services.AddGateIo();
|
||||
services.AddHTX();
|
||||
|
@ -14,6 +14,7 @@
|
||||
@using Bitget.Net.Interfaces.Clients;
|
||||
@using BitMart.Net.Interfaces.Clients;
|
||||
@using Bybit.Net.Interfaces.Clients;
|
||||
@using Coinbase.Net.Interfaces.Clients;
|
||||
@using CoinEx.Net.Interfaces.Clients;
|
||||
@using GateIo.Net.Interfaces.Clients;
|
||||
@using HTX.Net.Interfaces.Clients;
|
||||
|
@ -15,6 +15,7 @@
|
||||
<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.Coinbase.Net" Version="1.0.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" />
|
||||
|
@ -18,6 +18,7 @@ The following API's are directly supported. Note that there are 3rd party implem
|
||||
|Bitget|[JKorf/Bitget.Net](https://github.com/JKorf/Bitget.Net)|[](https://www.nuget.org/packages/JK.Bitget.Net)|
|
||||
|BitMart|[JKorf/BitMart.Net](https://github.com/JKorf/BitMart.Net)|[](https://www.nuget.org/packages/BitMart.Net)|
|
||||
|Bybit|[JKorf/Bybit.Net](https://github.com/JKorf/Bybit.Net)|[](https://www.nuget.org/packages/Bybit.Net)|
|
||||
|Coinbase|[JKorf/Coinbase.Net](https://github.com/JKorf/Coinbase.Net)|[](https://www.nuget.org/packages/JKorf.Coinbase.Net)|
|
||||
|CoinEx|[JKorf/CoinEx.Net](https://github.com/JKorf/CoinEx.Net)|[](https://www.nuget.org/packages/CoinEx.Net)|
|
||||
|CoinGecko|[JKorf/CoinGecko.Net](https://github.com/JKorf/CoinGecko.Net)|[](https://www.nuget.org/packages/CoinGecko.Net)|
|
||||
|Gate.io|[JKorf/GateIo.Net](https://github.com/JKorf/GateIo.Net)|[](https://www.nuget.org/packages/GateIo.Net)|
|
||||
@ -34,7 +35,7 @@ Any of these can be installed independently or install [CryptoClients.Net](https
|
||||
A Discord server is available [here](https://discord.gg/MSpeEtSY8t). Feel free to join for discussion and/or questions around the CryptoExchange.Net and implementation libraries.
|
||||
|
||||
## Support the project
|
||||
I develop and maintain this package on my own for free in my spare time, any support is greatly appreciated.
|
||||
Any support is greatly appreciated.
|
||||
|
||||
### Donate
|
||||
Make a one time donation in a crypto currency of your choice. If you prefer to donate a currency not listed here please contact me.
|
||||
|
199
docs/index.html
199
docs/index.html
@ -151,6 +151,7 @@
|
||||
<tr><td>Bitget</td><td><a href="https://github.com/JKorf/Bitget.Net">JKorf/Bitget.Net</a></td><td><a href="https://www.nuget.org/packages/JK.Bitget.Net" target="_blank"><img src="https://img.shields.io/nuget/v/JK.Bitget.net.svg?style=flat-square" /></a></td></tr>
|
||||
<tr><td>BitMart</td><td><a href="https://github.com/JKorf/BitMart.Net">JKorf/BitMart.Net</a></td><td><a href="https://www.nuget.org/packages/BitMart.Net" target="_blank"><img src="https://img.shields.io/nuget/v/BitMart.net.svg?style=flat-square" /></a></td></tr>
|
||||
<tr><td>Bybit</td><td><a href="https://github.com/JKorf/Bybit.Net">JKorf/Bybit.Net</a></td><td><a href="https://www.nuget.org/packages/Bybit.Net" target="_blank"><img src="https://img.shields.io/nuget/v/Bybit.net.svg?style=flat-square" /></a></td></tr>
|
||||
<tr><td>Coinbase</td><td><a href="https://github.com/JKorf/Coinbase.Net">JKorf/Coinbase.Net</a></td><td><a href="https://www.nuget.org/packages/JKorf.Coinbase.Net" target="_blank"><img src="https://img.shields.io/nuget/v/JKorf.Coinbase.net.svg?style=flat-square" /></a></td></tr>
|
||||
<tr><td>CoinEx</td><td><a href="https://github.com/JKorf/CoinEx.Net">JKorf/CoinEx.Net</a></td><td><a href="https://www.nuget.org/packages/CoinEx.Net" target="_blank"><img src="https://img.shields.io/nuget/v/CoinEx.net.svg?style=flat-square" /></a></td></tr>
|
||||
<tr><td>CoinGecko</td><td><a href="https://github.com/JKorf/CoinGecko.Net">JKorf/CoinGecko.Net</a></td><td><a href="https://www.nuget.org/packages/CoinGecko.Net" target="_blank"><img src="https://img.shields.io/nuget/v/CoinGecko.net.svg?style=flat-square" /></a></td></tr>
|
||||
<tr><td>Gate.io</td><td><a href="https://github.com/JKorf/GateIo.Net">JKorf/GateIo.Net</a></td><td><a href="https://www.nuget.org/packages/GateIo.Net" target="_blank"><img src="https://img.shields.io/nuget/v/GateIo.net.svg?style=flat-square" /></a></td></tr>
|
||||
@ -240,13 +241,16 @@
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="install-bybit-tab" data-toggle="tab" href="#install-bybit" role="tab" aria-controls="install-bybit" aria-selected="false">Bybit</a>
|
||||
</li>
|
||||
</li
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="install-coingecko-tab" data-toggle="tab" href="#install-coingecko" role="tab" aria-controls="install-coingecko" aria-selected="false">CoinGecko</a>
|
||||
<a class="nav-link" id="install-coinbase-tab" data-toggle="tab" href="#install-coinbase" role="tab" aria-controls="install-coinbase" aria-selected="false">Coinbase</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="install-coinex-tab" data-toggle="tab" href="#install-coinex" role="tab" aria-controls="install-coinex" aria-selected="false">Coinex</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="install-coingecko-tab" data-toggle="tab" href="#install-coingecko" role="tab" aria-controls="install-coingecko" aria-selected="false">CoinGecko</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="install-gateio-tab" data-toggle="tab" href="#install-gateio" role="tab" aria-controls="install-gateio" aria-selected="false">GateIo</a>
|
||||
</li>
|
||||
@ -296,6 +300,9 @@
|
||||
<pre><code>dotnet add package CoinGecko.Net</code></pre>
|
||||
<img src="assets/images/CoinGeckoInstall.png" />
|
||||
</div>
|
||||
<div class="tab-pane fade" id="install-coinbase" role="tabpanel" aria-labelledby="install-coinbase-tab">
|
||||
<pre><code>dotnet add package JKorf.Coinbase.Net</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="install-coinex" role="tabpanel" aria-labelledby="install-coinex-tab">
|
||||
<pre><code>dotnet add package CoinEx.Net</code></pre>
|
||||
<img src="assets/images/CoinExInstall.png" />
|
||||
@ -357,6 +364,9 @@
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="di-bybit-tab" data-toggle="tab" href="#di-bybit" role="tab" aria-controls="di-bybit" aria-selected="false">Bybit</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="di-coinbase-tab" data-toggle="tab" href="#di-coinbase" role="tab" aria-controls="di-coinbase" aria-selected="false">Coinbase</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="di-coingecko-tab" data-toggle="tab" href="#di-coingecko" role="tab" aria-controls="di-coingecko" aria-selected="false">CoinGecko</a>
|
||||
</li>
|
||||
@ -403,6 +413,9 @@
|
||||
</div>
|
||||
<div class="tab-pane fade" id="di-bybit" role="tabpanel" aria-labelledby="di-bybit-tab">
|
||||
<pre><code>builder.Services.AddBybit();</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="di-coinbase" role="tabpanel" aria-labelledby="di-coinbase-tab">
|
||||
<pre><code>builder.Services.AddCoinbase();</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="di-coingecko" role="tabpanel" aria-labelledby="di-coingecko-tab">
|
||||
<pre><code>builder.Services.AddCoinGecko();</code></pre>
|
||||
@ -455,6 +468,9 @@
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="interfaces-bybit-tab" data-toggle="tab" href="#interfaces-bybit" role="tab" aria-controls="interfaces-bybit" aria-selected="false">Bybit</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="interfaces-coinbase-tab" data-toggle="tab" href="#interfaces-coinbase" role="tab" aria-controls="interfaces-coinbase" aria-selected="false">Coinbase</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="interfaces-coingecko-tab" data-toggle="tab" href="#interfaces-coingecko" role="tab" aria-controls="interfaces-coingecko" aria-selected="false">CoinGecko</a>
|
||||
</li>
|
||||
@ -688,6 +704,35 @@
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="interfaces-coinbase" role="tabpanel" aria-labelledby="interfaces-coinbase-tab">
|
||||
<table class="table table-bordered">
|
||||
<tr><th>Interface</th><th>Description</th></tr>
|
||||
<tr>
|
||||
<td><code>ICoinbaseRestClient</code></td>
|
||||
<td>The client for accessing the Coinbase REST API</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>ICoinbaseSocketClient</code></td>
|
||||
<td>The client for accessing the Coinbase Websocket API</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>ICoinbaseOrderBookFactory</code></td>
|
||||
<td>A factory for creating SymbolOrderBook instances for the Coinbase API</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>ICryptoRestClient</code></td>
|
||||
<td>An aggregating client from which multiple different library REST clients can be accessed</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>ICryptoSocketClient</code></td>
|
||||
<td>An aggregating client from which multiple different library Websocket clients can be accessed</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>ISharedClient</code></td>
|
||||
<td>Various interfaces deriving from ISharedClient which can be used for common functionality</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="interfaces-coingecko" role="tabpanel" aria-labelledby="interfaces-coingecko-tab">
|
||||
<table class="table table-bordered">
|
||||
<tr><th>Interface</th><th>Description</th></tr>
|
||||
@ -950,6 +995,9 @@
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="rest-bybit-tab" data-toggle="tab" href="#rest-bybit" role="tab" aria-controls="rest-bybit" aria-selected="false">Bybit</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="rest-coinbase-tab" data-toggle="tab" href="#rest-coinbase" role="tab" aria-controls="rest-coinbase" aria-selected="false">Coinbase</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="rest-coingecko-tab" data-toggle="tab" href="#rest-coingecko" role="tab" aria-controls="rest-coingecko" aria-selected="false">CoinGecko</a>
|
||||
</li>
|
||||
@ -1056,6 +1104,18 @@ if (!tickersResult.Success)
|
||||
// Handle error, tickersResult.Error contains more information
|
||||
}
|
||||
else
|
||||
{
|
||||
// Handle data, tickersResult.Data will contain the actual data
|
||||
}</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="rest-coinbase" role="tabpanel" aria-labelledby="rest-coinbase-tab">
|
||||
<pre><code>var client = new CoinbaseRestClient();
|
||||
var tickersResult = await client.AdvancedTradeApi.ExchangeData.GetSymbolsAsync();
|
||||
if (!tickersResult.Success)
|
||||
{
|
||||
// Handle error, tickersResult.Error contains more information
|
||||
}
|
||||
else
|
||||
{
|
||||
// Handle data, tickersResult.Data will contain the actual data
|
||||
}</code></pre>
|
||||
@ -1251,6 +1311,9 @@ else
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="socket-bybit-tab" data-toggle="tab" href="#socket-bybit" role="tab" aria-controls="socket-bybit" aria-selected="false">Bybit</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="socket-coinbase-tab" data-toggle="tab" href="#socket-coinbase" role="tab" aria-controls="socket-coinbase" aria-selected="false">Coinbase</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="socket-coinex-tab" data-toggle="tab" href="#socket-coinex" role="tab" aria-controls="socket-coinex" aria-selected="false">Coinex</a>
|
||||
</li>
|
||||
@ -1349,6 +1412,17 @@ if (!subscribeResult.Success)
|
||||
{
|
||||
// Handle error, subscribeResult.Error contains more information on why the subscription failed
|
||||
}
|
||||
// Subscribing was successfull, the data will now be streamed into the data handler</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="socket-coinbase" role="tabpanel" aria-labelledby="socket-coinbase-tab">
|
||||
<pre><code>var client = new CoinbaseSocketClient();
|
||||
var subscribeResult = await sclient.AdvancedTradeApi.SubscribeToTickerUpdatesAsync("ETHUSDT", update => {
|
||||
// Handle the data update, update.Data will contain the actual data
|
||||
});
|
||||
if (!subscribeResult.Success)
|
||||
{
|
||||
// Handle error, subscribeResult.Error contains more information on why the subscription failed
|
||||
}
|
||||
// Subscribing was successfull, the data will now be streamed into the data handler</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="socket-coinex" role="tabpanel" aria-labelledby="socket-coinex-tab">
|
||||
@ -1598,6 +1672,9 @@ var binanceTriggered = CheckForTrigger(lastBinanceTicker);</code></pre>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="shared-bybit-tab" data-toggle="tab" href="#shared-bybit" role="tab" aria-controls="shared-bybit" aria-selected="false">Bybit</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="shared-coinbase-tab" data-toggle="tab" href="#shared-coinbase" role="tab" aria-controls="shared-coinbase" aria-selected="false">Coinbase</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="shared-coinex-tab" data-toggle="tab" href="#shared-coinex" role="tab" aria-controls="shared-coinex" aria-selected="false">Coinex</a>
|
||||
</li>
|
||||
@ -1701,6 +1778,13 @@ var inverseFuturesspotSharedSocketClient = bybitSocketClient.V5InverseApi.Shared
|
||||
|
||||
// Private Futures API common functionality socket client
|
||||
var privateFuturesSharedSocketClient = bybitSocketClient.V5PrivateApi.SharedClient;</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="shared-coinbase" role="tabpanel" aria-labelledby="shared-coinbase-tab">
|
||||
<pre><code>// Advanced Trade API common functionality rest client
|
||||
var spotSharedRestClients = coinbaseRestClient.AdvancedTradeApi.SharedClient;
|
||||
|
||||
// Advanced Trade API common functionality socket client
|
||||
var spotSharedSocketClient = coinbaseRestClient.AdvancedTradeApi.SharedClient;</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="shared-coinex" role="tabpanel" aria-labelledby="shared-coinex-tab">
|
||||
<pre><code>// Spot API common functionality rest client
|
||||
@ -2033,6 +2117,9 @@ options.ApiCredentials = new ApiCredentials("YOUR PUBLIC KEY", "YOUR PRIVATE KEY
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="options-bybit-tab" data-toggle="tab" href="#options-bybit" role="tab" aria-controls="options-bybit" aria-selected="false">Bybit</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="options-coinbase-tab" data-toggle="tab" href="#options-coinbase" role="tab" aria-controls="options-coinbase" aria-selected="false">Coinbase</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="options-coingecko-tab" data-toggle="tab" href="#options-coingecko" role="tab" aria-controls="options-coingecko" aria-selected="false">CoinGecko</a>
|
||||
</li>
|
||||
@ -2115,6 +2202,15 @@ options.ApiCredentials = new ApiCredentials("YOUR PUBLIC KEY", "YOUR PRIVATE KEY
|
||||
</div>
|
||||
<div class="tab-pane fade" id="options-bybit" role="tabpanel" aria-labelledby="options-bybit-tab">
|
||||
<pre><code>builder.Services.AddBybit(
|
||||
restOptions => {
|
||||
restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
|
||||
},
|
||||
socketOptions => {
|
||||
socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
|
||||
});</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="options-coinbase" role="tabpanel" aria-labelledby="options-coinbase-tab">
|
||||
<pre><code>builder.Services.AddCoinbase(
|
||||
restOptions => {
|
||||
restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
|
||||
},
|
||||
@ -2219,6 +2315,9 @@ options.ApiCredentials = new ApiCredentials("YOUR PUBLIC KEY", "YOUR PRIVATE KEY
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="options-bybit-tab" data-toggle="tab" href="#options-constr-bybit" role="tab" aria-controls="options-constr-bybit" aria-selected="false">Bybit</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="options-coinbase-tab" data-toggle="tab" href="#options-constr-coinbase" role="tab" aria-controls="options-constr-coinbase" aria-selected="false">Coinbase</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="options-coingecko-tab" data-toggle="tab" href="#options-constr-coingecko" role="tab" aria-controls="options-constr-coingecko" aria-selected="false">CoinGecko</a>
|
||||
</li>
|
||||
@ -2283,6 +2382,12 @@ options.ApiCredentials = new ApiCredentials("YOUR PUBLIC KEY", "YOUR PRIVATE KEY
|
||||
</div>
|
||||
<div class="tab-pane fade" id="options-constr-bybit" role="tabpanel" aria-labelledby="options-bybit-tab">
|
||||
<pre><code>var client = new BybitRestClient(opts =>
|
||||
{
|
||||
opts.RequestTimeout = TimeSpan.FromSeconds(30);
|
||||
});</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="options-constr-coinbase" role="tabpanel" aria-labelledby="options-coinbase-tab">
|
||||
<pre><code>var client = new CoinbaseRestClient(opts =>
|
||||
{
|
||||
opts.RequestTimeout = TimeSpan.FromSeconds(30);
|
||||
});</code></pre>
|
||||
@ -2360,6 +2465,9 @@ options.ApiCredentials = new ApiCredentials("YOUR PUBLIC KEY", "YOUR PRIVATE KEY
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="options-bybit-tab" data-toggle="tab" href="#options-default-bybit" role="tab" aria-controls="options-default-bybit" aria-selected="false">Bybit</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="options-coinbase-tab" data-toggle="tab" href="#options-default-coinbase" role="tab" aria-controls="options-default-coinbase" aria-selected="false">Coinbase</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="options-coingecko-tab" data-toggle="tab" href="#options-default-coingecko" role="tab" aria-controls="options-default-coingecko" aria-selected="false">CoinGecko</a>
|
||||
</li>
|
||||
@ -2427,6 +2535,13 @@ var client = new BitMartRestClient();</code></pre>
|
||||
options.RequestTimeout = TimeSpan.FromSeconds(30);
|
||||
});
|
||||
var client = new BybitRestClient();</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="options-default-coinbase" role="tabpanel" aria-labelledby="options-coinbase-tab">
|
||||
<pre><code>CoinbaseClient.SetDefaultOptions(options =>
|
||||
{
|
||||
options.RequestTimeout = TimeSpan.FromSeconds(30);
|
||||
});
|
||||
var client = new CoinbaseRestClient();</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="options-default-coingecko" role="tabpanel" aria-labelledby="options-coingecko-tab">
|
||||
<pre><code>CoinGeckoRestClient.SetDefaultOptions(options =>
|
||||
@ -2688,6 +2803,9 @@ var client = new OKXRestClient();</code></pre>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="book-bybit-tab" data-toggle="tab" href="#book-bybit" role="tab" aria-controls="book-bybit" aria-selected="false">Bybit</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="book-coinbase-tab" data-toggle="tab" href="#book-coinbase" role="tab" aria-controls="book-coinbase" aria-selected="false">Coinbase</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="book-coinex-tab" data-toggle="tab" href="#book-coinex" role="tab" aria-controls="book-coinex" aria-selected="false">Coinex</a>
|
||||
</li>
|
||||
@ -2799,6 +2917,19 @@ if (!startResult.Success)
|
||||
}
|
||||
// Book has successfully started and synchronized
|
||||
|
||||
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
||||
await book.StopAsync();
|
||||
</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="book-coinbase" role="tabpanel" aria-labelledby="book-coinbase-tab">
|
||||
<pre><code>var book = new CoinbaseSymbolOrderBook("ETH-USDT");
|
||||
var startResult = await book.StartAsync();
|
||||
if (!startResult.Success)
|
||||
{
|
||||
// Handle error, error info available in startResult.Error
|
||||
}
|
||||
// Book has successfully started and synchronized
|
||||
|
||||
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
||||
await book.StopAsync();
|
||||
</code></pre>
|
||||
@ -3069,6 +3200,9 @@ var binanceClient = new BinanceRestClient(new HttpClient(), logFactory, options
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="limit-bitmart-tab" data-toggle="tab" href="#limit-bitmart" role="tab" aria-controls="limit-bitmart" aria-selected="false">BitMart</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="limit-coinbase-tab" data-toggle="tab" href="#limit-coinbase" role="tab" aria-controls="limit-coinbase" aria-selected="false">Coinbase</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="limit-gateio-tab" data-toggle="tab" href="#limit-gateio" role="tab" aria-controls="limit-gateio" aria-selected="false">GateIo</a>
|
||||
</li>
|
||||
@ -3155,6 +3289,20 @@ var binanceClient = new BinanceRestClient(new HttpClient(), logFactory, options
|
||||
<p>To be notified of when a rate limit is hit the static <code>BitMartExchange.RateLimiter</code> exposes an event which triggers when a rate limit is reached</p>
|
||||
<pre><code>BitMartExchange.RateLimiter.RateLimitTriggered += (rateLimitEvent) => Console.WriteLine("Limit triggered: " + rateLimitEvent);
|
||||
|
||||
</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="limit-coinbase" role="tabpanel" aria-labelledby="limit-coinbase-tab">
|
||||
<pre><code>services.AddCoinbase(x =>
|
||||
x.RatelimiterEnabled = true;
|
||||
x.RateLimitingBehaviour = RateLimitingBehaviour.Wait;
|
||||
}, x =>
|
||||
{
|
||||
x.RatelimiterEnabled = true;
|
||||
x.RateLimitingBehaviour = RateLimitingBehaviour.Wait;
|
||||
});</code></pre>
|
||||
<p>To be notified of when a rate limit is hit the static <code>CoinbaseExchange.RateLimiter</code> exposes an event which triggers when a rate limit is reached</p>
|
||||
<pre><code>CoinbaseExchange.RateLimiter.RateLimitTriggered += (rateLimitEvent) => Console.WriteLine("Limit triggered: " + rateLimitEvent);
|
||||
|
||||
</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="limit-gateio" role="tabpanel" aria-labelledby="limit-gateio-tab">
|
||||
@ -3317,6 +3465,9 @@ var responseSource = result.DataSource;</code></pre>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="example-symbols-bybit-tab" data-toggle="tab" href="#example-symbols-bybit" role="tab" aria-controls="example-symbols-bybit" aria-selected="false">Bybit</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="example-symbols-coinbase-tab" data-toggle="tab" href="#example-symbols-coinbase" role="tab" aria-controls="example-symbols-coinbase" aria-selected="false">Coinbase</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="example-symbols-coinex-tab" data-toggle="tab" href="#example-symbols-coinex" role="tab" aria-controls="example-symbols-coinex" aria-selected="false">Coinex</a>
|
||||
</li>
|
||||
@ -3361,6 +3512,9 @@ await exchangeRestClient.Binance.SpotApi.ExchangeData.GetExchangeInfoAsync();</c
|
||||
</div>
|
||||
<div class="tab-pane fade" id="example-symbols-bybit" role="tabpanel" aria-labelledby="example-symbols-bybit-tab">
|
||||
<pre><code>await bybitClient.V5Api.ExchangeData.GetSpotSymbolsAsync();</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="example-symbols-coinbase" role="tabpanel" aria-labelledby="example-symbols-coinbase-tab">
|
||||
<pre><code>await coinbaseClient.AdvancedTradeApi.ExchangeData.GetSymbolsAsync();</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="example-symbols-coinex" role="tabpanel" aria-labelledby="example-symbols-coinex-tab">
|
||||
<pre><code>await coinExClient.SpotApiV2.ExchangeData.GetSymbolsAsync();</code></pre>
|
||||
@ -3422,6 +3576,9 @@ await exchangeRestClient.Binance.SpotApi.ExchangeData.GetExchangeInfoAsync();</c
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="example-ticker-bybit-tab" data-toggle="tab" href="#example-ticker-bybit" role="tab" aria-controls="example-ticker-bybit" aria-selected="false">Bybit</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="example-ticker-coinbase-tab" data-toggle="tab" href="#example-ticker-coinbase" role="tab" aria-controls="example-ticker-coinbase" aria-selected="false">Coinbase</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="example-ticker-coinex-tab" data-toggle="tab" href="#example-ticker-coinex" role="tab" aria-controls="example-ticker-coinex" aria-selected="false">Coinex</a>
|
||||
</li>
|
||||
@ -3466,6 +3623,10 @@ await exchangeRestClient.Binance.SpotApi.ExchangeData.GetTickerAsync(spotClient.
|
||||
</div>
|
||||
<div class="tab-pane fade" id="example-ticker-bybit" role="tabpanel" aria-labelledby="example-ticker-bybit-tab">
|
||||
<pre><code>await bybitClient.V5Api.ExchangeData.GetSpotTickersAsync("BTCUSDT");</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="example-ticker-coinbase" role="tabpanel" aria-labelledby="example-ticker-coinbase-tab">
|
||||
<pre><code>// Symbol endpoint and ticker endpoints are combined for Coinbase
|
||||
await coinbaseClient.AdvancedTradeApi.ExchangeData.GetSymbolAsync("BTC-USDT");</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="example-ticker-coinex" role="tabpanel" aria-labelledby="example-ticker-coinex-tab">
|
||||
<pre><code>await coinExClient.SpotApiV2.ExchangeData.GetTickersAsync(new[] { "BTCUSDT" });</code></pre>
|
||||
@ -3527,6 +3688,9 @@ await exchangeRestClient.Binance.SpotApi.ExchangeData.GetTickerAsync(spotClient.
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="example-balances-bybit-tab" data-toggle="tab" href="#example-balances-bybit" role="tab" aria-controls="example-balances-bybit" aria-selected="false">Bybit</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="example-balances-coinbase-tab" data-toggle="tab" href="#example-balances-coinbase" role="tab" aria-controls="example-balances-coinbase" aria-selected="false">Coinbase</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="example-balances-coinex-tab" data-toggle="tab" href="#example-balances-coinex" role="tab" aria-controls="example-balances-coinex" aria-selected="false">Coinex</a>
|
||||
</li>
|
||||
@ -3571,6 +3735,9 @@ await exchangeRestClient.Binance.SpotApi.Account.GetBalancesAsync();</code></pre
|
||||
</div>
|
||||
<div class="tab-pane fade" id="example-balances-bybit" role="tabpanel" aria-labelledby="example-balances-bybit-tab">
|
||||
<pre><code>await bybitClient.V5Api.Account.GetBalancesAsync(AccountType.Spot);</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="example-balances-coinbase" role="tabpanel" aria-labelledby="example-balances-coinbase-tab">
|
||||
<pre><code>await coinbaseClient.AdvancedTradeApi.Account.GetAccountsAsync();</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="example-balances-coinex" role="tabpanel" aria-labelledby="example-balances-coinex-tab">
|
||||
<pre><code>await coinExClient.SpotApiV2.Account.GetBalancesAsync();</code></pre>
|
||||
@ -3636,6 +3803,9 @@ var result = await htxClient.SpotApi.Account.GetBalancesAsync();</code></pre>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="example-place-bybit-tab" data-toggle="tab" href="#example-place-bybit" role="tab" aria-controls="example-place-bybit" aria-selected="false">Bybit</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="example-place-coinbase-tab" data-toggle="tab" href="#example-place-coinbase" role="tab" aria-controls="example-place-coinbase" aria-selected="false">Coinbase</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="example-place-coinex-tab" data-toggle="tab" href="#example-place-coinex" role="tab" aria-controls="example-place-coinex" aria-selected="false">Coinex</a>
|
||||
</li>
|
||||
@ -3682,6 +3852,9 @@ await exchangeRestClient.Binance.SpotApi.Trading.PlaceOrderAsync("BTCUSDT", Orde
|
||||
<pre><code>await bybitClient.V5Api.Trading.PlaceOrderAsync(Category.Spot, "BTCUSDT", OrderSide.Buy, NewOrderType.Limit, 0.1m, price: 50000);</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="example-place-coinex" role="tabpanel" aria-labelledby="example-place-coinex-tab">
|
||||
<pre><code>await coinbaseClient.AdvancedTradeApi.Trading.PlaceOrderAsync("BTC-USDT", OrderSide.Buy, NewOrderType.Limit, 0.1m, price: 50000);</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="example-place-coinex" role="tabpanel" aria-labelledby="example-place-coinex-tab">
|
||||
<pre><code>await coinExClient.SpotApiV2.Trading.PlaceOrderAsync("BTCUSDT", AccountType.Spot, OrderSide.Buy, OrderTypeV2.Limit, 0.1m, 50000);</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="example-place-gateio" role="tabpanel" aria-labelledby="example-place-gateio-tab">
|
||||
@ -3745,6 +3918,9 @@ var result = await htxClient.SpotApi.Trading.PlaceOrderAsync(account.Id, "BTCUSD
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="example-stream-ticker-bybit-tab" data-toggle="tab" href="#example-stream-ticker-bybit" role="tab" aria-controls="example-stream-ticker-bybit" aria-selected="false">Bybit</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="example-stream-ticker-coinbase-tab" data-toggle="tab" href="#example-stream-ticker-coinbase" role="tab" aria-controls="example-stream-ticker-coinbase" aria-selected="false">Coinbase</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="example-stream-ticker-coinex-tab" data-toggle="tab" href="#example-stream-ticker-coinex" role="tab" aria-controls="example-stream-ticker-coinex" aria-selected="false">Coinex</a>
|
||||
</li>
|
||||
@ -3802,6 +3978,11 @@ await exchangeSocketClient.Binance.SpotApi.ExchangeData.SubscribeToTickerUpdates
|
||||
<div class="tab-pane fade" id="example-stream-ticker-bybit" role="tabpanel" aria-labelledby="example-stream-ticker-bybit-tab">
|
||||
<pre><code>await bybitSocketClient.V5SpotApi.SubscribeToTickerUpdatesAsync("ETHUSDT", data => {
|
||||
// Handle update
|
||||
});</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="example-stream-ticker-coinbase" role="tabpanel" aria-labelledby="example-stream-ticker-coinbase-tab">
|
||||
<pre><code>await coinbaseSocketClient.AdvancedTradeApi.SubscribeToTickerUpdatesAsync("ETH-USDT", data => {
|
||||
// Handle update
|
||||
});</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="example-stream-ticker-coinex" role="tabpanel" aria-labelledby="example-stream-ticker-coinex-tab">
|
||||
@ -3879,6 +4060,9 @@ await exchangeSocketClient.Binance.SpotApi.ExchangeData.SubscribeToTickerUpdates
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="example-stream-order-bybit-tab" data-toggle="tab" href="#example-stream-order-bybit" role="tab" aria-controls="example-stream-order-bybit" aria-selected="false">Bybit</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="example-stream-order-coinbase-tab" data-toggle="tab" href="#example-stream-order-coinbase" role="tab" aria-controls="example-stream-order-coinbase" aria-selected="false">Coinbase</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="example-stream-order-coinex-tab" data-toggle="tab" href="#example-stream-order-coinex" role="tab" aria-controls="example-stream-order-coinex" aria-selected="false">Coinex</a>
|
||||
</li>
|
||||
@ -3979,6 +4163,11 @@ _ = Task.Run(async () => {
|
||||
<div class="tab-pane fade" id="example-stream-order-bybit" role="tabpanel" aria-labelledby="example-stream-order-bybit-tab">
|
||||
<pre><code>await bybitSocketClient.V5PrivateApi.SubscribeToOrderUpdatesAsync(data => {
|
||||
// Handle update
|
||||
});</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="example-stream-order-coinbase" role="tabpanel" aria-labelledby="example-stream-order-coinbase-tab">
|
||||
<pre><code>await coinbaseSocketClient.AdvancedTradeApi.SubscribeToUserUpdatesAsync(data => {
|
||||
// Handle update
|
||||
});</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="example-stream-order-coinex" role="tabpanel" aria-labelledby="example-stream-order-coinex-tab">
|
||||
@ -4043,7 +4232,7 @@ _ = Task.Run(async () => {
|
||||
|
||||
|
||||
<b id="idocs_example_minimal">Minimal API</b><br />
|
||||
<p>A minimal API example allowing the caller to retrieve ticker information for a specific exchange and asset pair<br />
|
||||
<p>A minimal API example allowing the caller to retrieve ticker information for a specific exchange and asset pair. This is using the <code>CryptoClient.Net</code> Nuget package.<br />
|
||||
<div class="accordion" id="accordionMinimalApi">
|
||||
<div class="card">
|
||||
<div class="card-header" id="headingMinimalApi">
|
||||
@ -4066,8 +4255,8 @@ var app = builder.Build();
|
||||
|
||||
app.MapGet("Ticker/{exchange}/{baseAsset}/{quoteAsset}", async ([FromServices] IExchangeRestClient client, Exchange exchange, string baseAsset, string quoteAsset) =>
|
||||
{
|
||||
var spotClient = client.GetUnifiedSpotClient(exchange)!;
|
||||
var result = await spotClient.GetTickerAsync(spotClient.GetSymbolName(baseAsset, quoteAsset));
|
||||
var spotClient = client.GetSpotTickerClient(exchange)!;
|
||||
var result = await spotClient.GetSpotTickerAsync(new GetTickerRequest(new SharedSymbol(TradingMode.Spot, baseAsset, quoteAsset)));
|
||||
return result.Data;
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user