1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-06-08 00:16:27 +00:00
This commit is contained in:
JKorf 2024-02-14 16:32:48 +01:00
parent bbad338941
commit 46da3b40a0
2 changed files with 316 additions and 37 deletions

View File

@ -1804,7 +1804,7 @@ hr {
} }
.accordion .card-body { .accordion .card-body {
line-height: 26px; line-height: 26px;
border: 1px solid #aaa; border: 1px solid #ccc;
margin-top: -4px; margin-top: -4px;
border-radius: 4px; border-radius: 4px;
} }

View File

@ -101,7 +101,15 @@
<li class="nav-item"><a class="nav-link" href="#idocs_ratelimiting">Ratelimiting</a></li> <li class="nav-item"><a class="nav-link" href="#idocs_ratelimiting">Ratelimiting</a></li>
</ul> </ul>
</li> </li>
<li class="nav-item"><a class="nav-link" href="#idocs_examples">Examples</a></li> <li class="nav-item"><a class="nav-link" href="#idocs_examples">Examples</a>
<ul class="nav flex-column">
<li class="nav-item"><a class="nav-link" href="#idocs_example_symbols">Get Symbols</a></li>
<li class="nav-item"><a class="nav-link" href="#idocs_example_ticker">Get Ticker</a></li>
<li class="nav-item"><a class="nav-link" href="#idocs_example_balances">Get Balances</a></li>
<li class="nav-item"><a class="nav-link" href="#idocs_example_placeorder">Place Order</a></li>
<li class="nav-item"><a class="nav-link" href="#idocs_example_minimal">Minimal API</a></li>
</ul>
</li>
<li class="nav-item"><a class="nav-link" href="#idocs_glossary">Glossary</a></li> <li class="nav-item"><a class="nav-link" href="#idocs_glossary">Glossary</a></li>
<li class="nav-item"><a class="nav-link" href="#idocs_faq">FAQ</a></li> <li class="nav-item"><a class="nav-link" href="#idocs_faq">FAQ</a></li>
</ul> </ul>
@ -115,7 +123,7 @@
<h1>CryptoExchange.Net</h1> <h1>CryptoExchange.Net</h1>
<p>CryptoExchange.Net is a base library which is used to implement different cryptocurrency (exchange) API's. It provides a standardized way of implementing different API's, which results in a very similar experience for users of the API implementations.</p> <p>CryptoExchange.Net is a base library which is used to implement different cryptocurrency (exchange) API's. It provides a standardized way of implementing different API's, which results in a very similar experience for users of the API implementations.</p>
<div class="alert alert-info">All libraries can be used in the same project as well as indivually.</div> <div class="alert alert-info">All libraries can be used in the same project as well as indivually, just install the exchange libraries you need!</div>
<p>The following API's are directly supported. Note that there are 3rd party implementations going around, but only these are created and supported by me</p> <p>The following API's are directly supported. Note that there are 3rd party implementations going around, but only these are created and supported by me</p>
<table class="table table-bordered"> <table class="table table-bordered">
@ -156,6 +164,7 @@
</table> </table>
<h4>Discord</h4> <h4>Discord</h4>
<a href="https://discord.gg/MSpeEtSY8t" ><img src="https://img.shields.io/discord/847020490588422145?style=for-the-badge" /></a>
<p>A Discord server is available <a href="https://discord.gg/MSpeEtSY8t">here</a>. Feel free to join for discussion and/or questions around the CryptoExchange.Net and implementation libraries.</p> <p>A Discord server is available <a href="https://discord.gg/MSpeEtSY8t">here</a>. Feel free to join for discussion and/or questions around the CryptoExchange.Net and implementation libraries.</p>
<h4>Support the project</h4> <h4>Support the project</h4>
@ -2178,43 +2187,276 @@ This adds another limit of 10 requests per 2 seconds for the order endpoint in a
<h1>Examples</h1> <h1>Examples</h1>
<p>See also the Examples folder in the <a href="https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples">source</a></p> <p>See also the Examples folder in the <a href="https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples">source</a></p>
<b>Minimal API</b><br /> <b id="idocs_example_symbols">Get Symbols</b><br />
<p>A minimal API example allowing the retrieval of ticker information for a specific exchange and symbol<br /> <p>Get a list of supported symbols on the exchange and information about the symbols</p>
<div class="accordion" id="accordionMinimalApi"> <div class="accordion" id="accordionSymbols">
<div class="card"> <div class="card">
<div class="card-header" id="headingMinimalApi"> <div class="card-header" id="headingSymbols">
<h5 class="mb-0"> <a href="#" class="collapsed" data-toggle="collapse" data-target="#collapseMinimalApi" aria-expanded="false" aria-controls="collapseOne">Show</a> </h5> <h5 class="mb-0"> <a href="#" class="collapsed" data-toggle="collapse" data-target="#collapseSymbols" aria-expanded="false" aria-controls="collapseOne">Show</a> </h5>
</div> </div>
<div id="collapseMinimalApi" class="collapse" aria-labelledby="headingMinimalApi" data-parent="#accordionMinimalApi"> <div id="collapseSymbols" class="collapse" aria-labelledby="headingSymbols" data-parent="#accordionSymbols">
<div class="card-body"> <div class="card-body">
<p>This API returns ticker information for the following path</p> <div>
<code>/Ticker/[Exchange]/[QuoteAsset]/[BaseAsset]</code> for example <code>/Ticker/Kraken/ETH/BTC</code><br />
</p> <ul class="nav nav-tabs" id="example-symbols" role="tablist" style="margin-bottom: -16px;">
<pre><code class="language-csharp">using CryptoExchange.Net.Interfaces; <li class="nav-item" role="presentation">
using Microsoft.AspNetCore.Mvc; <a class="nav-link active" id="example-symbols-general-tab" data-toggle="tab" href="#example-symbols-general" role="tab" aria-controls="example-symbols-general" aria-selected="true">CryptoRestClient</a>
</li>
var builder = WebApplication.CreateBuilder(args); <li class="nav-item" role="presentation">
builder.Services.AddBitfinex(); <a class="nav-link" id="example-symbols-binance-tab" data-toggle="tab" href="#example-symbols-binance" role="tab" aria-controls="example-symbols-binance" aria-selected="true">Binance</a>
builder.Services.AddBitget(); </li>
builder.Services.AddKraken(); <li class="nav-item" role="presentation">
var app = builder.Build(); <a class="nav-link" id="example-symbols-bitfinex-tab" data-toggle="tab" href="#example-symbols-bitfinex" role="tab" aria-controls="example-symbols-bitfinex" aria-selected="false">Bitfinex</a>
</li>
app.MapGet("Ticker/{exchange}/{baseAsset}/{quoteAsset}", async ([FromServices] ICryptoRestClient client, string exchange, string baseAsset, string quoteAsset) => <li class="nav-item" role="presentation">
{ <a class="nav-link" id="example-symbols-bitget-tab" data-toggle="tab" href="#example-symbols-bitget" role="tab" aria-controls="example-symbols-bitget" aria-selected="false">Bitget</a>
var spotClient = client.SpotClient(exchange)!; </li>
var result = await spotClient.GetTickerAsync(spotClient.GetSymbolName(baseAsset, quoteAsset)); <li class="nav-item" role="presentation">
return result.Data; <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">
app.Run(); <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>
</pre></code> </li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-symbols-huobi-tab" data-toggle="tab" href="#example-symbols-huobi" role="tab" aria-controls="example-symbols-huobi" aria-selected="false">Huobi</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-symbols-kraken-tab" data-toggle="tab" href="#example-symbols-kraken" role="tab" aria-controls="example-symbols-kraken" aria-selected="false">Kraken</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-symbols-kucoin-tab" data-toggle="tab" href="#example-symbols-kucoin" role="tab" aria-controls="example-symbols-kucoin" aria-selected="false">Kucoin</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-symbols-mexc-tab" data-toggle="tab" href="#example-symbols-mexc" role="tab" aria-controls="example-symbols-mexc" aria-selected="false">Mexc</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-symbols-okx-tab" data-toggle="tab" href="#example-symbols-okx" role="tab" aria-controls="example-symbols-okx" aria-selected="false">OKX</a>
</li>
</ul>
<div class="tab-content my-3" id="myTabContent">
<div class="tab-pane fade show active" id="example-symbols-general" role="tabpanel" aria-labelledby="example-symbols-general-tab">
<pre><code>// Name of the exchange can be whatever exchange library you have installed, for example Binance, Bybit, Kraken etc
var spotClient = cryptoRestClient.SpotClient("[Name of the exchange]");
await spotClient.GetSymbolsAsync();</code></pre>
</div>
<div class="tab-pane fade" id="example-symbols-binance" role="tabpanel" aria-labelledby="example-symbols-binance-tab">
<pre><code>await binanceClient.SpotApi.ExchangeData.GetExchangeInfoAsync();</code></pre>
</div>
<div class="tab-pane fade" id="example-symbols-bitfinex" role="tabpanel" aria-labelledby="example-symbols-bitfinex-tab">
<pre><code>await bitfinexClient.SpotApi.ExchangeData.GetSymbolsAsync();</code></pre>
</div>
<div class="tab-pane fade" id="example-symbols-bitget" role="tabpanel" aria-labelledby="example-symbols-bitget-tab">
<pre><code>await bitgetClient.SpotApi.ExchangeData.GetSymbolsAsync();</code></pre>
</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-coinex" role="tabpanel" aria-labelledby="example-symbols-coinex-tab">
<pre><code>await coinExClient.SpotApi.ExchangeData.GetSymbolsAsync();</code></pre>
</div>
<div class="tab-pane fade" id="example-symbols-huobi" role="tabpanel" aria-labelledby="example-symbols-huobi-tab">
<pre><code>await huobiClient.SpotApi.ExchangeData.GetSymbolsAsync();</code></pre>
</div>
<div class="tab-pane fade" id="example-symbols-kraken" role="tabpanel" aria-labelledby="example-symbols-kraken-tab">
<pre><code>await krakenClient.SpotApi.ExchangeData.GetSymbolsAsync();</code></pre>
</div>
<div class="tab-pane fade" id="example-symbols-kucoin" role="tabpanel" aria-labelledby="example-symbols-kucoin-tab">
<pre><code>await kucoinClient.SpotApi.ExchangeData.GetSymbolsAsync();</code></pre>
</div>
<div class="tab-pane fade" id="example-symbols-mexc" role="tabpanel" aria-labelledby="example-symbols-mexc-tab">
<pre><code>await mexcClient.SpotApi.ExchangeData.GetExchangeInfoAsync();</code></pre>
</div>
<div class="tab-pane fade" id="example-symbols-okx" role="tabpanel" aria-labelledby="example-symbols-okx-tab">
<pre><code>await okxClient.UnifiedApi.ExchangeData.GetSymbolsAsync(OKXInstrumentType.Spot);</code></pre>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
<b>Placing an order</b><br /> <b id="idocs_example_ticker">Getting Ticker</b><br />
<p>Place a limit buy order on exchange X for 0.1 BTC at a price of 50.000 USDT</p> <p>Get ticker/price statistics for a specific asset pair</p>
<div class="accordion" id="accordionTicker">
<div class="card">
<div class="card-header" id="headingTicker">
<h5 class="mb-0"> <a href="#" class="collapsed" data-toggle="collapse" data-target="#collapseTicker" aria-expanded="false" aria-controls="collapseOne">Show</a> </h5>
</div>
<div id="collapseTicker" class="collapse" aria-labelledby="headingTicker" data-parent="#accordionTicker">
<div class="card-body">
<div>
<ul class="nav nav-tabs" id="example-ticker" role="tablist" style="margin-bottom: -16px;">
<li class="nav-item" role="presentation">
<a class="nav-link active" id="example-ticker-general-tab" data-toggle="tab" href="#example-ticker-general" role="tab" aria-controls="example-ticker-general" aria-selected="true">CryptoRestClient</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-ticker-binance-tab" data-toggle="tab" href="#example-ticker-binance" role="tab" aria-controls="example-ticker-binance" aria-selected="true">Binance</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-ticker-bitfinex-tab" data-toggle="tab" href="#example-ticker-bitfinex" role="tab" aria-controls="example-ticker-bitfinex" aria-selected="false">Bitfinex</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-ticker-bitget-tab" data-toggle="tab" href="#example-ticker-bitget" role="tab" aria-controls="example-ticker-bitget" aria-selected="false">Bitget</a>
</li>
<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-coinex-tab" data-toggle="tab" href="#example-ticker-coinex" role="tab" aria-controls="example-ticker-coinex" aria-selected="false">Coinex</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-ticker-huobi-tab" data-toggle="tab" href="#example-ticker-huobi" role="tab" aria-controls="example-ticker-huobi" aria-selected="false">Huobi</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-ticker-kraken-tab" data-toggle="tab" href="#example-ticker-kraken" role="tab" aria-controls="example-ticker-kraken" aria-selected="false">Kraken</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-ticker-kucoin-tab" data-toggle="tab" href="#example-ticker-kucoin" role="tab" aria-controls="example-ticker-kucoin" aria-selected="false">Kucoin</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-ticker-mexc-tab" data-toggle="tab" href="#example-ticker-mexc" role="tab" aria-controls="example-ticker-mexc" aria-selected="false">Mexc</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-ticker-okx-tab" data-toggle="tab" href="#example-ticker-okx" role="tab" aria-controls="example-ticker-okx" aria-selected="false">OKX</a>
</li>
</ul>
<div class="tab-content my-3" id="myTabContent">
<div class="tab-pane fade show active" id="example-ticker-general" role="tabpanel" aria-labelledby="example-ticker-general-tab">
<pre><code>// Name of the exchange can be whatever exchange library you have installed, for example Binance, Bybit, Kraken etc
var spotClient = cryptoRestClient.SpotClient("[Name of the exchange]");
await spotClient.GetTickerAsync(spotClient.GetSymbolName("BTC", "USDT"));</code></pre>
</div>
<div class="tab-pane fade" id="example-ticker-binance" role="tabpanel" aria-labelledby="example-ticker-binance-tab">
<pre><code>await binanceClient.SpotApi.ExchangeData.GetTickerAsync("BTCUSDT");</code></pre>
</div>
<div class="tab-pane fade" id="example-ticker-bitfinex" role="tabpanel" aria-labelledby="example-ticker-bitfinex-tab">
<pre><code>await bitfinexClient.SpotApi.ExchangeData.GetTickerAsync("tBTCUST");</code></pre>
</div>
<div class="tab-pane fade" id="example-ticker-bitget" role="tabpanel" aria-labelledby="example-ticker-bitget-tab">
<pre><code>await bitgetClient.SpotApi.ExchangeData.GetTickerAsync("BTCUSDT_SPBL");</code></pre>
</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-coinex" role="tabpanel" aria-labelledby="example-ticker-coinex-tab">
<pre><code>await coinExClient.SpotApi.ExchangeData.GetTickerAsync("BTCUSDT");</code></pre>
</div>
<div class="tab-pane fade" id="example-ticker-huobi" role="tabpanel" aria-labelledby="example-ticker-huobi-tab">
<pre><code>await huobiClient.SpotApi.ExchangeData.GetTickerAsync("BTCUSDT");</code></pre>
</div>
<div class="tab-pane fade" id="example-ticker-kraken" role="tabpanel" aria-labelledby="example-ticker-kraken-tab">
<pre><code>await krakenClient.SpotApi.ExchangeData.GetTickerAsync("BTCUSDT");</code></pre>
</div>
<div class="tab-pane fade" id="example-ticker-kucoin" role="tabpanel" aria-labelledby="example-ticker-kucoin-tab">
<pre><code>await kucoinClient.SpotApi.ExchangeData.GetTickerAsync("BTC-USDT");</code></pre>
</div>
<div class="tab-pane fade" id="example-ticker-mexc" role="tabpanel" aria-labelledby="example-ticker-mexc-tab">
<pre><code>await mexcClient.SpotApi.ExchangeData.GetTickerAsync("BTCUSDT");</code></pre>
</div>
<div class="tab-pane fade" id="example-ticker-okx" role="tabpanel" aria-labelledby="example-ticker-okx-tab">
<pre><code>await okxClient.UnifiedApi.ExchangeData.GetTickerAsync("BTC-USDT");</code></pre>
</div>
</div>
</div>
</div>
</div>
</div>
<b id="idocs_example_balances">Get Balances</b><br />
<p>Get balance information. Requires API credentials to be set in the client options</p>
<div class="accordion" id="accordionBalances">
<div class="card">
<div class="card-header" id="headingBalances">
<h5 class="mb-0"> <a href="#" class="collapsed" data-toggle="collapse" data-target="#collapseBalances" aria-expanded="false" aria-controls="collapseOne">Show</a> </h5>
</div>
<div id="collapseBalances" class="collapse" aria-labelledby="headingBalances" data-parent="#accordionBalances">
<div class="card-body">
<div>
<ul class="nav nav-tabs" id="example-balances" role="tablist" style="margin-bottom: -16px;">
<li class="nav-item" role="presentation">
<a class="nav-link active" id="example-balances-general-tab" data-toggle="tab" href="#example-balances-general" role="tab" aria-controls="example-balances-general" aria-selected="true">CryptoRestClient</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-balances-binance-tab" data-toggle="tab" href="#example-balances-binance" role="tab" aria-controls="example-balances-binance" aria-selected="true">Binance</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-balances-bitfinex-tab" data-toggle="tab" href="#example-balances-bitfinex" role="tab" aria-controls="example-balances-bitfinex" aria-selected="false">Bitfinex</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-balances-bitget-tab" data-toggle="tab" href="#example-balances-bitget" role="tab" aria-controls="example-balances-bitget" aria-selected="false">Bitget</a>
</li>
<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-coinex-tab" data-toggle="tab" href="#example-balances-coinex" role="tab" aria-controls="example-balances-coinex" aria-selected="false">Coinex</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-balances-huobi-tab" data-toggle="tab" href="#example-balances-huobi" role="tab" aria-controls="example-balances-huobi" aria-selected="false">Huobi</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-balances-kraken-tab" data-toggle="tab" href="#example-balances-kraken" role="tab" aria-controls="example-balances-kraken" aria-selected="false">Kraken</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-balances-kucoin-tab" data-toggle="tab" href="#example-balances-kucoin" role="tab" aria-controls="example-balances-kucoin" aria-selected="false">Kucoin</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-balances-mexc-tab" data-toggle="tab" href="#example-balances-mexc" role="tab" aria-controls="example-balances-mexc" aria-selected="false">Mexc</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="example-balances-okx-tab" data-toggle="tab" href="#example-balances-okx" role="tab" aria-controls="example-balances-okx" aria-selected="false">OKX</a>
</li>
</ul>
<div class="tab-content my-3" id="myTabContent">
<div class="tab-pane fade show active" id="example-balances-general" role="tabpanel" aria-labelledby="example-balances-general-tab">
<pre><code>// Name of the exchange can be whatever exchange library you have installed, for example Binance, Bybit, Kraken etc
var spotClient = cryptoRestClient.SpotClient("[Name of the exchange]");
await spotClient.GetBalancesAsync();</code></pre>
</div>
<div class="tab-pane fade" id="example-balances-binance" role="tabpanel" aria-labelledby="example-balances-binance-tab">
<pre><code>await binanceClient.SpotApi.Account.GetBalancesAsync();</code></pre>
</div>
<div class="tab-pane fade" id="example-balances-bitfinex" role="tabpanel" aria-labelledby="example-balances-bitfinex-tab">
<pre><code>await bitfinexClient.SpotApi.Account.GetBalancesAsync();</code></pre>
</div>
<div class="tab-pane fade" id="example-balances-bitget" role="tabpanel" aria-labelledby="example-balances-bitget-tab">
<pre><code>await bitgetClient.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-coinex" role="tabpanel" aria-labelledby="example-balances-coinex-tab">
<pre><code>await coinExClient.SpotApi.Account.GetBalancesAsync();</code></pre>
</div>
<div class="tab-pane fade" id="example-balances-huobi" role="tabpanel" aria-labelledby="example-balances-huobi-tab">
<pre><code>// Need an account id, you probably want to already have done this before placing the order
var accounts = await huobiClient.SpotApi.Account.GetAccountsAsync();
var account = accounts.Data.Single(a => a.Type == AccountType.Spot);
var result = await huobiClient.SpotApi.Account.GetBalancesAsync();</code></pre>
</div>
<div class="tab-pane fade" id="example-balances-kraken" role="tabpanel" aria-labelledby="example-balances-kraken-tab">
<pre><code>await krakenClient.SpotApi.Account.GetBalancesAsync();</code></pre>
</div>
<div class="tab-pane fade" id="example-balances-kucoin" role="tabpanel" aria-labelledby="example-balances-kucoin-tab">
<pre><code>await kucoinClient.SpotApi.Account.GetAccountsAsync();</code></pre>
</div>
<div class="tab-pane fade" id="example-balances-mexc" role="tabpanel" aria-labelledby="example-balances-mexc-tab">
<pre><code>await mexcClient.SpotApi.Account.GetAccountInfoAsync();</code></pre>
</div>
<div class="tab-pane fade" id="example-balances-okx" role="tabpanel" aria-labelledby="example-balances-okx-tab">
<pre><code>await okxClient.UnifiedApi.Account.GetAccountBalanceAsync();</code></pre>
</div>
</div>
</div>
</div>
</div>
</div>
<b id="idocs_example_placeorder">Placing Order</b><br />
<p>Place a limit buy order for 0.1 BTC at a price of 50.000 USDT. Requires API credentials to be set in the client options</p>
<div class="accordion" id="accordionPlaceOrder"> <div class="accordion" id="accordionPlaceOrder">
<div class="card"> <div class="card">
<div class="card-header" id="headingPlaceOrder"> <div class="card-header" id="headingPlaceOrder">
@ -2261,7 +2503,8 @@ app.Run();
</ul> </ul>
<div class="tab-content my-3" id="myTabContent"> <div class="tab-content my-3" id="myTabContent">
<div class="tab-pane fade show active" id="example-place-general" role="tabpanel" aria-labelledby="example-place-general-tab"> <div class="tab-pane fade show active" id="example-place-general" role="tabpanel" aria-labelledby="example-place-general-tab">
<pre><code>var spotClient = cryptoRestClient.SpotClient("[Name of the exchange]"); <pre><code>// Name of the exchange can be whatever exchange library you have installed, for example Binance, Bybit, Kraken etc
var spotClient = cryptoRestClient.SpotClient("[Name of the exchange]");
await spotClient.PlaceOrderAsync(spotClient.GetSymbolName("BTC", "USDT"), CommonOrderSide.Buy, CommonOrderType.Limit, 0.1m, price: 50000);</code></pre> await spotClient.PlaceOrderAsync(spotClient.GetSymbolName("BTC", "USDT"), CommonOrderSide.Buy, CommonOrderType.Limit, 0.1m, price: 50000);</code></pre>
</div> </div>
<div class="tab-pane fade" id="example-place-binance" role="tabpanel" aria-labelledby="example-place-binance-tab"> <div class="tab-pane fade" id="example-place-binance" role="tabpanel" aria-labelledby="example-place-binance-tab">
@ -2304,6 +2547,42 @@ var result = await huobiClient.SpotApi.Trading.PlaceOrderAsync(account.Id, "BTCU
</div> </div>
</div> </div>
<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 />
<div class="accordion" id="accordionMinimalApi">
<div class="card">
<div class="card-header" id="headingMinimalApi">
<h5 class="mb-0"> <a href="#" class="collapsed" data-toggle="collapse" data-target="#collapseMinimalApi" aria-expanded="false" aria-controls="collapseOne">Show</a> </h5>
</div>
<div id="collapseMinimalApi" class="collapse" aria-labelledby="headingMinimalApi" data-parent="#accordionMinimalApi">
<div class="card-body">
<p>This API returns ticker information for the following path</p>
<code>/Ticker/[Exchange]/[QuoteAsset]/[BaseAsset]</code> for example <code>/Ticker/Kraken/ETH/BTC</code><br />
</p>
<pre><code class="language-csharp">using CryptoExchange.Net.Interfaces;
using Microsoft.AspNetCore.Mvc;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddBitfinex();
builder.Services.AddBitget();
builder.Services.AddKraken();
var app = builder.Build();
app.MapGet("Ticker/{exchange}/{baseAsset}/{quoteAsset}", async ([FromServices] ICryptoRestClient client, string exchange, string baseAsset, string quoteAsset) =>
{
var spotClient = client.SpotClient(exchange)!;
var result = await spotClient.GetTickerAsync(spotClient.GetSymbolName(baseAsset, quoteAsset));
return result.Data;
});
app.Run();
</pre></code>
</div>
</div>
</div>
</section> </section>
<hr class="divider"> <hr class="divider">