mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-07 16:06:15 +00:00
6136 lines
318 KiB
HTML
6136 lines
318 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0, shrink-to-fit=no">
|
|
<link href="assets/images/logo.png" rel="icon" />
|
|
<title>CryptoExchange.Net Documentation</title>
|
|
<meta name="description" content="Documentation of the CryptoExchange.Net and client implementation libraries">
|
|
<meta name="author" content="JKorf">
|
|
|
|
<!-- Stylesheet
|
|
============================== -->
|
|
<!-- Bootstrap -->
|
|
<link rel="stylesheet" type="text/css" href="assets/vendor/bootstrap/css/bootstrap.min.css" />
|
|
<!-- Font Awesome Icon -->
|
|
<link rel="stylesheet" type="text/css" href="assets/vendor/font-awesome/css/all.min.css" />
|
|
<!-- Magnific Popup -->
|
|
<link rel="stylesheet" type="text/css" href="assets/vendor/magnific-popup/magnific-popup.min.css" />
|
|
<!-- Highlight Syntax -->
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css">
|
|
<!--<link rel="stylesheet" type="text/css" href="assets/vendor/highlight.js/styles/github.css" />-->
|
|
<!-- Custom Stylesheet -->
|
|
<link rel="stylesheet" type="text/css" href="assets/css/stylesheet.css" />
|
|
</head>
|
|
|
|
<body class="box" data-spy="scroll" data-target=".idocs-navigation" data-offset="125">
|
|
|
|
<!-- Preloader -->
|
|
<div class="preloader">
|
|
<div class="lds-ellipsis">
|
|
<div></div>
|
|
<div></div>
|
|
<div></div>
|
|
<div></div>
|
|
</div>
|
|
</div>
|
|
<!-- Preloader End -->
|
|
|
|
<!-- Document Wrapper
|
|
=============================== -->
|
|
<div id="main-wrapper">
|
|
|
|
<!-- Header
|
|
============================ -->
|
|
<header id="header" class="sticky-top">
|
|
<!-- Navbar -->
|
|
<nav class="primary-menu navbar navbar-expand-lg navbar-dropdown-dark">
|
|
<div class="container-fluid">
|
|
<!-- Sidebar Toggler -->
|
|
<button id="sidebarCollapse" class="navbar-toggler d-block d-md-none" type="button"><span></span><span class="w-75"></span><span class="w-50"></span></button>
|
|
|
|
<!-- Logo -->
|
|
<a class="logo ml-md-3" href="index.html" title="iDocs Template"> <img src="assets/images/logo.png" alt="iDocs Template"/> </a>
|
|
<span class="text-2 ml-2"></span>
|
|
<!-- Logo End -->
|
|
|
|
<!-- Navbar Toggler -->
|
|
<button class="navbar-toggler ml-auto" type="button" data-toggle="collapse" data-target="#header-nav"><span></span><span></span><span></span></button>
|
|
|
|
<ul class="social-icons social-icons-sm ml-lg-2 mr-2">
|
|
<li class="social-icons-nuget"><a data-toggle="tooltip" href="http://www.nuget.org/profiles/JKorf/" target="_blank" title="" data-original-title="Nuget">Nuget</a></li>
|
|
<li><a data-toggle="tooltip" href="http://www.github.com/JKorf/CryptoExchange.Net" target="_blank" title="" data-original-title="GitHub"><i class="fab fa-github"></i></a></li>
|
|
<li><a data-toggle="tooltip" href="https://discord.gg/Wyqd4hegMZ" target="_blank" title="" data-original-title="Discord"><i class="fab fa-discord"></i></a></li>
|
|
</ul>
|
|
</div>
|
|
</nav>
|
|
<!-- Navbar End -->
|
|
</header>
|
|
<!-- Header End -->
|
|
|
|
<!-- Content
|
|
============================ -->
|
|
<div id="content" role="main">
|
|
|
|
<!-- Sidebar Navigation
|
|
============================ -->
|
|
<div class="idocs-navigation bg-light">
|
|
<ul class="nav flex-column ">
|
|
<li class="nav-item"><a class="nav-link active" href="#idocs_intro">Introduction</a></li>
|
|
<li class="nav-item"><a class="nav-link active" href="#idocs_start">Getting Started</a>
|
|
<ul class="nav flex-column">
|
|
<li class="nav-item"><a class="nav-link" href="#idocs_installation">Installation</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#idocs_di">Dependency Injection</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#idocs_general">General Client Usage</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#idocs_rest">REST API Client</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#idocs_socket">Websocket API Client</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="nav-item"><a class="nav-link active" href="#idocs_shared">Cross Exchange Development</a>
|
|
<ul class="nav flex-column">
|
|
<li class="nav-item"><a class="nav-link" href="#shared_tradingmode">Trading mode</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#shared_symbol">Shared symbol</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#shared_pagination">Pagination</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#shared_interfaces">Available interfaces</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#shared_cc">CryptoClients.Net</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="nav-item"><a class="nav-link" href="#idocs_options">Options & Authorization</a>
|
|
<ul class="nav flex-column">
|
|
<li class="nav-item"><a class="nav-link" href="#idocs_auth">Authorization</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#idocs_options_set">Setting Options</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#idocs_options_def">Option Definitions</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="nav-item"><a class="nav-link" href="#idocs_features">Additional Features</a>
|
|
<ul class="nav flex-column">
|
|
<li class="nav-item"><a class="nav-link" href="#idocs_orderbooks">Orderbooks</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#idocs_trackers">Trackers</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#idocs_logging">Logging</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#idocs_ratelimiting">Ratelimiting</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#idocs_caching">Caching</a></li>
|
|
</ul>
|
|
</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_stream_ticker">Subscribe Ticker Updates</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#idocs_example_stream_order">Subscribe Order Updates</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_faq">FAQ</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<!-- Docs Content
|
|
============================ -->
|
|
<div class="idocs-content">
|
|
<div class="container">
|
|
<section id="idocs_intro">
|
|
<h1>CryptoExchange.Net & Implementations</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>When access to multiple or all exchange API's is needed, the CryptoClients.Net library combines all different client libraries in a single Nuget package. The following image illustrates the structure:</p>
|
|
<p><img src="assets/images/struct.png" /></p>
|
|
<p>These Exchanges/API's are directly supported:</p>
|
|
|
|
<table class="table table-bordered">
|
|
<tr>
|
|
<th>API</th>
|
|
<th>Repository</th>
|
|
<th>Nuget</th>
|
|
</tr>
|
|
<tr><td>Binance</td><td><a href="https://github.com/JKorf/Binance.Net">JKorf/Binance.Net</a></td><td><a href="https://www.nuget.org/packages/Binance.Net" target="_blank"><img src="https://img.shields.io/nuget/v/Binance.net.svg?style=flat-square" /></a></td></tr>
|
|
<tr><td>BingX</td><td><a href="https://github.com/JKorf/BingX.Net">JKorf/BingX.Net</a></td><td><a href="https://www.nuget.org/packages/JK.BingX.Net" target="_blank"><img src="https://img.shields.io/nuget/v/JK.BingX.net.svg?style=flat-square" /></a></td></tr>
|
|
<tr><td>Bitfinex</td><td><a href="https://github.com/JKorf/Bitfinex.Net">JKorf/Bitfinex.Net</a></td><td><a href="https://www.nuget.org/packages/Bitfinex.Net" target="_blank"><img src="https://img.shields.io/nuget/v/Bitfinex.net.svg?style=flat-square" /></a></td></tr>
|
|
<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>Crypto.com</td><td><a href="https://github.com/JKorf/CryptoCom.Net">JKorf/CryptoCom.Net</a></td><td><a href="https://www.nuget.org/packages/CryptoCom.Net" target="_blank"><img src="https://img.shields.io/nuget/v/CryptoCom.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>
|
|
<tr><td>HTX</td><td><a href="https://github.com/JKorf/HTX.Net">JKorf/HTX.Net</a></td><td><a href="https://www.nuget.org/packages/JKorf.HTX.Net" target="_blank"><img src="https://img.shields.io/nuget/v/JKorf.HTX.net.svg?style=flat-square" /></a></td></tr>
|
|
<tr><td>HyperLiquid</td><td><a href="https://github.com/JKorf/HyperLiquid.Net">JKorf/HyperLiquid.Net</a></td><td><a href="https://www.nuget.org/packages/HyperLiquid.Net" target="_blank"><img src="https://img.shields.io/nuget/v/HyperLiquid.net.svg?style=flat-square" /></a></td></tr>
|
|
<tr><td>Kraken</td><td><a href="https://github.com/JKorf/Kraken.Net">JKorf/Kraken.Net</a></td><td><a href="https://www.nuget.org/packages/KrakenExchange.Net" target="_blank"><img src="https://img.shields.io/nuget/v/KrakenExchange.net.svg?style=flat-square" /></a></td></tr>
|
|
<tr><td>Kucoin</td><td><a href="https://github.com/JKorf/Kucoin.Net">JKorf/Kucoin.Net</a></td><td><a href="https://www.nuget.org/packages/Kucoin.Net" target="_blank"><img src="https://img.shields.io/nuget/v/Kucoin.net.svg?style=flat-square" /></a></td></tr>
|
|
<tr><td>Mexc</td><td><a href="https://github.com/JKorf/Mexc.Net">JKorf/Mexc.Net</a></td><td><a href="https://www.nuget.org/packages/JK.Mexc.Net" target="_blank"><img src="https://img.shields.io/nuget/v/JK.Mexc.net.svg?style=flat-square" /></a></td></tr>
|
|
<tr><td>OKX</td><td><a href="https://github.com/JKorf/OKX.Net">JKorf/OKX.Net</a></td><td><a href="https://www.nuget.org/packages/JK.OKX.Net" target="_blank"><img src="https://img.shields.io/nuget/v/JK.OKX.net.svg?style=flat-square" /></a></td></tr>
|
|
<tr><td>WhiteBit</td><td><a href="https://github.com/JKorf/WhiteBit.Net">JKorf/WhiteBit.Net</a></td><td><a href="https://www.nuget.org/packages/WhiteBit.Net" target="_blank"><img src="https://img.shields.io/nuget/v/WhiteBit.net.svg?style=flat-square" /></a></td></tr>
|
|
<tr><td>XT</td><td><a href="https://github.com/JKorf/XT.Net">JKorf/XT.Net</a></td><td><a href="https://www.nuget.org/packages/XT.Net" target="_blank"><img src="https://img.shields.io/nuget/v/XT.net.svg?style=flat-square" /></a></td></tr>
|
|
</table>
|
|
<p>Note that there are 3rd party implementations going around, but only the listed ones here are created and supported by me.</p>
|
|
<p>When using multiple of these API's the <a href="https://github.com/jkorf/CryptoClients.Net">CryptoClients.Net</a> package can be used which combines these packages and allows easy access to all exchange API's.</p>
|
|
<table class="table table-bordered">
|
|
<tr><td>CryptoClients</td><td><a href="https://github.com/JKorf/CryptoClients.Net">JKorf/CryptoClients.Net</a></td><td><a href="https://www.nuget.org/packages/CryptoClients.Net" target="_blank"><img src="https://img.shields.io/nuget/v/CryptoClients.net.svg?style=flat-square" /></a></a></td></tr>
|
|
</table>
|
|
|
|
<h4>Supported Frameworks</h4>
|
|
<p>
|
|
The libraries are targeting both <code>.NET Standard 2.0</code> and <code>.NET Standard 2.1</code> for optimal compatibility
|
|
</p>
|
|
<table class="table table-bordered">
|
|
<tr>
|
|
<th>.NET implementation</th>
|
|
<th>Version Support</th>
|
|
</tr>
|
|
<tr><td>.NET Core</td><td><code>2.0</code> and higher</td></tr>
|
|
<tr><td>.NET Framework</td><td><code>4.6.1</code> and higher</td></tr>
|
|
<tr><td>Mono</td><td><code>5.4</code> and higher</td></tr>
|
|
<tr><td>Xamarin.iOS</td><td><code>10.14</code> and higher</td></tr>
|
|
<tr><td>Xamarin.Android</td><td><code>8.0</code> and higher</td></tr>
|
|
<tr><td>UWP</td><td><code>10.0.16299</code> and higher</td></tr>
|
|
<tr><td>Unity</td><td><code>2018.1</code> and higher</td></tr>
|
|
</table>
|
|
|
|
<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>
|
|
|
|
<h4>Support the project</h4>
|
|
|
|
<b>Referral</b>
|
|
<p>When creating an account on new exchanges please consider using a referral link from below to support development</p>
|
|
<table class="table table-bordered">
|
|
<tr><th>Exchange</th><th>Link</th></tr>
|
|
<tr><td>Bybit</td><td>https://partner.bybit.com/b/jkorf</td></tr>
|
|
<tr><td>Coinbase</td><td>https://advanced.coinbase.com/join/T6H54H8</td></tr>
|
|
<tr><td>CoinEx</td><td>https://www.coinex.com/register?refer_code=hd6gn</td></tr>
|
|
<tr><td>Crypto.com</td><td>https://crypto.com/exch/26ge92xbkn</td></tr>
|
|
<tr><td>HTX</td><td>https://www.htx.com/invite/en-us/1f?invite_code=fxp9</td></tr>
|
|
<tr><td>HyperLiquid</td><td>https://app.hyperliquid.xyz/join/JKORF</td></tr>
|
|
<tr><td>Kucoin</td><td>https://www.kucoin.com/r/rf/QBS4FPED</td></tr>
|
|
<tr><td>OKX</td><td>https://okx.com/join/48046699</td></tr>
|
|
<tr><td>WhiteBit</td><td>https://whitebit.com/referral/a8e59b59-186c-4662-824c-3095248e0edf</td></tr>
|
|
<tr><td>XT</td><td>https://www.xt.com/en/accounts/register?ref=1HRM5J</td></tr>
|
|
</table>
|
|
|
|
<b>Donate</b><br />
|
|
<p>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.<p>
|
|
|
|
<p><em>Btc</em>: bc1q277a5n54s2l2mzlu778ef7lpkwhjhyvghuv8qf<br />
|
|
<em>Eth</em>: 0xcb1b63aCF9fef2755eBf4a0506250074496Ad5b7<br />
|
|
<em>USDT (TRX)</em>: TKigKeJPXZYyMVDgMyXxMf17MWYia92Rjd</p>
|
|
|
|
<b>Sponsor</b><br />
|
|
<p>Alternatively, sponsor me on Github using <a href="https://github.com/sponsors/JKorf">Github Sponsors</a>.</p>
|
|
|
|
</section>
|
|
|
|
<hr class="divider">
|
|
|
|
<!-- Getting Started
|
|
============================ -->
|
|
<section id="idocs_start">
|
|
<h1>Getting Started</h1>
|
|
<p>All packages are available on Nuget. After installing the package the API is available by using one of the library clients, or through the <code>ICrypoRestClient</code>, <code>ICryptoSocketClient</code> or <code>ISharedClient</code> interfaces.</p>
|
|
</section>
|
|
|
|
<hr class="divider">
|
|
|
|
<!-- Installation
|
|
============================ -->
|
|
<section id="idocs_installation">
|
|
<h2>Installation</h2>
|
|
|
|
<p>Add the package via dotnet, or add it via the package manager. Any number of libraries can be installed, just make sure you're always using the latest at that moment. Instead of installing all libraries seperately the CryptoClients.Net library can be installed to include all the exchange package in one go.</p>
|
|
<div class="tab-wrap">
|
|
<ul class="nav nav-tabs" id="install" role="tablist">
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link active" id="install-cc-tab" data-toggle="tab" href="#install-cc" role="tab" aria-controls="install-cc" aria-selected="true">CryptoClients</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="install-binance-tab" data-toggle="tab" href="#install-binance" role="tab" aria-controls="install-binance" aria-selected="true">Binance</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="install-bingx-tab" data-toggle="tab" href="#install-bingx" role="tab" aria-controls="install-bingx" aria-selected="false">BingX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="install-bitfinex-tab" data-toggle="tab" href="#install-bitfinex" role="tab" aria-controls="install-bitfinex" aria-selected="false">Bitfinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="install-bitget-tab" data-toggle="tab" href="#install-bitget" role="tab" aria-controls="install-bitget" aria-selected="false">Bitget</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="install-bitmart-tab" data-toggle="tab" href="#install-bitmart" role="tab" aria-controls="install-bitmart" aria-selected="false">BitMart</a>
|
|
</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 class="nav-item" role="presentation">
|
|
<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-cryptocom-tab" data-toggle="tab" href="#install-cryptocom" role="tab" aria-controls="install-cryptocom" aria-selected="false">Crypto.com</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>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="install-htx-tab" data-toggle="tab" href="#install-htx" role="tab" aria-controls="install-htx" aria-selected="false">HTX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="install-hyperliquid-tab" data-toggle="tab" href="#install-hyperliquid" role="tab" aria-controls="install-hyperliquid" aria-selected="false">HyperLiquid</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="install-kraken-tab" data-toggle="tab" href="#install-kraken" role="tab" aria-controls="install-kraken" aria-selected="false">Kraken</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="install-kucoin-tab" data-toggle="tab" href="#install-kucoin" role="tab" aria-controls="install-kucoin" aria-selected="false">Kucoin</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="install-mexc-tab" data-toggle="tab" href="#install-mexc" role="tab" aria-controls="install-mexc" aria-selected="false">Mexc</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="install-okx-tab" data-toggle="tab" href="#install-okx" role="tab" aria-controls="install-okx" aria-selected="false">OKX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="install-whitebit-tab" data-toggle="tab" href="#install-whitebit" role="tab" aria-controls="install-whitebit" aria-selected="false">WhiteBit</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="install-xt-tab" data-toggle="tab" href="#install-xt" role="tab" aria-controls="install-xt" aria-selected="false">XT</a>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content my-3" id="myTabContent">
|
|
<div class="tab-pane fade show active" id="install-cc" role="tabpanel" aria-labelledby="install-cc-tab">
|
|
<pre><code>dotnet add package CryptoClients.Net</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade show" id="install-binance" role="tabpanel" aria-labelledby="install-binance-tab">
|
|
<pre><code>dotnet add package Binance.Net</code></pre>
|
|
<img src="assets/images/BinanceInstall.png" />
|
|
</div>
|
|
<div class="tab-pane fade" id="install-bingx" role="tabpanel" aria-labelledby="install-bingx-tab">
|
|
<pre><code>dotnet add package JK.BingX.Net</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="install-bitfinex" role="tabpanel" aria-labelledby="install-bitfinex-tab">
|
|
<pre><code>dotnet add package Bitfinex.Net</code></pre>
|
|
<img src="assets/images/BitfinexInstall.png" />
|
|
</div>
|
|
<div class="tab-pane fade" id="install-bitget" role="tabpanel" aria-labelledby="install-bitget-tab">
|
|
<pre><code>dotnet add package JK.Bitget.Net</code></pre>
|
|
<img src="assets/images/BitgetInstall.png" />
|
|
</div>
|
|
<div class="tab-pane fade" id="install-bitmart" role="tabpanel" aria-labelledby="install-bitmart-tab">
|
|
<pre><code>dotnet add package BitMart.Net</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="install-bybit" role="tabpanel" aria-labelledby="install-bybit-tab">
|
|
<pre><code>dotnet add package Bybit.Net</code></pre>
|
|
<img src="assets/images/BybitInstall.png" />
|
|
</div>
|
|
<div class="tab-pane fade" id="install-coingecko" role="tabpanel" aria-labelledby="install-coingecko-tab">
|
|
<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" />
|
|
</div>
|
|
<div class="tab-pane fade" id="install-cryptocom" role="tabpanel" aria-labelledby="install-cryptocom-tab">
|
|
<pre><code>dotnet add package CryptoCom.Net</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="install-gateio" role="tabpanel" aria-labelledby="install-gateio-tab">
|
|
<pre><code>dotnet add package GateIo.Net</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="install-htx" role="tabpanel" aria-labelledby="install-htx-tab">
|
|
<pre><code>dotnet add package JKorf.HTX.Net</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="install-hyperliquid" role="tabpanel" aria-labelledby="install-hyperliquid-tab">
|
|
<pre><code>dotnet add package HyperLiquid.Net</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="install-kraken" role="tabpanel" aria-labelledby="install-kraken-tab">
|
|
<pre><code>dotnet add package KrakenExchange.Net</code></pre>
|
|
<img src="assets/images/KrakenInstall.png" />
|
|
</div>
|
|
<div class="tab-pane fade" id="install-kucoin" role="tabpanel" aria-labelledby="install-kucoin-tab">
|
|
<pre><code>dotnet add package Kucoin.Net</code></pre>
|
|
<img src="assets/images/KucoinInstall.png" />
|
|
</div>
|
|
<div class="tab-pane fade" id="install-mexc" role="tabpanel" aria-labelledby="install-mexc-tab">
|
|
<pre><code>dotnet add package JK.Mexc.Net</code></pre>
|
|
<img src="assets/images/MexcInstall.png" />
|
|
</div>
|
|
<div class="tab-pane fade" id="install-okx" role="tabpanel" aria-labelledby="install-okx-tab">
|
|
<pre><code>dotnet add package JK.OKX.Net</code></pre>
|
|
<img src="assets/images/OKXInstall.png" />
|
|
</div>
|
|
<div class="tab-pane fade" id="install-whitebit" role="tabpanel" aria-labelledby="install-whitebit-tab">
|
|
<pre><code>dotnet add package WhiteBit.Net</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="install-xt" role="tabpanel" aria-labelledby="install-xt-tab">
|
|
<pre><code>dotnet add package XT.Net</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- HTML Structure
|
|
============================ -->
|
|
<section id="idocs_di">
|
|
<h2>Dependency Injection</h2>
|
|
<p>
|
|
All client libraries support and encourage usage via the Dotnet dependency injection system. Add all necesary services per exchange by calling the <code>Add[Library]();</code> extension method on the service collection, or use <code>AddCryptoClients()</code> to add all exchange services in a single class. Options for the clients can be passed as parameters or read from the configuration. See <a href="#idocs_options_set">Options</a>.
|
|
</p>
|
|
<div class="alert alert-info">Using the dependecy injection mechanism also makes sure the HttpClient is used correctly</div>
|
|
<div class="tab-wrap">
|
|
<ul class="nav nav-tabs" id="di" role="tablist" style="margin-bottom: -16px;">
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link active" id="di-cc-tab" data-toggle="tab" href="#di-cc" role="tab" aria-controls="di-cc" aria-selected="true">CryptoClients</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="di-binance-tab" data-toggle="tab" href="#di-binance" role="tab" aria-controls="di-binance" aria-selected="true">Binance</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="di-bingx-tab" data-toggle="tab" href="#di-bingx" role="tab" aria-controls="di-bingx" aria-selected="false">BingX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="di-bitfinex-tab" data-toggle="tab" href="#di-bitfinex" role="tab" aria-controls="di-bitfinex" aria-selected="false">Bitfinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="di-bitget-tab" data-toggle="tab" href="#di-bitget" role="tab" aria-controls="di-bitget" aria-selected="false">Bitget</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="di-bitmart-tab" data-toggle="tab" href="#di-bitmart" role="tab" aria-controls="di-bitmart" aria-selected="false">BitMart</a>
|
|
</li>
|
|
<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>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="di-coinex-tab" data-toggle="tab" href="#di-coinex" role="tab" aria-controls="di-coinex" aria-selected="false">Coinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="di-cryptocom-tab" data-toggle="tab" href="#di-cryptocom" role="tab" aria-controls="di-cryptocom" aria-selected="false">Crypto.com</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="di-gateio-tab" data-toggle="tab" href="#di-gateio" role="tab" aria-controls="di-gateio" aria-selected="false">GateIo</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="di-htx-tab" data-toggle="tab" href="#di-htx" role="tab" aria-controls="di-htx" aria-selected="false">HTX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="di-hyperliquid-tab" data-toggle="tab" href="#di-hyperliquid" role="tab" aria-controls="di-hyperliquid" aria-selected="false">HyperLiquid</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="di-kraken-tab" data-toggle="tab" href="#di-kraken" role="tab" aria-controls="di-kraken" aria-selected="false">Kraken</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="di-kucoin-tab" data-toggle="tab" href="#di-kucoin" role="tab" aria-controls="di-kucoin" aria-selected="false">Kucoin</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="di-mexc-tab" data-toggle="tab" href="#di-mexc" role="tab" aria-controls="di-mexc" aria-selected="false">Mexc</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="di-okx-tab" data-toggle="tab" href="#di-okx" role="tab" aria-controls="di-okx" aria-selected="false">OKX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="di-whitebit-tab" data-toggle="tab" href="#di-whitebit" role="tab" aria-controls="di-whitebit" aria-selected="false">WhiteBit</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="di-xt-tab" data-toggle="tab" href="#di-xt" role="tab" aria-controls="di-xt" aria-selected="false">XT</a>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content my-3" id="myTabContent">
|
|
<div class="tab-pane fade show active" id="di-cc" role="tabpanel" aria-labelledby="di-cc-tab">
|
|
<pre><code>builder.Services.AddCryptoClients();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="di-binance" role="tabpanel" aria-labelledby="di-binance-tab">
|
|
<pre><code>builder.Services.AddBinance();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="di-bingx" role="tabpanel" aria-labelledby="di-bingx-tab">
|
|
<pre><code>builder.Services.AddBingX();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="di-bitfinex" role="tabpanel" aria-labelledby="di-bitfinex-tab">
|
|
<pre><code>builder.Services.AddBitfinex();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="di-bitget" role="tabpanel" aria-labelledby="di-bitget-tab">
|
|
<pre><code>builder.Services.AddBitget();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="di-bitmart" role="tabpanel" aria-labelledby="di-bitmart-tab">
|
|
<pre><code>builder.Services.AddBitMart();</code></pre>
|
|
</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>
|
|
</div>
|
|
<div class="tab-pane fade" id="di-coinex" role="tabpanel" aria-labelledby="di-coinex-tab">
|
|
<pre><code>builder.Services.AddCoinEx();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="di-cryptocom" role="tabpanel" aria-labelledby="di-cryptocom-tab">
|
|
<pre><code>builder.Services.AddCryptoCom();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="di-gateio" role="tabpanel" aria-labelledby="di-gateio-tab">
|
|
<pre><code>builder.Services.AddGateIo();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="di-htx" role="tabpanel" aria-labelledby="di-htx-tab">
|
|
<pre><code>builder.Services.AddHTX();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="di-hyperliquid" role="tabpanel" aria-labelledby="di-hyperliquid-tab">
|
|
<pre><code>builder.Services.AddHyperLiquid();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="di-kraken" role="tabpanel" aria-labelledby="di-kraken-tab">
|
|
<pre><code>builder.Services.AddKraken();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="di-kucoin" role="tabpanel" aria-labelledby="di-kucoin-tab">
|
|
<pre><code>builder.Services.AddKucoin();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="di-mexc" role="tabpanel" aria-labelledby="di-mexc-tab">
|
|
<pre><code>builder.Services.AddMexc();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="di-okx" role="tabpanel" aria-labelledby="di-okx-tab">
|
|
<pre><code>builder.Services.AddOKX();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="di-whitebit" role="tabpanel" aria-labelledby="di-whitebit-tab">
|
|
<pre><code>builder.Services.AddWhiteBit();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="di-xt" role="tabpanel" aria-labelledby="di-xt-tab">
|
|
<pre><code>builder.Services.AddXT();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<p>This registers the following interfaces which can then be injected</p>
|
|
<div class="tab-wrap">
|
|
<ul class="nav nav-tabs" id="interfaces" role="tablist" style="margin-bottom: -16px;">
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link active" id="interfaces-cc-tab" data-toggle="tab" href="#interfaces-cc" role="tab" aria-controls="interfaces-cc" aria-selected="true">CryptoClients</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="interfaces-binance-tab" data-toggle="tab" href="#interfaces-binance" role="tab" aria-controls="interfaces-binance" aria-selected="false">Binance</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="interfaces-bingx-tab" data-toggle="tab" href="#interfaces-bingx" role="tab" aria-controls="interfaces-bingx" aria-selected="false">BingX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="interfaces-bitfinex-tab" data-toggle="tab" href="#interfaces-bitfinex" role="tab" aria-controls="interfaces-bitfinex" aria-selected="false">Bitfinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="interfaces-bitget-tab" data-toggle="tab" href="#interfaces-bitget" role="tab" aria-controls="interfaces-bitget" aria-selected="false">Bitget</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="interfaces-bitmart-tab" data-toggle="tab" href="#interfaces-bitmart" role="tab" aria-controls="interfaces-bitmart" aria-selected="false">BitMart</a>
|
|
</li>
|
|
<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>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="interfaces-coinex-tab" data-toggle="tab" href="#interfaces-coinex" role="tab" aria-controls="interfaces-coinex" aria-selected="false">Coinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="interfaces-cryptocom-tab" data-toggle="tab" href="#interfaces-cryptocom" role="tab" aria-controls="interfaces-cryptocom" aria-selected="false">Crypto.com</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="interfaces-gateio-tab" data-toggle="tab" href="#interfaces-gateio" role="tab" aria-controls="interfaces-gateio" aria-selected="false">GateIo</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="interfaces-htx-tab" data-toggle="tab" href="#interfaces-htx" role="tab" aria-controls="interfaces-htx" aria-selected="false">HTX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="interfaces-hyperliquid-tab" data-toggle="tab" href="#interfaces-hyperliquid" role="tab" aria-controls="interfaces-hyperliquid" aria-selected="false">HyperLiquid</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="interfaces-kraken-tab" data-toggle="tab" href="#interfaces-kraken" role="tab" aria-controls="interfaces-kraken" aria-selected="false">Kraken</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="interfaces-kucoin-tab" data-toggle="tab" href="#interfaces-kucoin" role="tab" aria-controls="interfaces-kucoin" aria-selected="false">Kucoin</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="interfaces-mexc-tab" data-toggle="tab" href="#interfaces-mexc" role="tab" aria-controls="interfaces-mexc" aria-selected="false">Mexc</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="interfaces-okx-tab" data-toggle="tab" href="#interfaces-okx" role="tab" aria-controls="interfaces-okx" aria-selected="false">OKX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="interfaces-whitebit-tab" data-toggle="tab" href="#interfaces-whitebit" role="tab" aria-controls="interfaces-whitebit" aria-selected="false">WhiteBit</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="interfaces-xt-tab" data-toggle="tab" href="#interfaces-xt" role="tab" aria-controls="interfaces-xt" aria-selected="false">XT</a>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content my-3" id="myTabContent">
|
|
<div class="tab-pane fade show active" id="interfaces-cc" role="tabpanel" aria-labelledby="interfaces-cc-tab">
|
|
<table class="table table-bordered">
|
|
<tr><th>Interface</th><th>Description</th></tr>
|
|
<tr>
|
|
<td><code>IExchangeRestClient</code></td>
|
|
<td>The client for accessing all exchanges REST API's</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IExchangeSocketClient</code></td>
|
|
<td>The client for accessing all exchanges Websocket API's</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IExchangeOrderBookFactory</code></td>
|
|
<td>A factory class for accessing all exchanges SymbolOrderBook (locally synced order books) factory methods, (see <a href="#idocs_orderbooks">orderbooks</a>)</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IExchangeTrackerFactory</code></td>
|
|
<td>A factory class for creating Kline and Trade trackers (see <a href="#idocs_trackers">trackers</a>)</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>I[Library]RestClient</code></td>
|
|
<td>All exchange specific REST clients, for example <code>IBinanceRestClient</code> and <code>IMexcRestClient</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>I[Library]SocketClient</code></td>
|
|
<td>All exchange specific Websocket clients, for example <code>IBinanceSocketClient</code> and <code>IMexcSocketClient</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>I[Library]OrderBookFactory</code></td>
|
|
<td>All exchange specific order book factories. The factory can be used for creating SymbolOrderBook (locally synced order books) instances for the exchange</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-binance" role="tabpanel" aria-labelledby="interfaces-binance-tab">
|
|
<table class="table table-bordered">
|
|
<tr><th>Interface</th><th>Description</th></tr>
|
|
<tr>
|
|
<td><code>IBinanceRestClient</code></td>
|
|
<td>The client for accessing the Binance REST API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IBinanceSocketClient</code></td>
|
|
<td>The client for accessing the Binance Websocket API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IBinanceOrderBookFactory</code></td>
|
|
<td>A factory for creating SymbolOrderBook instances for the Binance API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IBinanceTrackerFactory</code></td>
|
|
<td>A factory for creating kline and trade Tracker instances for the Binance 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-bingx" role="tabpanel" aria-labelledby="interfaces-bingx-tab">
|
|
<table class="table table-bordered">
|
|
<tr><th>Interface</th><th>Description</th></tr>
|
|
<tr>
|
|
<td><code>IBingXRestClient</code></td>
|
|
<td>The client for accessing the BingX REST API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IBingXSocketClient</code></td>
|
|
<td>The client for accessing the BingX Websocket API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IBingXOrderBookFactory</code></td>
|
|
<td>A factory for creating SymbolOrderBook instances for the BingX API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IBingXTrackerFactory</code></td>
|
|
<td>A factory for creating kline and trade Tracker instances for the BingX 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-bitfinex" role="tabpanel" aria-labelledby="interfaces-bitfinex-tab">
|
|
<table class="table table-bordered">
|
|
<tr><th>Interface</th><th>Description</th></tr>
|
|
<tr>
|
|
<td><code>IBitfinexRestClient</code></td>
|
|
<td>The client for accessing the Bitfinex REST API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IBitfinexSocketClient</code></td>
|
|
<td>The client for accessing the Bitfinex Websocket API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IBitfinexOrderBookFactory</code></td>
|
|
<td>A factory for creating SymbolOrderBook instances for the Bitfinex API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IBitfinexTrackerFactory</code></td>
|
|
<td>A factory for creating kline and trade Tracker instances for the Bitfinex 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-bitget" role="tabpanel" aria-labelledby="interfaces-bitget-tab">
|
|
<table class="table table-bordered">
|
|
<tr><th>Interface</th><th>Description</th></tr>
|
|
<tr>
|
|
<td><code>IBitgetRestClient</code></td>
|
|
<td>The client for accessing the Bitget REST API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IBitgetSocketClient</code></td>
|
|
<td>The client for accessing the Bitget Websocket API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IBitgetOrderBookFactory</code></td>
|
|
<td>A factory for creating SymbolOrderBook instances for the Bitget API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IBitgetTrackerFactory</code></td>
|
|
<td>A factory for creating kline and trade Tracker instances for the Bitget 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-bitmart" role="tabpanel" aria-labelledby="interfaces-bitmart-tab">
|
|
<table class="table table-bordered">
|
|
<tr><th>Interface</th><th>Description</th></tr>
|
|
<tr>
|
|
<td><code>IBitMartRestClient</code></td>
|
|
<td>The client for accessing the BitMart REST API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IBitMartSocketClient</code></td>
|
|
<td>The client for accessing the BitMart Websocket API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IBitMartOrderBookFactory</code></td>
|
|
<td>A factory for creating SymbolOrderBook instances for the Bitget API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IBitMartTrackerFactory</code></td>
|
|
<td>A factory for creating kline and trade Tracker instances for the BitMart 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-bybit" role="tabpanel" aria-labelledby="interfaces-bybit-tab">
|
|
<table class="table table-bordered">
|
|
<tr><th>Interface</th><th>Description</th></tr>
|
|
<tr>
|
|
<td><code>IBybitRestClient</code></td>
|
|
<td>The client for accessing the Bybit REST API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IBybitSocketClient</code></td>
|
|
<td>The client for accessing the Bybit Websocket API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IBybitOrderBookFactory</code></td>
|
|
<td>A factory for creating SymbolOrderBook instances for the Bybit API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IBybitTrackerFactory</code></td>
|
|
<td>A factory for creating kline and trade Tracker instances for the Bybit 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-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>ICoinbaseTrackerFactory</code></td>
|
|
<td>A factory for creating kline and trade Tracker 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>
|
|
<tr>
|
|
<td><code>ICoinGeckoRestClient</code></td>
|
|
<td>The client for accessing the CoinGecko REST 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>
|
|
</table>
|
|
</div>
|
|
<div class="tab-pane fade" id="interfaces-coinex" role="tabpanel" aria-labelledby="interfaces-coinex-tab">
|
|
<table class="table table-bordered">
|
|
<tr><th>Interface</th><th>Description</th></tr>
|
|
<tr>
|
|
<td><code>ICoinExRestClient</code></td>
|
|
<td>The client for accessing the CoinEx REST API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>ICoinExSocketClient</code></td>
|
|
<td>The client for accessing the CoinEx Websocket API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>ICoinExOrderBookFactory</code></td>
|
|
<td>A factory for creating SymbolOrderBook instances for the CoinEx API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>ICoinExTrackerFactory</code></td>
|
|
<td>A factory for creating kline and trade Tracker instances for the CoinEx 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-cryptocom" role="tabpanel" aria-labelledby="interfaces-cryptocom-tab">
|
|
<table class="table table-bordered">
|
|
<tr><th>Interface</th><th>Description</th></tr>
|
|
<tr>
|
|
<td><code>ICryptoComRestClient</code></td>
|
|
<td>The client for accessing the Crypto.com REST API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>ICryptoComSocketClient</code></td>
|
|
<td>The client for accessing the Crypto.com Websocket API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>ICryptoComOrderBookFactory</code></td>
|
|
<td>A factory for creating SymbolOrderBook instances for the Crypto.com API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>ICryptoComTrackerFactory</code></td>
|
|
<td>A factory for creating kline and trade Tracker instances for the Crypto.com 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-gateio" role="tabpanel" aria-labelledby="interfaces-gateio-tab">
|
|
<table class="table table-bordered">
|
|
<tr><th>Interface</th><th>Description</th></tr>
|
|
<tr>
|
|
<td><code>IGateIoRestClient</code></td>
|
|
<td>The client for accessing the GateIo REST API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IGateIoSocketClient</code></td>
|
|
<td>The client for accessing the GateIo Websocket API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IGateIoOrderBookFactory</code></td>
|
|
<td>A factory for creating SymbolOrderBook instances for the GateIo API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IGateIoTrackerFactory</code></td>
|
|
<td>A factory for creating kline and trade Tracker instances for the GateIo 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-htx" role="tabpanel" aria-labelledby="interfaces-htx-tab">
|
|
<table class="table table-bordered">
|
|
<tr><th>Interface</th><th>Description</th></tr>
|
|
<tr>
|
|
<td><code>IHTXRestClient</code></td>
|
|
<td>The client for accessing the HTX REST API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IHTXSocketClient</code></td>
|
|
<td>The client for accessing the HTX Websocket API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IHTXOrderBookFactory</code></td>
|
|
<td>A factory for creating SymbolOrderBook instances for the HTX API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IHTXTrackerFactory</code></td>
|
|
<td>A factory for creating kline and trade Tracker instances for the HTX 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-hyperliquid" role="tabpanel" aria-labelledby="interfaces-hyperliquid-tab">
|
|
<table class="table table-bordered">
|
|
<tr><th>Interface</th><th>Description</th></tr>
|
|
<tr>
|
|
<td><code>IHyperLiquidRestClient</code></td>
|
|
<td>The client for accessing the HyperLiquid REST API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IHyperLiquidSocketClient</code></td>
|
|
<td>The client for accessing the HyperLiquid Websocket API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IHyperLiquidOrderBookFactory</code></td>
|
|
<td>A factory for creating SymbolOrderBook instances for the HyperLiquid API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IHyperLiquidTrackerFactory</code></td>
|
|
<td>A factory for creating kline and trade Tracker instances for the HyperLiquid 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-kraken" role="tabpanel" aria-labelledby="interfaces-kraken-tab">
|
|
<table class="table table-bordered">
|
|
<tr><th>Interface</th><th>Description</th></tr>
|
|
<tr>
|
|
<td><code>IKrakenRestClient</code></td>
|
|
<td>The client for accessing the Kraken REST API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IKrakenSocketClient</code></td>
|
|
<td>The client for accessing the Kraken Websocket API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IKrakenOrderBookFactory</code></td>
|
|
<td>A factory for creating SymbolOrderBook instances for the Kraken API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IKrakenTrackerFactory</code></td>
|
|
<td>A factory for creating kline and trade Tracker instances for the Kraken 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-kucoin" role="tabpanel" aria-labelledby="interfaces-kucoin-tab">
|
|
<table class="table table-bordered">
|
|
<tr><th>Interface</th><th>Description</th></tr>
|
|
<tr>
|
|
<td><code>IKucoinRestClient</code></td>
|
|
<td>The client for accessing the Kucoin REST API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IKucoinSocketClient</code></td>
|
|
<td>The client for accessing the Kucoin Websocket API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IKucoinOrderBookFactory</code></td>
|
|
<td>A factory for creating SymbolOrderBook instances for the Kucoin API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IKucoinTrackerFactory</code></td>
|
|
<td>A factory for creating kline and trade Tracker instances for the Kucoin 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-mexc" role="tabpanel" aria-labelledby="interfaces-mexc-tab">
|
|
<table class="table table-bordered">
|
|
<tr><th>Interface</th><th>Description</th></tr>
|
|
<tr>
|
|
<td><code>IMexcRestClient</code></td>
|
|
<td>The client for accessing the Mexc REST API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IMexcSocketClient</code></td>
|
|
<td>The client for accessing the Mexc Websocket API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IMexcOrderBookFactory</code></td>
|
|
<td>A factory for creating SymbolOrderBook instances for the Mexc API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IMexcTrackerFactory</code></td>
|
|
<td>A factory for creating kline and trade Tracker instances for the Mexc 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-okx" role="tabpanel" aria-labelledby="interfaces-okx-tab">
|
|
<table class="table table-bordered">
|
|
<tr><th>Interface</th><th>Description</th></tr>
|
|
<tr>
|
|
<td><code>IOKXRestClient</code></td>
|
|
<td>The client for accessing the OKX REST API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IOKXSocketClient</code></td>
|
|
<td>The client for accessing the OKX Websocket API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IOKXOrderBookFactory</code></td>
|
|
<td>A factory for creating SymbolOrderBook instances for the OKX API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IOKXTrackerFactory</code></td>
|
|
<td>A factory for creating kline and trade Tracker instances for the OKX 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-whitebit" role="tabpanel" aria-labelledby="interfaces-whitebit-tab">
|
|
<table class="table table-bordered">
|
|
<tr><th>Interface</th><th>Description</th></tr>
|
|
<tr>
|
|
<td><code>IWhiteBitRestClient</code></td>
|
|
<td>The client for accessing the WhiteBit REST API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IWhiteBitSocketClient</code></td>
|
|
<td>The client for accessing the WhiteBit Websocket API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IWhiteBitOrderBookFactory</code></td>
|
|
<td>A factory for creating SymbolOrderBook instances for the WhiteBit API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IWhiteBitTrackerFactory</code></td>
|
|
<td>A factory for creating kline and trade Tracker instances for the WhiteBit 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-xt" role="tabpanel" aria-labelledby="interfaces-xt-tab">
|
|
<table class="table table-bordered">
|
|
<tr><th>Interface</th><th>Description</th></tr>
|
|
<tr>
|
|
<td><code>IXTRestClient</code></td>
|
|
<td>The client for accessing the XT REST API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IXTSocketClient</code></td>
|
|
<td>The client for accessing the XT Websocket API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IXTOrderBookFactory</code></td>
|
|
<td>A factory for creating SymbolOrderBook instances for the XT API</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>IXTTrackerFactory</code></td>
|
|
<td>A factory for creating kline and trade Tracker instances for the XT 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>
|
|
</div>
|
|
</section>
|
|
|
|
<hr class="divider">
|
|
|
|
<section id="idocs_general">
|
|
<h2>General client usage</h2>
|
|
<p>All clients work with the same principles:</p>
|
|
<ul>
|
|
<li>Mandatory parameters are non-nullable while optional parameters are nullable and will have a default value of null.</li>
|
|
<li>Any operation will return a form of <code>CallResult</code>. This result can and should be checked for success using the <code>Success</code> property. If <code>Success</code> is false the <code>Error</code> property will have more info.</li>
|
|
<li>Clients will not throw exceptions.</li>
|
|
</ul>
|
|
</section>
|
|
|
|
<!-- HTML Structure
|
|
============================ -->
|
|
<section id="idocs_rest">
|
|
<h2>REST API client</h2>
|
|
<p>Each library provides a REST API client. This client follows the following naming convention: <code>[Library]RestClient</code>. The REST API client is split into different sub-API access clients, which in turn are split into different topics. This structure is the same for each library, which makes it easier to navigate the clients.</p>
|
|
|
|
<p>The client can be injected via <a href="#di">dependency injection</a>, or constructed manually.</p>
|
|
<div class="tab-wrap">
|
|
<ul class="nav nav-tabs" id="rest" role="tablist" style="margin-bottom: -16px;">
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link active" id="rest-cc-tab" data-toggle="tab" href="#rest-cc" role="tab" aria-controls="rest-cc" aria-selected="true">CryptoClients</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="rest-binance-tab" data-toggle="tab" href="#rest-binance" role="tab" aria-controls="rest-binance" aria-selected="true">Binance</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="rest-bingx-tab" data-toggle="tab" href="#rest-bingx" role="tab" aria-controls="rest-bingx" aria-selected="false">BingX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="rest-bitfinex-tab" data-toggle="tab" href="#rest-bitfinex" role="tab" aria-controls="rest-bitfinex" aria-selected="false">Bitfinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="rest-bitget-tab" data-toggle="tab" href="#rest-bitget" role="tab" aria-controls="rest-bitget" aria-selected="false">Bitget</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="rest-bitmart-tab" data-toggle="tab" href="#rest-bitmart" role="tab" aria-controls="rest-bitmart" aria-selected="false">BitMart</a>
|
|
</li>
|
|
<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>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="rest-coinex-tab" data-toggle="tab" href="#rest-coinex" role="tab" aria-controls="rest-coinex" aria-selected="false">Coinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="rest-cryptocom-tab" data-toggle="tab" href="#rest-cryptocom" role="tab" aria-controls="rest-cryptocom" aria-selected="false">Crypto.com</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="rest-gateio-tab" data-toggle="tab" href="#rest-gateio" role="tab" aria-controls="rest-gateio" aria-selected="false">GateIo</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="rest-htx-tab" data-toggle="tab" href="#rest-htx" role="tab" aria-controls="rest-htx" aria-selected="false">HTX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="rest-hyperliquid-tab" data-toggle="tab" href="#rest-hyperliquid" role="tab" aria-controls="rest-hyperliquid" aria-selected="false">HyperLiquid</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="rest-kraken-tab" data-toggle="tab" href="#rest-kraken" role="tab" aria-controls="rest-kraken" aria-selected="false">Kraken</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="rest-kucoin-tab" data-toggle="tab" href="#rest-kucoin" role="tab" aria-controls="rest-kucoin" aria-selected="false">Kucoin</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="rest-mexc-tab" data-toggle="tab" href="#rest-mexc" role="tab" aria-controls="rest-mexc" aria-selected="false">Mexc</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="rest-okx-tab" data-toggle="tab" href="#rest-okx" role="tab" aria-controls="rest-okx" aria-selected="false">OKX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="rest-whitebit-tab" data-toggle="tab" href="#rest-whitebit" role="tab" aria-controls="rest-whitebit" aria-selected="false">WhiteBit</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="rest-xt-tab" data-toggle="tab" href="#rest-xt" role="tab" aria-controls="rest-xt" aria-selected="false">XT</a>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content my-3" id="myTabContent">
|
|
<div class="tab-pane fade show active" id="rest-cc" role="tabpanel" aria-labelledby="rest-cc-tab">
|
|
<pre><code>var client = new ExchangeRestClient();
|
|
var tickersResult = await client.Binance.SpotApi.ExchangeData.GetTickersAsync();
|
|
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-binance" role="tabpanel" aria-labelledby="rest-binance-tab">
|
|
<pre><code>var client = new BinanceRestClient();
|
|
var tickersResult = await client.SpotApi.ExchangeData.GetTickersAsync();
|
|
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-bingx" role="tabpanel" aria-labelledby="rest-bingx-tab">
|
|
<pre><code>var client = new BingXRestClient();
|
|
var tickersResult = await client.SpotApi.ExchangeData.GetTickersAsync();
|
|
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-bitfinex" role="tabpanel" aria-labelledby="rest-bitfinex-tab">
|
|
<pre><code>var client = new BitfinexRestClient();
|
|
var tickersResult = await client.SpotApi.ExchangeData.GetTickersAsync();
|
|
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-bitget" role="tabpanel" aria-labelledby="rest-bitget-tab">
|
|
<pre><code>var client = new BitgetRestClient();
|
|
var tickersResult = await client.SpotApi.ExchangeData.GetTickersAsync();
|
|
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-bitmart" role="tabpanel" aria-labelledby="rest-bitmart-tab">
|
|
<pre><code>var client = new BitMartRestClient();
|
|
var tickersResult = await client.SpotApi.ExchangeData.GetTickersAsync();
|
|
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-bybit" role="tabpanel" aria-labelledby="rest-bybit-tab">
|
|
<pre><code>var client = new BybitRestClient();
|
|
var tickersResult = await client.V5Api.ExchangeData.GetSpotTickersAsync();
|
|
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>
|
|
</div>
|
|
<div class="tab-pane fade" id="rest-coingecko" role="tabpanel" aria-labelledby="rest-coingecko-tab">
|
|
<pre><code>var client = new CoinGeckoRestClient();
|
|
var assetsResult = await client.Api.GetAssetsAsync();
|
|
if (!assetsResult.Success)
|
|
{
|
|
// Handle error, assetsResult.Error contains more information
|
|
}
|
|
else
|
|
{
|
|
// Handle data, assetsResult.Data will contain the actual data
|
|
}</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="rest-coinex" role="tabpanel" aria-labelledby="rest-coinex-tab">
|
|
<pre><code>var client = new CoinExRestClient();
|
|
var tickersResult = await client.SpotApiV2.ExchangeData.GetTickersAsync();
|
|
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-cryptocom" role="tabpanel" aria-labelledby="rest-cryptocom-tab">
|
|
<pre><code>var client = new CryptoComRestClient();
|
|
var tickersResult = await client.ExchangeApi.ExchangeData.GetTickersAsync();
|
|
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-gateio" role="tabpanel" aria-labelledby="rest-gateio-tab">
|
|
<pre><code>var client = new GateIoRestClient();
|
|
var tickersResult = await client.SpotApi.ExchangeData.GetTickersAsync();
|
|
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-htx" role="tabpanel" aria-labelledby="rest-htx-tab">
|
|
<pre><code>var client = new HTXRestClient();
|
|
var tickersResult = await client.SpotApi.ExchangeData.GetTickersAsync();
|
|
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-hyperliquid" role="tabpanel" aria-labelledby="rest-hyperliquid-tab">
|
|
<pre><code>var client = new HyperLiquidRestClient();
|
|
var tickersResult = await client.SpotApi.ExchangeData.GetExchangeInfoAndTickersAsync();
|
|
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-kraken" role="tabpanel" aria-labelledby="rest-kraken-tab">
|
|
<pre><code>var client = new KrakenRestClient();
|
|
var tickersResult = await client.SpotApi.ExchangeData.GetTickersAsync();
|
|
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-kucoin" role="tabpanel" aria-labelledby="rest-kucoin-tab">
|
|
<pre><code>var client = new KucoinRestClient();
|
|
var tickersResult = await client.SpotApi.ExchangeData.GetTickersAsync();
|
|
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-mexc" role="tabpanel" aria-labelledby="rest-mexc-tab">
|
|
<pre><code>var client = new MexcRestClient();
|
|
var tickersResult = await client.SpotApi.ExchangeData.GetTickersAsync();
|
|
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-okx" role="tabpanel" aria-labelledby="rest-okx-tab">
|
|
<pre><code>var client = new OKXRestClient();
|
|
var tickersResult = await client.UnifiedApi.ExchangeData.GetTickersAsync(OKXInstrumentType.Spot);
|
|
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-whitebit" role="tabpanel" aria-labelledby="rest-whitebit-tab">
|
|
<pre><code>var client = new WhiteBitRestClient();
|
|
var tickersResult = await client.V4Api.ExchangeData.GetTickersAsync();
|
|
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-xt" role="tabpanel" aria-labelledby="rest-xt-tab">
|
|
<pre><code>var client = new XTRestClient();
|
|
var tickersResult = await client.SpotApi.ExchangeData.GetTickersAsync();
|
|
if (!tickersResult.Success)
|
|
{
|
|
// Handle error, tickersResult.Error contains more information
|
|
}
|
|
else
|
|
{
|
|
// Handle data, tickersResult.Data will contain the actual data
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<p><b>The response object</b></p>
|
|
<p>Calls made with the REST API client will return a <code>WebCallResult</code> object. This object contains information about both the request that was send and the response that was received. The <code>WebCallResult</code> object exposes the following properties:</p>
|
|
<table class="table table-bordered">
|
|
<tr><th>Property</th><th>Description</th></tr>
|
|
<tr>
|
|
<td>Success</td>
|
|
<td>Whether or not the call was completed successfully</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Data</td>
|
|
<td>The parsed response object, only available when <code>Success</code> is <code>true</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Error</td>
|
|
<td>Error information, only available when <code>Success</code> is <code>false</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>OriginalData</td>
|
|
<td>The raw response data, only filled when the <code>OutputOriginalData</code> is enabled in the client options</td>
|
|
</tr>
|
|
<tr>
|
|
<td>RequestMethod</td>
|
|
<td>The HTTP method that was used for the request</td>
|
|
</tr>
|
|
<tr>
|
|
<td>RequestHeaders</td>
|
|
<td>The list of headers which were send with the request</td>
|
|
</tr>
|
|
<tr>
|
|
<td>RequestId</td>
|
|
<td>A unique request id</td>
|
|
</tr>
|
|
<tr>
|
|
<td>RequestUrl</td>
|
|
<td>The full urls which was called</td>
|
|
</tr>
|
|
<tr>
|
|
<td>RequestBody</td>
|
|
<td>The request body send with the request</td>
|
|
</tr>
|
|
<tr>
|
|
<td>ResponseLength</td>
|
|
<td>The length of the response in bytes</td>
|
|
</tr>
|
|
<tr>
|
|
<td>ResponseHeaders</td>
|
|
<td>The list of headers send along with the response</td>
|
|
</tr>
|
|
<tr>
|
|
<td>ResponseTime</td>
|
|
<td>The time it took from sending the request to receiving the response</td>
|
|
</tr>
|
|
</table>
|
|
|
|
</section>
|
|
|
|
<hr class="divider">
|
|
|
|
<!-- Sass
|
|
============================ -->
|
|
<section id="idocs_socket">
|
|
<h2>Websocket API client</h2>
|
|
<p>If the API supports websocket connections then the library provides a Websocket API client. This client follows the following naming convention: <code>[Library]SocketClient</code>. The Websocket API client is split into different sub-API access clients, which in turn are sometimes split into different topics. This structure is the same for each library, which makes it easier to navigate the clients.</p>
|
|
|
|
<p>The client can be injected via <a href="#di">dependency injection</a>, or constructed manually. When constructing manually keep in mind that when the client is disposed all connections will get closed as well.</p>
|
|
|
|
<div class="alert alert-info">The socket client requires a continous connection to the server. The connection can be lost due to internet interuptions, or the server disconnecting the client. This is expected behaviour and the socket client will automatically reconnect when this happens.</div>
|
|
|
|
<h4>Subscribing</h4>
|
|
<div class="tab-wrap">
|
|
<ul class="nav nav-tabs" id="socket" role="tablist" style="margin-bottom: -16px;">
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link active" id="socket-cc-tab" data-toggle="tab" href="#socket-cc" role="tab" aria-controls="socket-cc" aria-selected="true">CryptoClients</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="socket-binance-tab" data-toggle="tab" href="#socket-binance" role="tab" aria-controls="socket-binance" aria-selected="true">Binance</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="socket-bingx-tab" data-toggle="tab" href="#socket-bingx" role="tab" aria-controls="socket-bingx" aria-selected="false">BingX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="socket-bitfinex-tab" data-toggle="tab" href="#socket-bitfinex" role="tab" aria-controls="socket-bitfinex" aria-selected="false">Bitfinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="socket-bitget-tab" data-toggle="tab" href="#socket-bitget" role="tab" aria-controls="socket-bitget" aria-selected="false">Bitget</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="socket-bitmart-tab" data-toggle="tab" href="#socket-bitmart" role="tab" aria-controls="socket-bitmart" aria-selected="false">BitMart</a>
|
|
</li>
|
|
<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>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="socket-cryptocom-tab" data-toggle="tab" href="#socket-cryptocom" role="tab" aria-controls="socket-cryptocom" aria-selected="false">Crypto.com</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="socket-gateio-tab" data-toggle="tab" href="#socket-gateio" role="tab" aria-controls="socket-gateio" aria-selected="false">GateIo</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="socket-htx-tab" data-toggle="tab" href="#socket-htx" role="tab" aria-controls="socket-htx" aria-selected="false">HTX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="socket-hyperliquid-tab" data-toggle="tab" href="#socket-hyperliquid" role="tab" aria-controls="socket-hyperliquid" aria-selected="false">HyperLiquid</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="socket-kraken-tab" data-toggle="tab" href="#socket-kraken" role="tab" aria-controls="socket-kraken" aria-selected="false">Kraken</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="socket-kucoin-tab" data-toggle="tab" href="#socket-kucoin" role="tab" aria-controls="socket-kucoin" aria-selected="false">Kucoin</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="socket-mexc-tab" data-toggle="tab" href="#socket-mexc" role="tab" aria-controls="socket-mexc" aria-selected="false">Mexc</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="socket-okx-tab" data-toggle="tab" href="#socket-okx" role="tab" aria-controls="socket-okx" aria-selected="false">OKX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="socket-whitebit-tab" data-toggle="tab" href="#socket-whitebit" role="tab" aria-controls="socket-whitebit" aria-selected="false">WhiteBit</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="socket-xt-tab" data-toggle="tab" href="#socket-xt" role="tab" aria-controls="socket-xt" aria-selected="false">XT</a>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content my-3" id="myTabContent">
|
|
<div class="tab-pane fade show active" id="socket-cc" role="tabpanel" aria-labelledby="socket-cc-tab">
|
|
<pre><code>var client = new ExchangeSocketClient();
|
|
var subscribeResult = await client.Binance.SpotApi.ExchangeData.SubscribeToAllTickerUpdatesAsync(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-binance" role="tabpanel" aria-labelledby="socket-binance-tab">
|
|
<pre><code>var client = new BinanceSocketClient();
|
|
var subscribeResult = await client.SpotApi.ExchangeData.SubscribeToAllTickerUpdatesAsync(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-bingx" role="tabpanel" aria-labelledby="socket-bingx-tab">
|
|
<pre><code>var client = new BingXSocketClient();
|
|
var subscribeResult = await client.SpotApi.SubscribeToTickerUpdatesAsync("ETH-USDT", 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-bitfinex" role="tabpanel" aria-labelledby="socket-bitfinex-tab">
|
|
<pre><code>var client = new BitfinexSocketClient();
|
|
var subscribeResult = await client.SpotApi.SubscribeToTickerUpdatesAsync("tETHUST", 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-bitget" role="tabpanel" aria-labelledby="socket-bitget-tab">
|
|
<pre><code>var client = new BitgetSocketClient();
|
|
var subscribeResult = await client.SpotApi.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-bitmart" role="tabpanel" aria-labelledby="socket-bitmart-tab">
|
|
<pre><code>var client = new BitMartSocketClient();
|
|
var subscribeResult = await client.SpotApi.SubscribeToTickerUpdatesAsync("ETH_USDT", 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-bybit" role="tabpanel" aria-labelledby="socket-bybit-tab">
|
|
<pre><code>var client = new BybitSocketClient();
|
|
var subscribeResult = await client.V5SpotApi.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-coinbase" role="tabpanel" aria-labelledby="socket-coinbase-tab">
|
|
<pre><code>var client = new CoinbaseSocketClient();
|
|
var subscribeResult = await sclient.AdvancedTradeApi.SubscribeToTickerUpdatesAsync("ETH-USDT", 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">
|
|
<pre><code>var client = new CoinExSocketClient();
|
|
var subscribeResult = await sclient.SpotApiV2.SubscribeToTickerUpdatesAsync(new[] { "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-cryptocom" role="tabpanel" aria-labelledby="socket-cryptocom-tab">
|
|
<pre><code>var client = new CryptoComSocketClient();
|
|
var subscribeResult = await client.ExchangeApi.SubscribeToTickerUpdatesAsync("ETH_USD", 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-gateio" role="tabpanel" aria-labelledby="socket-gateio-tab">
|
|
<pre><code>var client = new GateIoSocketClient();
|
|
var subscribeResult = await client.SpotApi.SubscribeToTickerUpdatesAsync("ETH_USDT", 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-htx" role="tabpanel" aria-labelledby="socket-htx-tab">
|
|
<pre><code>var client = new HTXSocketClient();
|
|
var subscribeResult = await client.SpotApi.SubscribeToTickerUpdatesAsync(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-hyperliquid" role="tabpanel" aria-labelledby="socket-hyperliquid-tab">
|
|
<pre><code>var client = new HyperLiquidSocketClient();
|
|
var subscribeResult = await client.SpotApi.SubscribeToSymbolUpdatesAsync("HYPE/USDC", 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-kraken" role="tabpanel" aria-labelledby="socket-kraken-tab">
|
|
<pre><code>var client = new KrakenSocketClient();
|
|
var subscribeResult = await client.SpotApi.SubscribeToTickerUpdatesAsync("ETH/USD", 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-kucoin" role="tabpanel" aria-labelledby="socket-kucoin-tab">
|
|
<pre><code>var client = new KucoinSocketClient();
|
|
var subscribeResult = await client.SpotApi.SubscribeToAllTickerUpdatesAsync(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-mexc" role="tabpanel" aria-labelledby="socket-mexc-tab">
|
|
<pre><code>var client = new MexcSocketClient();
|
|
var subscribeResult = await client.SpotApi.SubscribeToMiniTickerUpdatesAsync(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-okx" role="tabpanel" aria-labelledby="socket-okx-tab">
|
|
<pre><code>var client = new OKXSocketClient();
|
|
var subscribeResult = await client.UnifiedApi.ExchangeData.SubscribeToTickerUpdatesAsync("ETH-USDT", 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-whitebit" role="tabpanel" aria-labelledby="socket-whitebit-tab">
|
|
<pre><code>var client = new WhiteBitSocketClient();
|
|
var subscribeResult = await client.V4Api.ExchangeData.SubscribeToTickerUpdatesAsync("ETH_USDT", 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-xt" role="tabpanel" aria-labelledby="socket-xt-tab">
|
|
<pre><code>var client = new XTSocketClient();
|
|
var subscribeResult = await client.SpotApi.ExchangeData.SubscribeToTickerUpdatesAsync("eth_usdt", 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>
|
|
</div>
|
|
|
|
<p><b>The subscription result object</b></p>
|
|
<p>Subscriptions calls will return a <code>CallResult<UpdateSubscription></code> object. This object contains information about the status of the intial subscription, and the UpdateSubscription data object exposes events for status changes and methods for managing the subscription. The <code>CallResult<UpdateSubscription></code> object exposes the following properties:</p>
|
|
<table class="table table-bordered">
|
|
<tr><th>Property</th><th>Description</th></tr>
|
|
<tr>
|
|
<td>Success</td>
|
|
<td>Whether or not the subscription was completed successfully</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Error</td>
|
|
<td>Error information, only available when <code>Success</code> is <code>false</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Data</td>
|
|
<td>The <code>UpdateSubscription</code> object, only available when <code>Success</code> is <code>true</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Data.Id</td>
|
|
<td>Unique id of the subscription</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Data.SocketId</td>
|
|
<td>The id of the underlying websocket</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Data.ConnectionLost</td>
|
|
<td>Event which will be invoked whenever the connection to the server is lost and reconnecting will be started</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Data.ConnectionRestored</td>
|
|
<td>Event which will be invoked when the connection to the server is restored after being disconnected</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Data.ActivityPaused</td>
|
|
<td>Event which will be invoked when the server has indicated that currently no operations will be accepted</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Data.ActivityUnpaused</td>
|
|
<td>Event which will be invoked when the server has indicated that operations will be accepted again after a previous ActivityPaused event</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Data.Exception</td>
|
|
<td>Event which will be invoked when the data handler of the subscription throws an exception</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p><b>The subscription update event object</b></p>
|
|
<p>Whenever new data is received for a subscription the data handler will be called with a <code>DataEvent<T></code> object. This object contains information about the event and the actual update data. The <code>DataEvent<T></code> object exposes the following properties:</p>
|
|
<table class="table table-bordered">
|
|
<tr><th>Property</th><th>Description</th></tr>
|
|
<tr>
|
|
<td>Timestamp</td>
|
|
<td>The timestamp the data was received</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Topic</td>
|
|
<td>The topic of the update, typically the symbol or stream name</td>
|
|
</tr>
|
|
<tr>
|
|
<td>OriginalData</td>
|
|
<td>The raw update data, only filled when the <code>OutputOriginalData</code> is enabled in the client options</td></td>
|
|
</tr>
|
|
<tr>
|
|
<td>UpdateType</td>
|
|
<td>The type of update. <code>SocketUpdateType.Snapshot</code> means the update is a snapshot, not an incremental update. <code>SocketUpdateType.Update</code> means it's an update with new data</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Data</td>
|
|
<td>The data received in the update</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<h4>Unsubscribing</h4>
|
|
<p>
|
|
When no longer interested in updates from a specific subscription it can be unsubscribed. This can be done in one of the following ways:
|
|
</p>
|
|
<p>
|
|
<b>Unsubscribe via UpdateSubscription object</b><br />
|
|
When you have the reference to the UpdateSubscription object received from the Subscribe method you can call the <code>CloseAsync()</code> method on that to unsubscribe
|
|
<pre><code>var subscribeResult = await client.SpotApi.SubscribeToTickerUpdates(data => {});
|
|
await subscribeResult.Data.CloseAsync();</code></pre>
|
|
</p>
|
|
<p>
|
|
<b>Unsubscribe via CancellationToken</b><br />
|
|
Passing in a <code>CancellationToken</code> as parameter in the subscribe method will allow you to cancel subscriptions by canceling the token. This can be useful when you need to cancel some streams but not others. In this example, both <code>BTCUSDT</code> and <code>ETHUSDT</code> streams get canceled, while the <code>XRPUSDT</code> stream remains active.
|
|
<pre><code>var cts = new CancellationTokenSource();
|
|
var subscriptionResult1 = await client.SpotApi.SubscribeToTickerUpdatesAsync("BTCUSDT", DataHandler, cts.Token);
|
|
var subscriptionResult2 = await client.SpotApi.SubscribeToTickerUpdatesAsync("ETHUSDT", DataHandler, cts.Token);
|
|
var subscriptionResult3 = await client.SpotApi.SubscribeToTickerUpdatesAsync("XRPUSDT", DataHandler);
|
|
cts.Cancel();</code></pre>
|
|
</p>
|
|
<p>
|
|
<b>Unsubscribe via the websocket client</b><br />
|
|
The Websocket client has multiple ways of unsubscribing one or more subscriptions:
|
|
<pre><code>var subscribeResult = await client.SpotApi.SubscribeToTickerUpdates(data => {});
|
|
// Unsubscribe by passing the UpdateSubscription
|
|
await client.UnsubscribeAsync(subscribeResult.Data);
|
|
// OR store the ID and pass that
|
|
var subId = subscribeResult.Data.Id;
|
|
await client.UnsubscribeAsync(subId);
|
|
// OR unsubscribe all subscriptions at the same time
|
|
await client.UnsubscribeAllAsync();</code></pre>
|
|
</p>
|
|
|
|
</section>
|
|
|
|
<hr class="divider">
|
|
|
|
<!-- Customization
|
|
============================ -->
|
|
<section id="idocs_shared">
|
|
<h2>Cross Exchange Development</h2>
|
|
|
|
<p>Unfortunately there is no standard for exchanges when it comes to the API's they offer. Altough most of them offer roughly the same functionality each of them is structured differently and expects+ differently named and formatted parameters.</p>
|
|
|
|
<p>With this in mind all exhange clients implement various <code>ISharedClient</code> interfaces. These interfaces split the functionality from the exchange specifics allowing for a common implementation for multiple exchanges. Which interfaces are implemented for each exchange depends on what functionality the exchange API offers.</p>
|
|
|
|
<p>The <code>ISharedClient</code> interfaces allow for functionality to be defined once for every exchange instead of (partially) having to implement it for each exchange</p>
|
|
|
|
<pre><code>// Abstract out the exchange request by using the shared ticker interface
|
|
public async Task<SharedSpotTicker?> GetTickerAsync(ISpotTickerRestClient client, SharedSymbol symbol)
|
|
{
|
|
var result = await client.GetSpotTickerAsync(new GetTickerRequest(symbol));
|
|
return result.Data;
|
|
}
|
|
|
|
// Abstract out the exchange response by using the shared response model
|
|
public bool CheckForTrigger(SharedSpotTicker ticker)
|
|
{
|
|
return ticker.HighPrice - ticker.LastPrice > 10;
|
|
}
|
|
|
|
|
|
// Requesting the data from different exchanges
|
|
var sharedSymbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
var lastBybitTicker = await GetTickerAsync(bybitResClient.V5Api.SharedClient, sharedSymbol);
|
|
var lastGateIoTicker = await GetTickerAsync(gateioRestClient.SpotApi.SharedClient, sharedSymbol);
|
|
var lastBinanceTicker = await GetTickerAsync(binanceRestClient.SpotApi.SharedClient, sharedSymbol);
|
|
|
|
// Checking response with different exchange responses
|
|
var bybitTriggered = CheckForTrigger(lastBybitTicker);
|
|
var gateioTriggered = CheckForTrigger(lastGateIoTicker);
|
|
var binanceTriggered = CheckForTrigger(lastBinanceTicker);</code></pre>
|
|
|
|
<p>See <a href="https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/SharedClients">CryptoExchange.Net examples</a> for an example of how to use this. </p>
|
|
|
|
<p>Shared clients for all exchanges:</p>
|
|
<div class="tab-wrap">
|
|
<ul class="nav nav-tabs" id="shared" role="tablist" style="margin-bottom: -16px;">
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link active" id="shared-binance-tab" data-toggle="tab" href="#shared-binance" role="tab" aria-controls="shared-binance" aria-selected="true">Binance</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="shared-bingx-tab" data-toggle="tab" href="#shared-bingx" role="tab" aria-controls="shared-bingx" aria-selected="false">BingX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="shared-bitfinex-tab" data-toggle="tab" href="#shared-bitfinex" role="tab" aria-controls="shared-bitfinex" aria-selected="false">Bitfinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="shared-bitget-tab" data-toggle="tab" href="#shared-bitget" role="tab" aria-controls="shared-bitget" aria-selected="false">Bitget</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="shared-bitmart-tab" data-toggle="tab" href="#shared-bitmart" role="tab" aria-controls="shared-bitmart" aria-selected="false">BitMart</a>
|
|
</li>
|
|
<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>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="shared-gateio-tab" data-toggle="tab" href="#shared-gateio" role="tab" aria-controls="shared-gateio" aria-selected="false">GateIo</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="shared-cryptocom-tab" data-toggle="tab" href="#shared-cryptocom" role="tab" aria-controls="shared-cryptocom" aria-selected="false">Crypto.com</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="shared-htx-tab" data-toggle="tab" href="#shared-htx" role="tab" aria-controls="shared-htx" aria-selected="false">HTX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="shared-hyperliquid-tab" data-toggle="tab" href="#shared-hyperliquid" role="tab" aria-controls="shared-hyperliquid" aria-selected="false">HyperLiquid</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="shared-kraken-tab" data-toggle="tab" href="#shared-kraken" role="tab" aria-controls="shared-kraken" aria-selected="false">Kraken</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="shared-kucoin-tab" data-toggle="tab" href="#shared-kucoin" role="tab" aria-controls="shared-kucoin" aria-selected="false">Kucoin</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="shared-mexc-tab" data-toggle="tab" href="#shared-mexc" role="tab" aria-controls="shared-mexc" aria-selected="false">Mexc</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="shared-okx-tab" data-toggle="tab" href="#shared-okx" role="tab" aria-controls="shared-okx" aria-selected="false">OKX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="shared-whitebit-tab" data-toggle="tab" href="#shared-whitebit" role="tab" aria-controls="shared-whitebit" aria-selected="false">WhiteBit</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="shared-xt-tab" data-toggle="tab" href="#shared-xt" role="tab" aria-controls="shared-xt" aria-selected="false">XT</a>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content my-3" id="myTabContent">
|
|
<div class="tab-pane fade show active" id="shared-binance" role="tabpanel" aria-labelledby="shared-binance-tab">
|
|
<pre><code>// Spot API common functionality rest client
|
|
var spotSharedRestClients = binanceRestClient.SpotApi.SharedClient;
|
|
|
|
// Spot API common functionality socket client
|
|
var spotSharedSocketClient = binanceSocketClient.SpotApi.SharedClient;
|
|
|
|
// USD-M Futures API common functionality rest client
|
|
var usdFuturesSharedRestClient = binanceRestClient.UsdFuturesApi.SharedClient;
|
|
|
|
// USD-M Futures API common functionality socket client
|
|
var usdFuturesSharedSocketClient = binanceSocketClient.UsdFuturesApi.SharedClient;
|
|
|
|
// Coin-M Futures API common functionality rest client
|
|
var coinFuturesSharedRestClient = binanceRestClient.CoinFuturesApi.SharedClient;
|
|
|
|
// Coin-M Futures API common functionality socket client
|
|
var coinFuturesSharedSocketClient = binanceSocketClient.CoinFuturesApi.SharedClient;</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="shared-bingx" role="tabpanel" aria-labelledby="shared-bingx-tab">
|
|
<pre><code>// Spot API common functionality rest client
|
|
var spotSharedRestClients = bingXRestClient.SpotApi.SharedClient;
|
|
|
|
// Spot API common functionality socket client
|
|
var spotSharedSocketClient = bingXSocketClient.SpotApi.SharedClient;
|
|
|
|
// Perpetual Futures API common functionality rest client
|
|
var usdFuturesSharedRestClient = bingXRestClient.PerpetualFuturesApi.SharedClient;
|
|
|
|
// Perpetual Futures API common functionality socket client
|
|
var usdFuturesSharedSocketClient = bingXSocketClient.PerpetualFuturesApi.SharedClient;</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="shared-bitfinex" role="tabpanel" aria-labelledby="shared-bitfinex-tab">
|
|
<pre><code>// Spot API common functionality rest client
|
|
var spotSharedRestClients = bitfinexRestClient.SpotApi.SharedClient;
|
|
|
|
// Spot API common functionality socket client
|
|
var spotSharedSocketClient = bitfinexSocketClient.SpotApi.SharedClient; </code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="shared-bitget" role="tabpanel" aria-labelledby="shared-bitget-tab">
|
|
<pre><code>// Spot API common functionality rest client
|
|
var spotSharedRestClients = bitgetRestClient.SpotApiV2.SharedClient;
|
|
|
|
// Spot API common functionality socket client
|
|
var spotSharedSocketClient = bitgetSocketClient.SpotApiV2.SharedClient;
|
|
|
|
// Perpetual Futures API common functionality rest client
|
|
var usdFuturesSharedRestClient = bitgetRestClient.FuturesApiV2.SharedClient;
|
|
|
|
// Perpetual Futures API common functionality socket client
|
|
var usdFuturesSharedSocketClient = bitgetSocketClient.FuturesApiV2.SharedClient;</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="shared-bitmart" role="tabpanel" aria-labelledby="shared-bitmart-tab">
|
|
<pre><code>// Spot API common functionality rest client
|
|
var spotSharedRestClients = bitMartRestClient.SpotApi.SharedClient;
|
|
|
|
// Spot API common functionality socket client
|
|
var spotSharedSocketClient = bitMartSocketClient.SpotApi.SharedClient;
|
|
|
|
// USD Futures API common functionality rest client
|
|
var usdFuturesSharedRestClient = bitMartRestClient.UsdFuturesApi.SharedClient;
|
|
|
|
// USD Futures API common functionality socket client
|
|
var usdFuturesSharedSocketClient = bitMartSocketClient.UsdFuturesApi.SharedClient;</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="shared-bybit" role="tabpanel" aria-labelledby="shared-bybit-tab">
|
|
<pre><code>// Spot and Futures API common functionality rest client
|
|
var spotSharedRestClients = bybitRestClient.V5Api.SharedClient;
|
|
|
|
// Spot and Futures API common functionality socket client
|
|
var spotSharedSocketClient = bybitSocketClient.V5SpotApi.SharedClient;
|
|
|
|
// Linear Futures API common functionality socket client
|
|
var linearFuturesSharedSocketClient = bybitSocketClient.V5LinearApi.SharedClient;
|
|
|
|
// Inverse Futures API common functionality socket client
|
|
var inverseFuturesspotSharedSocketClient = bybitSocketClient.V5InverseApi.SharedClient;
|
|
|
|
// 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 = coinbaseSocketClient.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
|
|
var spotSharedRestClients = coinExRestClient.SpotApiV2.SharedClient;
|
|
|
|
// Spot API common functionality socket client
|
|
var spotSharedSocketClient = coinExSocketClient.SpotApiV2.SharedClient;
|
|
|
|
// Futures API common functionality rest client
|
|
var usdFuturesSharedRestClient = coinExRestClient.FuturesApi.SharedClient;
|
|
|
|
// Futures API common functionality socket client
|
|
var usdFuturesSharedSocketClient = coinExSocketClient.FuturesApi.SharedClient;</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="shared-cryptocom" role="tabpanel" aria-labelledby="shared-cryptocom-tab">
|
|
<pre><code>// Spot/Futures API common functionality rest client
|
|
var sharedRestClients = cryptoComRestClient.ExchangeApi.SharedClient;
|
|
|
|
// Spot/Futures API common functionality socket client
|
|
var sharedSocketClient = cryptoComSocketClient.ExchangeApi.SharedClient;</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="shared-gateio" role="tabpanel" aria-labelledby="shared-gateio-tab">
|
|
<pre><code>// Spot API common functionality rest client
|
|
var spotSharedRestClients = gateioRestClient.SpotApi.SharedClient;
|
|
|
|
// Spot API common functionality socket client
|
|
var spotSharedSocketClient = gateioSocketClient.SpotApi.SharedClient;
|
|
|
|
// Perpetual Futures API common functionality rest client
|
|
var perpFuturesSharedRestClient = gateioRestClient.PerpetualFuturesApi.SharedClient;
|
|
|
|
// Perpetual Futures API common functionality socket client
|
|
var perpFuturesSharedSocketClient = gateioSocketClient.PerpetualFuturesApi.SharedClient;</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="shared-htx" role="tabpanel" aria-labelledby="shared-htx-tab">
|
|
<pre><code>// Spot API common functionality rest client
|
|
var spotSharedRestClients = htxRestClient.SpotApi.SharedClient;
|
|
|
|
// Spot API common functionality socket client
|
|
var spotSharedSocketClient = htxSocketClient.SpotApi.SharedClient;
|
|
|
|
// USDT Futures API common functionality rest client
|
|
var usdFuturesSharedRestClient = htxRestClient.UsdtFuturesApi.SharedClient;
|
|
|
|
// USDT Futures API common functionality socket client
|
|
var usdFuturesSharedSocketClient = htxSocketClient.UsdtFuturesApi.SharedClient;</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="shared-hyperliquid" role="tabpanel" aria-labelledby="shared-hyperliquid-tab">
|
|
<pre><code>// Spot API common functionality rest client
|
|
var spotSharedRestClients = hyperliquidRestClient.SpotApi.SharedClient;
|
|
|
|
// Spot API common functionality socket client
|
|
var spotSharedSocketClient = hyperliquidSocketClient.SpotApi.SharedClient;
|
|
|
|
// Perpetual Futures API common functionality rest client
|
|
var futuresSharedRestClient = hyperliquidRestClient.FuturesApi.SharedClient;
|
|
|
|
// Perpetual Futures API common functionality socket client
|
|
var futuresSharedSocketClient = hyperliquidSocketClient.FuturesApi.SharedClient;</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="shared-kraken" role="tabpanel" aria-labelledby="shared-kraken-tab">
|
|
<pre><code>// Spot API common functionality rest client
|
|
var spotSharedRestClients = krakenRestClient.SpotApi.SharedClient;
|
|
|
|
// Spot API common functionality socket client
|
|
var spotSharedSocketClient = krakenSocketClient.SpotApi.SharedClient;
|
|
|
|
// Futures API common functionality rest client
|
|
var usdFuturesSharedRestClient = krakenRestClient.FuturesApi.SharedClient;
|
|
|
|
// Futures API common functionality socket client
|
|
var usdFuturesSharedSocketClient = krakenSocketClient.FuturesApi.SharedClient;</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="shared-kucoin" role="tabpanel" aria-labelledby="shared-kucoin-tab">
|
|
<pre><code>// Spot API common functionality rest client
|
|
var spotSharedRestClients = kucoinRestClient.SpotApi.SharedClient;
|
|
|
|
// Spot API common functionality socket client
|
|
var spotSharedSocketClient = kucoinSocketClient.SpotApi.SharedClient;
|
|
|
|
// Futures API common functionality rest client
|
|
var usdFuturesSharedRestClient = kucoinRestClient.FuturesApi.SharedClient;
|
|
|
|
// Futures API common functionality socket client
|
|
var usdFuturesSharedSocketClient = kucoinSocketClient.FuturesApi.SharedClient;</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="shared-mexc" role="tabpanel" aria-labelledby="shared-mexc-tab">
|
|
<pre><code>// Spot API common functionality rest client
|
|
var spotSharedRestClients = mexcRestClient.SpotApi.SharedClient;
|
|
|
|
// Spot API common functionality socket client
|
|
var spotSharedSocketClient = mexcSocketClient.SpotApi.SharedClient;</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="shared-okx" role="tabpanel" aria-labelledby="shared-okx-tab">
|
|
<pre><code>// Futures and Spot API common functionality rest client
|
|
var spotSharedRestClients = okxRestClient.UnifiedApi.SharedClient;
|
|
|
|
// Futures and Spot API common functionality socket client
|
|
var spotSharedSocketClient = okxSocketClient.UnifiedApi.SharedClient;</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="shared-whitebit" role="tabpanel" aria-labelledby="shared-whitebit-tab">
|
|
<pre><code>// Futures and Spot API common functionality rest client
|
|
var spotSharedRestClients = whitebitRestClient.V4Api.SharedClient;
|
|
|
|
// Futures and Spot API common functionality socket client
|
|
var spotSharedSocketClient = whitebitSocketClient.V4Api.SharedClient;</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="shared-xt" role="tabpanel" aria-labelledby="shared-xt-tab">
|
|
<pre><code>// Spot API common functionality rest client
|
|
var spotSharedRestClients = xtRestClient.SpotApi.SharedClient;
|
|
|
|
// Futures API common functionality rest client
|
|
var futuresSharedRestClients = xtRestClient.UsdtFuturesApi.SharedClient;
|
|
|
|
// Spot API common functionality socket client
|
|
var spotSharedSocketClient = xtSocketClient.SpotApi.SharedClient;
|
|
|
|
// Futures API common functionality socket client
|
|
var futuresSharedSocketClient = xtSocketClient.FuturesApi.SharedClient;</code></pre>
|
|
</div>
|
|
</div>
|
|
|
|
<h4 id="shared_tradingmode">TradingMode</h4>
|
|
<p>The shared client interfaces and functionality work with the <code>TradingMode</code> enum. This enums determines what part of the API a request targets. Many exchanges support multiple trading modes, which might be split over different sub-clients:</p>
|
|
<pre><code>Console.WriteLine(string.Join(", ", binanceClient.UsdFuturesApi.SharedClient.SupportedTradingModes));
|
|
// Output: DeliveryLinear, PerpetualLinear
|
|
|
|
Console.WriteLine(string.Join(", ", binanceClient.CoinFuturesApi.SharedClient.SupportedTradingModes));
|
|
// Output: DeliveryInverse, PerpetualInverse
|
|
|
|
Console.WriteLine(string.Join(", ", binanceClient.SpotApi.SharedClient.SupportedTradingModes));
|
|
// Output: Spot</code></pre>
|
|
|
|
<table class="table table-bordered">
|
|
<tr><th>Mode</th><th>Description</th></tr>
|
|
<tr><td><code>TradingMode.Spot</code></td><td>Spot trading</td></tr>
|
|
<tr><td><code>TradingMode.PerpetualLinear</code></td><td>Futures contract trading without delivery date using stablecoin as settlement</td></tr>
|
|
<tr><td><code>TradingMode.DeliveryLinear</code></td><td>Futures contract trading with specific delivery date using stablecoin as settlement</td></tr>
|
|
<tr><td><code>TradingMode.PerpetualInverse</code></td><td>Futures contract trading without delivery date using a crypto asset as settlement</td></tr>
|
|
<tr><td><code>TradingMode.DeliveryInverse</code></td><td>Futures contract trading with specific delivery date using a crypto asset as settlement</td></tr>
|
|
</table>
|
|
|
|
<h4 id="shared_symbol">SharedSymbol</h5>
|
|
<p>One of the main challenges of working with different exchanges is the different names and formats used for symbols. For example, the ETH/USDT spot trading pair is called <code>ETHUSDT</code> on Binance, <code>ETH-USDT</code> on Kucoin and <code>ETH_USDT</code> on GateIo. With futures trading it's even worse, ranging from <code>ETH-USD-SWAP</code> to <code>ETHU24</code></p>
|
|
|
|
<p>To combat this problem the <code>SharedSymbol</code> class was introduced. This class takes a <code>TradingMode</code>, base asset name and quote asset name which are used to format the symbol according to the exchange it will be used by.</p>
|
|
<pre><code>// Create a symbol reference for ETH/USDT spot trading
|
|
var symbol1 = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
// Create a symbol reference for BTC/USDC perpetual linear futures trading
|
|
var symbol2 = new SharedSymbol(TradingMode.PerpetualLinear, "BTC", "USDC");
|
|
|
|
// Create a symbol reference for BTC/USD perpetual inverse futures trading
|
|
var symbol3 = new SharedSymbol(TradingMode.PerpetualInverse, "BTC", "USD");
|
|
|
|
// Create a symbol reference for BTC/USDT linear futures trading with delivery on 27 Sept 2024
|
|
var symbol4 = new SharedSymbol(TradingMode.DeliveryLinear, "BTC", "USDT", new DateTime(2024, 9, 27));
|
|
|
|
// Create a symbol reference for ETH/USD inverse futures trading with delivery on 27 Sept 2024
|
|
var symbol5 = new SharedSymbol(TradingMode.DeliveryLinear, "ETH", "USD", new DateTime(2024, 9, 27));
|
|
</code></pre>
|
|
|
|
<p>With the <code>SharedSymbol</code> functionality available we can reference symbols without having to think about how the exchange expects a symbol.</p>
|
|
<pre><code>var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
var tickerMexcResult = await mexcSharedRestClients.GetSpotTickerAsync(new GetTickerRequest(symbol));
|
|
Console.WriteLine($"{mexcSharedRestClients.Exchange} {tickerMexcResult.Data.Symbol} last price: {tickerMexcResult.Data.LastPrice}");
|
|
// Output: Mexc ETHUSDT last price: 2614,67
|
|
|
|
var tickerKucoinResult = await kucoinSharedRestClients.GetSpotTickerAsync(new GetTickerRequest(symbol));
|
|
Console.WriteLine($"{kucoinSharedRestClients.Exchange} {tickerKucoinResult.Data.Symbol} last price: {tickerKucoinResult.Data.LastPrice}");
|
|
// Output: Kucoin ETH-USDT last price: 2614,49</code></pre>
|
|
|
|
<h4 id="shared_pagination">Pagination</h4>
|
|
<p>Some Rest history requests support pagination. These requests take a <code>INextPageToken</code> as parameter and results include a <code>NextPageToken</code> property on the result. These tokens can be used to automatically execute multiple paginated requests</p>
|
|
|
|
<pre><code>var symbol = new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT");
|
|
|
|
INextPageToken? nextToken = null;
|
|
while (true)
|
|
{
|
|
// Execute a request specifying the next page token which was returned from by the previous request (or null for the first request)
|
|
var pageResult = await client.GetClosedFuturesOrdersAsync(new GetClosedOrdersRequest(symbol, limit: 2), nextToken);
|
|
|
|
Console.WriteLine($"{pageResult.Data.Count()} items");
|
|
|
|
// If NextPagToken is null there is no next page available
|
|
if (pageResult.NextPageToken == null)
|
|
break;
|
|
|
|
// Store next page token for the next request
|
|
nextToken = pageResult.NextPageToken;
|
|
}</code></pre>
|
|
|
|
<p>Or simplify this by using the <code>ExchangeHelpers.ExecutePages</code> helper function to stream each page as a result in the form of a <code>IAsyncEnumerable</code></p>
|
|
|
|
<pre><code>await foreach (var pageResult in ExchangeHelpers.ExecutePages(client.GetClosedFuturesOrdersAsync, new GetClosedOrdersRequest(symbol, limit: 2)))
|
|
Console.WriteLine($"{pageResult.Data.Count()} items");</code></pre>
|
|
|
|
<h4 id="shared_parameters">Optional and exchange specific parameters</h4>
|
|
<p>Not all exchanges require the same parameters. Some parameters are defined on the request model, but only required for specific exchanges. For example a <code>listenKey</code> parameter when subscribing to a user stream. When not provided for an exchange that needs it an <code>ArgumentError</code> will be returned.</p>
|
|
|
|
<p>Other parameters are not defined on the request model at all because they're very specific to a single exchange. For example the <code>AccountId</code> parameter for Spot authenticated requests on HTX. To not pollute the request models with every single possible parameter for each single exchange there is an <code>ExchangeParameters</code> structure to provide these values.</p>
|
|
|
|
<pre><code>// Set as static parameter, automatically used if not overridden
|
|
ExchangeParameters.SetStaticParameter("HTX", "AccountId", 123123123);
|
|
var balances1 = await restClient.HTX.SpotApi.SharedClient.GetBalancesAsync(new GetBalancesRequest());
|
|
|
|
// Specify exchange parameters for a request
|
|
var exchangeParameters = new ExchangeParameters(new ExchangeParameter("HTX", "AccountId", 456456456));
|
|
var balances = await restClient.HTX.SpotApi.SharedClient.GetBalancesAsync(new GetBalancesRequest(exchangeParameters: exchangeParameters));</code></pre>
|
|
|
|
<p>To determine which parameters are required for an exchange request either inspect the ArgmumentError when the call fails, or output the request info:</p>
|
|
<pre><code>Console.WriteLine(restClient.HTX.SpotApi.SharedClient.GetBalancesOptions.ToString(Exchange.HTX));
|
|
// Output:
|
|
// HTX GetBalancesRequest
|
|
// Needs authentication: True
|
|
// Required exchange specific parameters: [Int64] AccountId: Account id of the user | example: 123123123</code></pre>
|
|
<h4 id="shared_interfaces">Available Interfaces</h4>
|
|
<p>What interfaces are actually available and implemented on each exchange clients depends on what functionality is available in the specific API.</p>
|
|
|
|
<p style="font-style: italic;">Available REST shared interfaces</p>
|
|
<table class="table table-bordered">
|
|
<tr><th>Interface</th><th>Description</th></tr>
|
|
<tr><td><code>IAssetsRestClient</code></td><td>For requesting withdrawal and deposit info for assets</td></tr>
|
|
<tr><td><code>IKlineRestClient</code></td><td>For requesting public kline/candlestick data</td></tr>
|
|
<tr><td><code>IOrderBookRestClient</code></td><td>For requesting public order book data</td></tr>
|
|
<tr><td><code>IRecentTradeRestClient</code></td><td>For requesting the most recent public trades for a symbol</td></tr>
|
|
<tr><td><code>ITradeHistoryRestClient</code></td><td>For requesting historic public trade data for a symbol</td></tr>
|
|
<tr><td><code>ISpotSymbolRestClient</code></td><td>For requesting Spot symbols info</td></tr>
|
|
<tr><td><code>ISpotTickerRestClient</code></td><td>For requesting Spot ticker information</td></tr>
|
|
<tr><td><code>IFundingRateRestClient</code></td><td>For requesting funding rate history for a Futures symbol</td></tr>
|
|
<tr><td><code>IFuturesSymbolRestClient</code></td><td>For requesting Futures symbols info</td></tr>
|
|
<tr><td><code>IFuturesTickerRestClient</code></td><td>For requesting Futures ticker information</td></tr>
|
|
<tr><td><code>IIndexPriceKlineRestClient</code></td><td>For requesting index price kline history for a Futures symbol</td></tr>
|
|
<tr><td><code>IMarkPriceKlineRestClient</code></td><td>For requesting mark price kline history for a Futures symbol</td></tr>
|
|
<tr><td><code>IOpenInterestRestClient</code></td><td>For requesting the open interest for a Futures symbol</td></tr>
|
|
<tr><td><code>IBalanceRestClient</code></td><td>For requesting user asset balances</td></tr>
|
|
<tr><td><code>IDepositRestClient</code></td><td>For requesting user deposit history</td></tr>
|
|
<tr><td><code>IListenKeyRestClient</code></td><td>For managing the user listen key which can be used for subscribing to user data streams</td></tr>
|
|
<tr><td><code>IWithdrawalRestClient </code></td><td>For requesting user withdrawal history</td></tr>
|
|
<tr><td><code>IWithdrawRestClient</code></td><td>For requesting to withdraw funds from the exchange</td></tr>
|
|
<tr><td><code>ISpotOrderRestClient</code></td><td>For placing and managing Spot orders</td></tr>
|
|
<tr><td><code>IFuturesOrderRestClient</code></td><td>For placing and managing Futures orders</td></tr>
|
|
<tr><td><code>ILeverageRestClient</code></td><td>For managing leverage for a Futures symbol</td></tr>
|
|
<tr><td><code>IPositionHistoryRestClient</code></td><td>For requesting the user position closing history</td></tr>
|
|
<tr><td><code>IPositionModeRestClient</code></td><td>For managing the position mode for the user</td></tr>
|
|
<tr><td><code>IFeeRestClient</code></td><td>For requesting maker and taker trading fee percentages for the user</td></tr>
|
|
</table>
|
|
|
|
<p style="font-style: italic;">Available Socket shared interfaces</p>
|
|
<table class="table table-bordered">
|
|
<tr><th>Interface</th><th>Description</th></tr>
|
|
<tr><td><code>IBookTickerSocketClient</code></td><td>For subscribing to book ticker (best bid/ask) updates for a symbol</td></tr>
|
|
<tr><td><code>IKlineSocketClient</code></td><td>For subscribing to kline/candlestick updates for a symbol</td></tr>
|
|
<tr><td><code>IOrderBookSocketClient</code></td><td>For subscribing to order book snapshot updates for a symbol</td></tr>
|
|
<tr><td><code>ITickerSocketClient</code></td><td>For subscribing to ticker updates for a symbol</td></tr>
|
|
<tr><td><code>ITickersSocketClient</code></td><td>For subscribing to ticker updates for all symbols</td></tr>
|
|
<tr><td><code>ITradeSocketClient</code></td><td>For subscribing to public trade updates for a symbol</td></tr>
|
|
<tr><td><code>IBalanceSocketClient</code></td><td>For subscribing to user balance updates</td></tr>
|
|
<tr><td><code>IUserTradeSocketClient</code></td><td>For subscribing to user trade updates</td></tr>
|
|
<tr><td><code>ISpotOrderSocketClient</code></td><td>For subscribing to user Spot order updates</td></tr>
|
|
<tr><td><code>IFuturesOrderSocketClient</code></td><td>For subscribing to user Futures order updates</td></tr>
|
|
<tr><td><code>IPositionSocketClient</code></td><td>For subscribing to user position updates</td></tr>
|
|
</table>
|
|
|
|
<h4 id="shared_cc">CryptoClients.Net</h4>
|
|
<p>The <code>CryptoClients.Net</code> library has some additional tools for dynamically accessing different exchanges. Both the <code>(I)ExchangeRestClient</code> and <code>(I)ExchangeSocketClient</code> expose methods for executing requests and subscriptions on dynamically selected exchanges.</p>
|
|
|
|
<p><b>Rest</b></p>
|
|
<pre><code>var restClient = new ExchangeRestClient();
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
// Get ticker results from Binance and Kucoin
|
|
var tickers = await restClient.GetSpotTickerAsync(new GetTickerRequest(symbol), [Exchange.Binance, Exchange.Kucoin]);
|
|
|
|
// Get ticker results for all exchanges
|
|
var tickers = await restClient.GetSpotTickerAsync(new GetTickerRequest(symbol));</code></pre>
|
|
|
|
<p><b>Socket</b></p>
|
|
<pre><code>var socketClient = new ExchangeSocketClient();
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
// Subscribe to ticker updates on Binance and Kucoin
|
|
var tickers = await socketClient.SubscribeToTickerUpdatesAsync(new SubscribeTickerRequest(symbol), update =>
|
|
{
|
|
Console.WriteLine($"{update.Exchange} update: {update.Data.LastPrice}");
|
|
},
|
|
[Exchange.Binance, Exchange.Kucoin]);
|
|
|
|
// Subscribe to ticker updates on all exchanges
|
|
var tickers = await socketClient.SubscribeToTickerUpdatesAsync(new SubscribeTickerRequest(symbol), update =>
|
|
{
|
|
Console.WriteLine($"{update.Exchange} update: {update.Data.LastPrice}");
|
|
});</code></pre>
|
|
|
|
</section>
|
|
|
|
|
|
<!-- Logo Settings
|
|
============================ -->
|
|
<section id="idocs_options">
|
|
<h1>Options & Authorization</h1>
|
|
|
|
<p>Options for the clients can be provided in a couple of different ways. If no options are configured the default options will be used. For accessing private endpoints and streams API credentials have to be provided.</p>
|
|
|
|
</section>
|
|
|
|
<hr class="divider">
|
|
|
|
<!-- Header
|
|
============================ -->
|
|
<section id="idocs_auth">
|
|
<h2>Authorization</h2>
|
|
|
|
<p>For private endpoints and data streams the clients will need to know the API credentials of the user accessing the API. API credentials are a way of identifying the user and validating that the user is who he says he is. You can compare it to a username and password login.</p>
|
|
<p>API credentials van be provided via the client options, see next section on how to set these options. There are currently 2 variants of API credentials supported, HMAC and RSA. </p>
|
|
|
|
<p>
|
|
<b>HMAC</b><br />
|
|
HMAC authentication involves 2 values, the API key and API secret. The combination of the two gives access to the account. HMAC is the default authentication method and can be configured as such:
|
|
<pre><code>options.ApiCredentials = new ApiCredentials("YOUR API KEY", "YOUR API SECRET");</code></pre>
|
|
</p>
|
|
|
|
<p>
|
|
<b>RSA</b><br />
|
|
RSA authentication involves generating a private and public key and then uploading the public key to the server. After using the private key to sign the request the server can validate the request by comparing the signature using the public key. Not every exchange supports this authentication method.
|
|
Depending on the version of dotnet used there are 2 ways of configuring the RSA authentication.
|
|
</p>
|
|
<p>
|
|
When running Dotnet version 3.0 or later the easiest way is to use the RsaPem type. This allows you to use the Private key directly. When running from an older Dotnet/.NET framework version you're forced to use the RsaXml type due to framework limitations. This means you'll have to convert the private key to XML format before using it.
|
|
</p>
|
|
<em>RsaXml</em>
|
|
<pre><code class="language-csharp">// when using the .netstandard2.0 compiled version, from .NET framework or Dotnet core 2.2 or lower
|
|
// Private key should look something like this: <RSAKeyValue><Modulus>...</RSAKeyValue>
|
|
options.ApiCredentials = new ApiCredentials("YOUR PUBLIC KEY", "YOUR PRIVATE KEY", ApiCredentialsType.RsaXml);</code></pre>
|
|
<em>RsaPem</em>
|
|
<pre><code class="language-csharp">// when using the .netstandard2.1 compiled version, from Dotnet core 3.0 or later
|
|
// Private key should look something like this: -----BEGIN PRIVATE KEY----- .. -----END PRIVATE KEY-----, or just a long random character string
|
|
options.ApiCredentials = new ApiCredentials("YOUR PUBLIC KEY", "YOUR PRIVATE KEY", ApiCredentialsType.RsaPem);</code></pre>
|
|
</section>
|
|
|
|
<hr class="divider">
|
|
|
|
<!-- Header
|
|
============================ -->
|
|
<section id="idocs_options_set">
|
|
<h2>Setting options</h2>
|
|
|
|
<b>Dependency injection</b>
|
|
<p>When adding a library to the service collection (see <a href="#idocs_di">Dependency Injection</a>) the options for the clients can be provided as argument to the calls or read from configuration.</p>
|
|
<div class="tab-wrap">
|
|
<ul class="nav nav-tabs" id="options" role="tablist" style="margin-bottom: -16px;">
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link active" id="options-cc-tab" data-toggle="tab" href="#options-cc" role="tab" aria-controls="options-cc" aria-selected="true">CryptoClients</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-binance-tab" data-toggle="tab" href="#options-binance" role="tab" aria-controls="options-binance" aria-selected="true">Binance</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-bingx-tab" data-toggle="tab" href="#options-bingx" role="tab" aria-controls="options-bingx" aria-selected="false">BingX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-bitfinex-tab" data-toggle="tab" href="#options-bitfinex" role="tab" aria-controls="options-bitfinex" aria-selected="false">Bitfinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-bitget-tab" data-toggle="tab" href="#options-bitget" role="tab" aria-controls="options-bitget" aria-selected="false">Bitget</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-bitmart-tab" data-toggle="tab" href="#options-bitmart" role="tab" aria-controls="options-bitmart" aria-selected="false">BitMart</a>
|
|
</li>
|
|
<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>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-coinex-tab" data-toggle="tab" href="#options-coinex" role="tab" aria-controls="options-coinex" aria-selected="false">Coinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-cryptocom-tab" data-toggle="tab" href="#options-cryptocom" role="tab" aria-controls="options-cryptocom" aria-selected="false">Crypto.com</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-gateio-tab" data-toggle="tab" href="#options-gateio" role="tab" aria-controls="options-gateio" aria-selected="false">GateIo</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-htx-tab" data-toggle="tab" href="#options-htx" role="tab" aria-controls="options-htx" aria-selected="false">HTX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-hyperliquid-tab" data-toggle="tab" href="#options-hyperliquid" role="tab" aria-controls="options-hyperliquid" aria-selected="false">HyperLiquid</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-kraken-tab" data-toggle="tab" href="#options-kraken" role="tab" aria-controls="options-kraken" aria-selected="false">Kraken</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-kucoin-tab" data-toggle="tab" href="#options-kucoin" role="tab" aria-controls="options-kucoin" aria-selected="false">Kucoin</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-mexc-tab" data-toggle="tab" href="#options-mexc" role="tab" aria-controls="options-mexc" aria-selected="false">Mexc</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-okx-tab" data-toggle="tab" href="#options-okx" role="tab" aria-controls="options-okx" aria-selected="false">OKX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-whitebit-tab" data-toggle="tab" href="#options-whitebit" role="tab" aria-controls="options-whitebit" aria-selected="false">WhiteBit</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-xt-tab" data-toggle="tab" href="#options-xt" role="tab" aria-controls="options-xt" aria-selected="false">XT</a>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content my-3" id="myTabContent">
|
|
<div class="tab-pane fade show active" id="options-cc" role="tabpanel" aria-labelledby="options-cc-tab">
|
|
<pre><code>builder.Services.AddCryptoClients(globalOptions => {
|
|
globalOptions.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
},
|
|
// Exchange specific options can be provided as well
|
|
bybitRestOptions: bybitOptions => {
|
|
// Set options specific for the Bybit rest client here
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-binance" role="tabpanel" aria-labelledby="options-binance-tab">
|
|
<pre><code>builder.Services.AddBinance(
|
|
options => {
|
|
options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
|
|
});
|
|
|
|
// OR
|
|
|
|
// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
|
|
builder.Services.AddBinance(builder.Configuration.GetSection("Binance"));</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-bingx" role="tabpanel" aria-labelledby="options-bingx-tab">
|
|
<pre><code>builder.Services.AddBingX(
|
|
options => {
|
|
options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
|
|
});
|
|
|
|
// OR
|
|
|
|
// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
|
|
builder.Services.AddBingX(builder.Configuration.GetSection("BingX"));</code></pre></code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-bitfinex" role="tabpanel" aria-labelledby="options-bitfinex-tab">
|
|
<pre><code>builder.Services.AddBitfinex(
|
|
options => {
|
|
options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
|
|
});
|
|
|
|
// OR
|
|
|
|
// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
|
|
builder.Services.AddBitfinex(builder.Configuration.GetSection("Bitfinex"));</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-bitget" role="tabpanel" aria-labelledby="options-bitget-tab">
|
|
<pre><code>builder.Services.AddBitget(
|
|
options => {
|
|
options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
|
|
});
|
|
|
|
// OR
|
|
|
|
// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
|
|
builder.Services.AddBitget(builder.Configuration.GetSection("Bitget"));</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-bitmart" role="tabpanel" aria-labelledby="options-bitmart-tab">
|
|
<pre><code>builder.Services.AddBitMart(
|
|
options => {
|
|
options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
|
|
});
|
|
|
|
// OR
|
|
|
|
// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
|
|
builder.Services.AddBitMart(builder.Configuration.GetSection("BitMart"));</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-bybit" role="tabpanel" aria-labelledby="options-bybit-tab">
|
|
<pre><code>builder.Services.AddBybit(
|
|
options => {
|
|
options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
|
|
});
|
|
|
|
// OR
|
|
|
|
// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
|
|
builder.Services.AddBybit(builder.Configuration.GetSection("Bybit"));</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-coinbase" role="tabpanel" aria-labelledby="options-coinbase-tab">
|
|
<pre><code>builder.Services.AddCoinbase(
|
|
options => {
|
|
options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
|
|
});
|
|
|
|
// OR
|
|
|
|
// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
|
|
builder.Services.AddCoinbase(builder.Configuration.GetSection("Coinbase"));</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-coingecko" role="tabpanel" aria-labelledby="options-coingecko-tab">
|
|
<pre><code>builder.Services.AddCoinGecko(
|
|
options => {
|
|
options.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});
|
|
|
|
// OR
|
|
|
|
// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
|
|
builder.Services.AddCoinGecko(builder.Configuration.GetSection("CoinGecko"));</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-coinex" role="tabpanel" aria-labelledby="options-coinex-tab">
|
|
<pre><code>builder.Services.AddCoinEx(
|
|
options => {
|
|
options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
|
|
});
|
|
|
|
// OR
|
|
|
|
// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
|
|
builder.Services.AddCoinEx(builder.Configuration.GetSection("CoinEx"));</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-cryptocom" role="tabpanel" aria-labelledby="options-cryptocom-tab">
|
|
<pre><code>builder.Services.AddCryptoCom(
|
|
options => {
|
|
options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
|
|
});
|
|
|
|
// OR
|
|
|
|
// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
|
|
builder.Services.AddCryptoCom(builder.Configuration.GetSection("CryptoCom"));</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-gateio" role="tabpanel" aria-labelledby="options-gateio-tab">
|
|
<pre><code>builder.Services.AddGateIo(
|
|
options => {
|
|
options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
|
|
});
|
|
|
|
// OR
|
|
|
|
// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
|
|
builder.Services.AddGateIo(builder.Configuration.GetSection("GateIo"));</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-htx" role="tabpanel" aria-labelledby="options-htx-tab">
|
|
<pre><code>builder.Services.AddHTX(
|
|
options => {
|
|
options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
|
|
});
|
|
|
|
// OR
|
|
|
|
// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
|
|
builder.Services.AddHTX(builder.Configuration.GetSection("HTX"));</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-hyperliquid" role="tabpanel" aria-labelledby="options-hyperliquid-tab">
|
|
<pre><code>builder.Services.AddHyperLiquid(
|
|
options => {
|
|
options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
|
|
});
|
|
|
|
// OR
|
|
|
|
// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
|
|
builder.Services.AddHyperLiquid(builder.Configuration.GetSection("HyperLiquid"));</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-kraken" role="tabpanel" aria-labelledby="options-kraken-tab">
|
|
<pre><code>builder.Services.AddKraken(
|
|
options => {
|
|
options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
|
|
});
|
|
|
|
// OR
|
|
|
|
// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
|
|
builder.Services.AddKraken(builder.Configuration.GetSection("Kraken"));</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-kucoin" role="tabpanel" aria-labelledby="options-kucoin-tab">
|
|
<pre><code>builder.Services.AddKucoin(
|
|
options => {
|
|
options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
|
|
});
|
|
|
|
// OR
|
|
|
|
// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
|
|
builder.Services.AddKucoin(builder.Configuration.GetSection("Kucoin"));</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-mexc" role="tabpanel" aria-labelledby="options-mexc-tab">
|
|
<pre><code>builder.Services.AddMexc(
|
|
options => {
|
|
options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
|
|
});
|
|
|
|
// OR
|
|
|
|
// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
|
|
builder.Services.AddMexc(builder.Configuration.GetSection("Mexc"));</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-okx" role="tabpanel" aria-labelledby="options-okx-tab">
|
|
<pre><code>builder.Services.AddOKX(
|
|
options => {
|
|
options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
|
|
});
|
|
|
|
// OR
|
|
|
|
// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
|
|
builder.Services.AddOKX(builder.Configuration.GetSection("OKX"));</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-whitebit" role="tabpanel" aria-labelledby="options-whitebit-tab">
|
|
<pre><code>builder.Services.AddWhiteBit(
|
|
options => {
|
|
options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
|
|
});
|
|
|
|
// OR
|
|
|
|
// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
|
|
builder.Services.AddWhiteBit(builder.Configuration.GetSection("WhiteBit"));</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-xt" role="tabpanel" aria-labelledby="options-xt-tab">
|
|
<pre><code>builder.Services.AddXT(
|
|
options => {
|
|
options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
|
|
});
|
|
|
|
// OR
|
|
|
|
// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
|
|
builder.Services.AddXT(builder.Configuration.GetSection("XT"));</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<b>Client constructor</b>
|
|
<p>When creating a client via the constructor options can be provided as parameters</p>
|
|
<div class="tab-wrap">
|
|
<ul class="nav nav-tabs" id="options-constr" role="tablist" style="margin-bottom: -16px;">
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link active" id="options-cc-tab" data-toggle="tab" href="#options-constr-cc" role="tab" aria-controls="options-constr-cc" aria-selected="true">CryptoClients</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-binance-tab" data-toggle="tab" href="#options-constr-binance" role="tab" aria-controls="options-constr-binance" aria-selected="true">Binance</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-bingx-tab" data-toggle="tab" href="#options-constr-bingx" role="tab" aria-controls="options-constr-bingx" aria-selected="false">BingX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-bitfinex-tab" data-toggle="tab" href="#options-constr-bitfinex" role="tab" aria-controls="options-constr-bitfinex" aria-selected="false">Bitfinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-bitget-tab" data-toggle="tab" href="#options-constr-bitget" role="tab" aria-controls="options-constr-bitget" aria-selected="false">Bitget</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-bitmart-tab" data-toggle="tab" href="#options-constr-bitmart" role="tab" aria-controls="options-constr-bitmart" aria-selected="false">BitMart</a>
|
|
</li>
|
|
<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>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-coinex-tab" data-toggle="tab" href="#options-constr-coinex" role="tab" aria-controls="options-constr-coinex" aria-selected="false">Coinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-cryptocom-tab" data-toggle="tab" href="#options-constr-cryptocom" role="tab" aria-controls="options-constr-cryptocom" aria-selected="false">Crypto.com</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-gateio-tab" data-toggle="tab" href="#options-constr-gateio" role="tab" aria-controls="options-constr-gateio" aria-selected="false">GateIo</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-htx-tab" data-toggle="tab" href="#options-constr-htx" role="tab" aria-controls="options-constr-htx" aria-selected="false">HTX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-hyperliquid-tab" data-toggle="tab" href="#options-constr-hyperliquid" role="tab" aria-controls="options-constr-hyperliquid" aria-selected="false">HyperLiquid</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-kraken-tab" data-toggle="tab" href="#options-constr-kraken" role="tab" aria-controls="options-constr-kraken" aria-selected="false">Kraken</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-kucoin-tab" data-toggle="tab" href="#options-constr-kucoin" role="tab" aria-controls="options-constr-kucoin" aria-selected="false">Kucoin</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-mexc-tab" data-toggle="tab" href="#options-constr-mexc" role="tab" aria-controls="options-constr-mexc" aria-selected="false">Mexc</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-okx-tab" data-toggle="tab" href="#options-constr-okx" role="tab" aria-controls="options-constr-okx" aria-selected="false">OKX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-whitebit-tab" data-toggle="tab" href="#options-constr-whitebit" role="tab" aria-controls="options-constr-whitebit" aria-selected="false">WhiteBit</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-xt-tab" data-toggle="tab" href="#options-constr-xt" role="tab" aria-controls="options-constr-xt" aria-selected="false">XT</a>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content my-3" id="myTabContent">
|
|
<div class="tab-pane fade show active" id="options-constr-cc" role="tabpanel" aria-labelledby="options-cc-tab">
|
|
<pre><code>var exchangeRestClient = new ExchangeRestClient(opts =>
|
|
{
|
|
opts.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-constr-binance" role="tabpanel" aria-labelledby="options-binance-tab">
|
|
<pre><code>var binanceRestClient = new BinanceRestClient(opts =>
|
|
{
|
|
opts.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-constr-bingx" role="tabpanel" aria-labelledby="options-bingx-tab">
|
|
<pre><code>var client = new BingXRestClient(opts =>
|
|
{
|
|
opts.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-constr-bitfinex" role="tabpanel" aria-labelledby="options-bitfinex-tab">
|
|
<pre><code>var client = new BitfinexRestClient(opts =>
|
|
{
|
|
opts.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-constr-bitget" role="tabpanel" aria-labelledby="options-bitget-tab">
|
|
<pre><code>var client = new BitgetRestClient(opts =>
|
|
{
|
|
opts.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-constr-bitmart" role="tabpanel" aria-labelledby="options-bitmart-tab">
|
|
<pre><code>var client = new BitMartRestClient(opts =>
|
|
{
|
|
opts.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});</code></pre>
|
|
</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>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-constr-coingecko" role="tabpanel" aria-labelledby="options-coingecko-tab">
|
|
<pre><code>var client = new CoinGeckoRestClient(opts =>
|
|
{
|
|
opts.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-constr-coinex" role="tabpanel" aria-labelledby="options-coinex-tab">
|
|
<pre><code>var client = new CoinExRestClient(opts =>
|
|
{
|
|
opts.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-constr-cryptocom" role="tabpanel" aria-labelledby="options-cryptocom-tab">
|
|
<pre><code>var client = new CryptoComRestClient(opts =>
|
|
{
|
|
opts.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-constr-gateio" role="tabpanel" aria-labelledby="options-gateio-tab">
|
|
<pre><code>var client = new GateIoRestClient(opts =>
|
|
{
|
|
opts.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-constr-htx" role="tabpanel" aria-labelledby="options-htx-tab">
|
|
<pre><code>var client = new HTXRestClient(opts =>
|
|
{
|
|
opts.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-constr-hyperliquid" role="tabpanel" aria-labelledby="options-hyperliquid-tab">
|
|
<pre><code>var client = new HyperLiquidRestClient(opts =>
|
|
{
|
|
opts.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-constr-kraken" role="tabpanel" aria-labelledby="options-kraken-tab">
|
|
<pre><code>var client = new KrakenRestClient(opts =>
|
|
{
|
|
opts.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-constr-kucoin" role="tabpanel" aria-labelledby="options-kucoin-tab">
|
|
<pre><code>var client = new KucoinRestClient(opts =>
|
|
{
|
|
opts.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-constr-mexc" role="tabpanel" aria-labelledby="options-mexc-tab">
|
|
<pre><code>var client = new MexcRestClient(opts =>
|
|
{
|
|
opts.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-constr-okx" role="tabpanel" aria-labelledby="options-okx-tab">
|
|
<pre><code>var client = new OKXRestClient(opts =>
|
|
{
|
|
opts.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-constr-whitebit" role="tabpanel" aria-labelledby="options-whitebit-tab">
|
|
<pre><code>var client = new WhiteBitRestClient(opts =>
|
|
{
|
|
opts.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-constr-xt" role="tabpanel" aria-labelledby="options-xt-tab">
|
|
<pre><code>var client = new XTRestClient(opts =>
|
|
{
|
|
opts.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<b>SetDefaultOptions</b>
|
|
<p>The options can be defined using the static SetDefaultOptions method on the client BEFORE creating the client. Any client created after this call will use the specified options</p>
|
|
<div class="tab-wrap">
|
|
<ul class="nav nav-tabs" id="options-default" role="tablist" style="margin-bottom: -16px;">
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link active" id="options-binance-tab" data-toggle="tab" href="#options-default-binance" role="tab" aria-controls="options-default-binance" aria-selected="true">Binance</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-bingx-tab" data-toggle="tab" href="#options-default-bingx" role="tab" aria-controls="options-default-bingx" aria-selected="false">BingX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-bitfinex-tab" data-toggle="tab" href="#options-default-bitfinex" role="tab" aria-controls="options-default-bitfinex" aria-selected="false">Bitfinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-bitget-tab" data-toggle="tab" href="#options-default-bitget" role="tab" aria-controls="options-default-bitget" aria-selected="false">Bitget</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-bitmart-tab" data-toggle="tab" href="#options-default-bitmart" role="tab" aria-controls="options-default-bitmart" aria-selected="false">BitMart</a>
|
|
</li>
|
|
<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>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-coinex-tab" data-toggle="tab" href="#options-default-coinex" role="tab" aria-controls="options-default-coinex" aria-selected="false">Coinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-cryptocom-tab" data-toggle="tab" href="#options-default-cryptocom" role="tab" aria-controls="options-default-cryptocom" aria-selected="false">Crypto.com</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-gateio-tab" data-toggle="tab" href="#options-default-gateio" role="tab" aria-controls="options-default-gateio" aria-selected="false">GateIo</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-htx-tab" data-toggle="tab" href="#options-default-htx" role="tab" aria-controls="options-default-htx" aria-selected="false">HTX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-hyperliquid-tab" data-toggle="tab" href="#options-default-hyperliquid" role="tab" aria-controls="options-default-hyperliquid" aria-selected="false">HyperLiquid</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-kraken-tab" data-toggle="tab" href="#options-default-kraken" role="tab" aria-controls="options-default-kraken" aria-selected="false">Kraken</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-kucoin-tab" data-toggle="tab" href="#options-default-kucoin" role="tab" aria-controls="options-default-kucoin" aria-selected="false">Kucoin</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-mexc-tab" data-toggle="tab" href="#options-default-mexc" role="tab" aria-controls="options-default-mexc" aria-selected="false">Mexc</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-okx-tab" data-toggle="tab" href="#options-default-okx" role="tab" aria-controls="options-default-okx" aria-selected="false">OKX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-whitebit-tab" data-toggle="tab" href="#options-default-whitebit" role="tab" aria-controls="options-default-whitebit" aria-selected="false">WhiteBit</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="options-xt-tab" data-toggle="tab" href="#options-default-xt" role="tab" aria-controls="options-default-xt" aria-selected="false">XT</a>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content my-3" id="myTabContent">
|
|
<div class="tab-pane fade show active" id="options-default-binance" role="tabpanel" aria-labelledby="options-binance-tab">
|
|
<pre><code>BinanceRestClient.SetDefaultOptions(options =>
|
|
{
|
|
options.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});
|
|
var client = new BinanceRestClient();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-default-bingx" role="tabpanel" aria-labelledby="options-bingx-tab">
|
|
<pre><code>BingXRestClient.SetDefaultOptions(options =>
|
|
{
|
|
options.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});
|
|
var client = new BingXRestClient();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-default-bitfinex" role="tabpanel" aria-labelledby="options-bitfinex-tab">
|
|
<pre><code>BitfinexRestClient.SetDefaultOptions(options =>
|
|
{
|
|
options.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});
|
|
var client = new BitfinexRestClient();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-default-bitget" role="tabpanel" aria-labelledby="options-bitget-tab">
|
|
<pre><code>BitgetRestClient.SetDefaultOptions(options =>
|
|
{
|
|
options.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});
|
|
var client = new BitgetRestClient();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-default-bitmart" role="tabpanel" aria-labelledby="options-bitmart-tab">
|
|
<pre><code>BitMartRestClient.SetDefaultOptions(options =>
|
|
{
|
|
options.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});
|
|
var client = new BitMartRestClient();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-default-bybit" role="tabpanel" aria-labelledby="options-bybit-tab">
|
|
<pre><code>BybitRestClient.SetDefaultOptions(options =>
|
|
{
|
|
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 =>
|
|
{
|
|
options.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});
|
|
var client = new CoinGeckoRestClient();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-default-coinex" role="tabpanel" aria-labelledby="options-coinex-tab">
|
|
<pre><code>CoinExRestClient.SetDefaultOptions(options =>
|
|
{
|
|
options.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});
|
|
var client = new CoinExRestClient();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-default-cryptocom" role="tabpanel" aria-labelledby="options-cryptocom-tab">
|
|
<pre><code>CryptoComRestClient.SetDefaultOptions(options =>
|
|
{
|
|
options.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});
|
|
var client = new CryptoComRestClient();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-default-gateio" role="tabpanel" aria-labelledby="options-gateio-tab">
|
|
<pre><code>GateIoRestClient.SetDefaultOptions(options =>
|
|
{
|
|
options.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});
|
|
var client = new GateIoRestClient();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-default-htx" role="tabpanel" aria-labelledby="options-htx-tab">
|
|
<pre><code>HTXRestClient.SetDefaultOptions(options =>
|
|
{
|
|
options.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});
|
|
var client = new HTXRestClient();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-default-hyperliquid" role="tabpanel" aria-labelledby="options-hyperliquid-tab">
|
|
<pre><code>HyperLiquidRestClient.SetDefaultOptions(options =>
|
|
{
|
|
options.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});
|
|
var client = new HyperLiquidRestClient();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-default-kraken" role="tabpanel" aria-labelledby="options-kraken-tab">
|
|
<pre><code>KrakenRestClient.SetDefaultOptions(options =>
|
|
{
|
|
options.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});
|
|
var client = new KrakenRestClient();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-default-kucoin" role="tabpanel" aria-labelledby="options-kucoin-tab">
|
|
<pre><code>KucoinRestClient.SetDefaultOptions(options =>
|
|
{
|
|
options.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});
|
|
var client = new KucoinRestClient();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-default-mexc" role="tabpanel" aria-labelledby="options-mexc-tab">
|
|
<pre><code>MexcRestClient.SetDefaultOptions(options =>
|
|
{
|
|
options.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});
|
|
var client = new MexcRestClient();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-default-okx" role="tabpanel" aria-labelledby="options-okx-tab">
|
|
<pre><code>OKXRestClient.SetDefaultOptions(options =>
|
|
{
|
|
options.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});
|
|
var client = new OKXRestClient();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-default-whitebit" role="tabpanel" aria-labelledby="options-whitebit-tab">
|
|
<pre><code>WhiteBitRestClient.SetDefaultOptions(options =>
|
|
{
|
|
options.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});
|
|
var client = new WhiteBitRestClient();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="options-default-xt" role="tabpanel" aria-labelledby="options-xt-tab">
|
|
<pre><code>XTRestClient.SetDefaultOptions(options =>
|
|
{
|
|
options.RequestTimeout = TimeSpan.FromSeconds(30);
|
|
});
|
|
var client = new XTRestClient();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<hr class="divider">
|
|
|
|
<!-- Header
|
|
============================ -->
|
|
<section id="idocs_options_def">
|
|
<h2>Option definitions</h2>
|
|
|
|
<p>
|
|
<b>General options</b><br />
|
|
Options available for all clients
|
|
</p>
|
|
<table class="table table-bordered">
|
|
<tr><th>Option</th><th>Description</th><th>Default value</th></tr>
|
|
<tr>
|
|
<td>RequestTimeout</td>
|
|
<td>The time to wait for an answer from the server on a request</td>
|
|
<td><code>TimeSpan.FromSeconds(20)</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>ApiCredentials</td>
|
|
<td>The credentials to use for private endpoints and streams. See <a href="idocs_auth">Authorization</a> for more info. For CryptoClients this option allows the setting of ApiCredentials for all exchanges.</td>
|
|
<td><code>null</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Proxy</td>
|
|
<td>The proxy to use for connecting to the API</td>
|
|
<td><code>null</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>OutputOriginalData</td>
|
|
<td>When enabled the originally received string data will be available as well as the deserialized object. For REST API client calls the data will be in the <code>WebCallResult<T>.OriginalData</code> property, for Websocket API client subscriptions the data will be available in the <code>DataEvent<T>.OriginalData</code> property when receiving an update.</td>
|
|
<td><code>false</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>RateLimiterEnabled</td>
|
|
<td>Whether or not client side rate limiting should be applied. Note that not all libraries have ratelimiting implemented, if it's not implemented this flag does nothing</td>
|
|
<td><code>true</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>RateLimitingBehaviour</td>
|
|
<td>What should happen when a rate limit is reached. RateLimitingBehaviour.Wait: the request waits until it can be send while staying within the limits, RateLimitingBehaviour.Fail: the request will return an error</td>
|
|
<td><code>RateLimitingBehaviour.Wait</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Environment</td>
|
|
<td>The environment the library should connect to. Some exchanges have testnet/sandbox environments which can be used instead of the real exchange. The environment option can be used to switch between different trade environments</td>
|
|
<td><code>Live environment</code></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p>
|
|
<b>REST client options</b><br />
|
|
Options available for REST clients
|
|
<table class="table table-bordered">
|
|
<tr><th>Option</th><th>Description</th><th>Default value</th></tr>
|
|
<tr>
|
|
<td>AutoTimestamp</td>
|
|
<td>Whether or not the client should attempt to sync the time between the client and server. If the time between server and client is not in sync authentication errors might occur. This option should be disabled when the client time sure is to be in sync</td>
|
|
<td><code>true</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>TimestampRecalculationInterval</td>
|
|
<td>The interval of how often the time synchronization between client and server should be executed</td>
|
|
<td><code>TimeSpan.FromHours(1)</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>CachingEnabled</td>
|
|
<td>Whether or not client side caching should be enabled for GET requests, see <a href="#idocs_caching">Caching</a></td>
|
|
<td><code>false</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>CachingMaxAge</td>
|
|
<td>The max age of data to return from the cache. If the same data is requested and the data is available in the client side cache and not older than this value the cached value is returned, else a new request will be done</td>
|
|
<td><code>TimeSpan.FromSeconds(5)</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>[API].ApiCredentials</td>
|
|
<td>Same as the in the base options, allows overriding per sub-API</td>
|
|
<td><code>null</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>[API].OutputOriginalData</td>
|
|
<td>Same as the in the base options, allows overriding per sub-API</td>
|
|
<td><code>null</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>[API].AutoTimestamp</td>
|
|
<td>Same as the in the base REST options, allows overriding per sub-API</td>
|
|
<td><code>null</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>[API].TimestampRecalculationInterval</td>
|
|
<td>Same as the in the base REST options, allows overriding per sub-API</td>
|
|
<td><code>null</code></td>
|
|
</tr>
|
|
</table>
|
|
</p>
|
|
|
|
|
|
<p>
|
|
<b>Websocket client options</b><br />
|
|
Options available for websocket clients
|
|
<table class="table table-bordered">
|
|
<tr><th>Option</th><th>Description</th><th>Default value</th></tr>
|
|
<tr>
|
|
<td>ReconnectPolicy</td>
|
|
<td>The reconnect policy to execute when the connection is lost</td>
|
|
<td><code>ReconnectPolicy.FixedDelay</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>ReconnectInterval</td>
|
|
<td>The time to wait between connection tries when reconnecting, only applied when reconnect policy is <code>FixedDelay</code></td>
|
|
<td><code>TimeSpan.FromSeconds(5)</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>SocketNoDataTimeout</td>
|
|
<td>If no data is received during this timespan the connection is assumed to be dropped. This is mainly used for API's which have some sort of ping/keepalive system. For example; the Bitfinex API will sent a heartbeat message every 15 seconds, so the `SocketNoDataTimeout` could be set to 20 seconds. On API's without such a mechanism this might not work because there just might not be any update while still being fully connected</td>
|
|
<td><code>default(TimeSpan)</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>SocketSubscriptionsCombineTarget</td>
|
|
<td>The number of subscriptions that should be made on a single socket connection before setting up a new connection. Not all exchanges support multiple subscriptions on a single socket and some have limits on the amount of connections. Setting this to a higher number increases subscription speed because not every subscription needs to connect to the server, but having more subscriptions on a single connection will also increase the amount of traffic on that single connection, potentially leading to delays in updates if the data isn't handled quickly enough</td>
|
|
<td><code>Dependent on the library</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>MaxConcurrentResubscriptionsPerSocket</td>
|
|
<td>The maximum number of concurrent resubscriptions per socket when resubscribing after reconnecting</td>
|
|
<td><code>5</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>MaxSocketConnections</td>
|
|
<td>The maximum number of distinct socket connections</td>
|
|
<td><code>null</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>DelayAfterConnect</td>
|
|
<td>The time to wait before sending messages after connecting to the server</td>
|
|
<td><code>null</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>[API].SocketNoDataTimeout</td>
|
|
<td>Same as the in the base websocket client options, allows overriding per sub-API</td>
|
|
<td><code>null</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>[API].MaxSocketConnections</td>
|
|
<td>Same as the in the base websocket client options, allows overriding per sub-API</td>
|
|
<td><code>null</code></td>
|
|
</tr>
|
|
</table>
|
|
</p>
|
|
</section>
|
|
|
|
<hr class="divider">
|
|
|
|
<!-- Getting Started
|
|
============================ -->
|
|
<section id="idocs_features">
|
|
<h1>Additional Features</h1>
|
|
|
|
</section>
|
|
|
|
<hr class="divider">
|
|
|
|
<!-- Header
|
|
============================ -->
|
|
<section id="idocs_orderbooks">
|
|
<h2>Orderbooks</h2>
|
|
<p>
|
|
Each client library provides an local orderbook implementation. These implementations will provide a client side orderbook, take care of synchronization with the server, and handle reconnecting and resynchronizing in case of a dropped connection.
|
|
Orderbook implementations use the following naming convention: <code>[ExchangeName][(Type)]SymbolOrderBook</code>
|
|
</p>
|
|
<p>
|
|
<b>Creation and starting</b><br />
|
|
The order book implementations can be created directly, or can be instantiated via the <code>I[Exchange]OrderBookFactory</code> factory. After creation the synchronization can be started by calling the <code>StartAync</code> method
|
|
</p>
|
|
<div class="tab-wrap">
|
|
<ul class="nav nav-tabs" id="book" role="tablist" style="margin-bottom: -16px;">
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link active" id="book-cryptoclients-tab" data-toggle="tab" href="#book-cryptoclients" role="tab" aria-controls="book-cryptoclients" aria-selected="true">CryptoClients</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="book-binance-tab" data-toggle="tab" href="#book-binance" role="tab" aria-controls="book-binance" aria-selected="false">Binance</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="book-bingx-tab" data-toggle="tab" href="#book-bingx" role="tab" aria-controls="book-bingx" aria-selected="false">BingX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="book-bitfinex-tab" data-toggle="tab" href="#book-bitfinex" role="tab" aria-controls="book-bitfinex" aria-selected="false">Bitfinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="book-bitget-tab" data-toggle="tab" href="#book-bitget" role="tab" aria-controls="book-bitget" aria-selected="false">Bitget</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="book-bitmart-tab" data-toggle="tab" href="#book-bitmart" role="tab" aria-controls="book-bitmart" aria-selected="false">BitMart</a>
|
|
</li>
|
|
<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>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="book-cryptocom-tab" data-toggle="tab" href="#book-cryptocom" role="tab" aria-controls="book-cryptocom" aria-selected="false">Crypto.com</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="book-gateio-tab" data-toggle="tab" href="#book-gateio" role="tab" aria-controls="book-gateio" aria-selected="false">GateIo</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="book-htx-tab" data-toggle="tab" href="#book-htx" role="tab" aria-controls="book-htx" aria-selected="false">HTX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="book-hyperliquid-tab" data-toggle="tab" href="#book-hyperliquid" role="tab" aria-controls="book-hyperliquid" aria-selected="false">HyperLiquid</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="book-kraken-tab" data-toggle="tab" href="#book-kraken" role="tab" aria-controls="book-kraken" aria-selected="false">Kraken</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="book-kucoin-tab" data-toggle="tab" href="#book-kucoin" role="tab" aria-controls="book-kucoin" aria-selected="false">Kucoin</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="book-mexc-tab" data-toggle="tab" href="#book-mexc" role="tab" aria-controls="book-mexc" aria-selected="false">Mexc</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="book-okx-tab" data-toggle="tab" href="#book-okx" role="tab" aria-controls="book-okx" aria-selected="false">OKX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="book-whitebit-tab" data-toggle="tab" href="#book-whitebit" role="tab" aria-controls="book-whitebit" aria-selected="false">WhiteBit</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="book-xt-tab" data-toggle="tab" href="#book-xt" role="tab" aria-controls="book-xt" aria-selected="false">XT</a>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content my-3" id="myTabContent">
|
|
<div class="tab-pane fade show active" id="book-cryptoclients" role="tabpanel" aria-labelledby="book-cryptoclients-tab">
|
|
<pre><code>// Assuming IExchangeOrderBookFactory is injected as bookFactoryClient
|
|
var book = bookFactoryClient.Binance.Spot.Create("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>
|
|
</div>
|
|
<div class="tab-pane fade" id="book-binance" role="tabpanel" aria-labelledby="book-binance-tab">
|
|
<pre><code>var book = new BinanceSpotSymbolOrderBook("ETHUSDT");
|
|
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>
|
|
</div>
|
|
<div class="tab-pane fade" id="book-bingx" role="tabpanel" aria-labelledby="book-bingx-tab">
|
|
<pre><code>var book = new BingXSpotSymbolOrderBook("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>
|
|
</div>
|
|
<div class="tab-pane fade" id="book-bitfinex" role="tabpanel" aria-labelledby="book-bitfinex-tab">
|
|
<pre><code>var book = new BitfinexSymbolOrderBook("tETHUSD");
|
|
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>
|
|
</div>
|
|
<div class="tab-pane fade" id="book-bitget" role="tabpanel" aria-labelledby="book-bitget-tab">
|
|
<pre><code>var book = new BitgetSpotSymbolOrderBook("ETHUSDT");
|
|
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>
|
|
</div>
|
|
<div class="tab-pane fade" id="book-bitmart" role="tabpanel" aria-labelledby="book-bitmart-tab">
|
|
<pre><code>var book = new BitMartSymbolOrderBook("ETH_USDT", Category.Spot);
|
|
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>
|
|
</div>
|
|
<div class="tab-pane fade" id="book-bybit" role="tabpanel" aria-labelledby="book-bybit-tab">
|
|
<pre><code>var book = new BybitSymbolOrderBook("ETHUSDT", Category.Spot);
|
|
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>
|
|
</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>
|
|
</div>
|
|
<div class="tab-pane fade" id="book-coinex" role="tabpanel" aria-labelledby="book-coinex-tab">
|
|
<pre><code>var book = new CoinExSpotSymbolOrderBook("ETHUSDT");
|
|
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>
|
|
</div>
|
|
<div class="tab-pane fade" id="book-gateio" role="tabpanel" aria-labelledby="book-gateio-tab">
|
|
<pre><code>var book = new GateIoSpotSymbolOrderBook("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>
|
|
</div>
|
|
<div class="tab-pane fade" id="book-cryptocom" role="tabpanel" aria-labelledby="book-cryptocom-tab">
|
|
<pre><code>var book = new CryptoComSpotSymbolOrderBook("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>
|
|
</div>
|
|
<div class="tab-pane fade" id="book-htx" role="tabpanel" aria-labelledby="book-htx-tab">
|
|
<pre><code>var book = new HTXSpotSymbolOrderBook("ethusdt");
|
|
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>
|
|
</div>
|
|
<div class="tab-pane fade" id="book-hyperliquid" role="tabpanel" aria-labelledby="book-hyperliquid-tab">
|
|
<pre><code>var book = new HyperLiquidSymbolOrderBook("HYPE/USDC");
|
|
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>
|
|
</div>
|
|
<div class="tab-pane fade" id="book-kraken" role="tabpanel" aria-labelledby="book-kraken-tab">
|
|
<pre><code>var book = new KrakenSpotSymbolOrderBook("ETH/USD");
|
|
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>
|
|
</div>
|
|
<div class="tab-pane fade" id="book-kucoin" role="tabpanel" aria-labelledby="book-kucoin-tab">
|
|
<pre><code>var book = new KucoinSpotSymbolOrderBook("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>
|
|
</div>
|
|
<div class="tab-pane fade" id="book-mexc" role="tabpanel" aria-labelledby="book-mexc-tab">
|
|
<pre><code>var book = new MexcSpotSymbolOrderBook("ETHUSDT");
|
|
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>
|
|
</div>
|
|
<div class="tab-pane fade" id="book-okx" role="tabpanel" aria-labelledby="book-okx-tab">
|
|
<pre><code>var book = new OKXSymbolOrderBook("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>
|
|
</div>
|
|
<div class="tab-pane fade" id="book-whitebit" role="tabpanel" aria-labelledby="book-whitebit-tab">
|
|
<pre><code>var book = new WhiteBitSymbolOrderBook("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>
|
|
</div>
|
|
<div class="tab-pane fade" id="book-xt" role="tabpanel" aria-labelledby="book-xt-tab">
|
|
<pre><code>var book = new XTSymbolOrderBook("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>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<p>
|
|
<b>The order book object</b><br />
|
|
The order book implementations for each client use a common base class and interface, which means you can use books from different exchanges in a common function.
|
|
<pre><code>// Create order books for different exchanges
|
|
var books = new List<ISymbolOrderBook>();
|
|
books.Add(new BinanceSpotSymbolOrderBook("ETHUSDT"));
|
|
books.Add(new BitgetSpotSymbolOrderBook("ETHUSDT"));
|
|
books.Add(new KrakenSpotSymbolOrderBook("ETH/USD"));
|
|
books.Add(new KucoinSpotSymbolOrderBook("ETH-USDT"));
|
|
books.Add(new OKXSymbolOrderBook("ETH-USDT"));
|
|
|
|
// Start the books
|
|
var results = await Task.WhenAll(books.Select(b => b.StartAsync()));
|
|
|
|
// Output the current best ask/bid for each exchange
|
|
foreach (var book in books.Where(b => b.Status == OrderBookStatus.Synced))
|
|
{
|
|
Console.WriteLine(book.Id);
|
|
Console.WriteLine($"{book.BestAsk} - {book.BestBid}");
|
|
}
|
|
</code></pre>
|
|
</p>
|
|
<p>
|
|
The following properties and events are exposed by the order books:
|
|
<table class="table table-bordered">
|
|
<tr><th>Field</th><th>Description</th></tr>
|
|
<tr>
|
|
<td>Status</td>
|
|
<td>The current status of the order book. Note that the book is only acurate and up to date when the status is <code>Synced</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Id</td>
|
|
<td>Identifier for the book, referencing the exchange it's for</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Symbol</td>
|
|
<td>The symbol the book is for</td>
|
|
</tr>
|
|
<tr>
|
|
<td>LastSequenceNumber</td>
|
|
<td>The last sequence number that was processed. Order book update messages typically have sequence numbers to correctly sync the book</td>
|
|
</tr>
|
|
<tr>
|
|
<td>UpdateTime</td>
|
|
<td>Timestamp of the last update that was processed</td>
|
|
</tr>
|
|
<tr>
|
|
<td>AskCount</td>
|
|
<td>The current number of asks in the book</td>
|
|
</tr>
|
|
<tr>
|
|
<td>BidCount</td>
|
|
<td>The current number of bids in the book</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Asks</td>
|
|
<td>Returns a snapshot of the current list of asks. This creates a copy of the list values at that moment</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Bids</td>
|
|
<td>Returns a snapshot of the current list of bids. This creates a copy of the list values at that moment</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Book</td>
|
|
<td>Returns a snapshot of the both the asks and bids. This makes sure the snapshot of the bids and asks are of the same exact time</td>
|
|
</tr>
|
|
<tr>
|
|
<td>BestAsk</td>
|
|
<td>The best ask at that moment</td>
|
|
</tr>
|
|
<tr>
|
|
<td>BestBid</td>
|
|
<td>The best bid at that moment</td>
|
|
</tr>
|
|
<tr>
|
|
<td>BestOffers</td>
|
|
<td>The best bid and best ask at that moment</td>
|
|
</tr>
|
|
<tr>
|
|
<td>OnStatusChange</td>
|
|
<td>Event called when the status of the order book changes</td>
|
|
</tr>
|
|
<tr>
|
|
<td>OnOrderBookUpdate</td>
|
|
<td>Event called whenever the book changes. Note that this event can trigger a lot on large/high liquidity markets</td>
|
|
</tr>
|
|
<tr>
|
|
<td>OnBestOffersChanged</td>
|
|
<td>Event called whenever the best ask or bid changes in the order book</td>
|
|
</tr>
|
|
</table>
|
|
|
|
</p>
|
|
</section>
|
|
|
|
<hr class="divider">
|
|
|
|
<section id="idocs_trackers">
|
|
<h2>Trackers</h2>
|
|
<p>
|
|
Trackers offer a way to keep track of live data. This data can than be aggregated into statistics and different time slices can be compared to get realtime insights.
|
|
</p>
|
|
<p>
|
|
The basic workings of the trackers are simple, an initial request is made for a snapshot of the history (or a partial snapshot depending on what the API supports). At the same time a websocket subscription is set up to provide the tracker with new data.
|
|
</p>
|
|
<p>
|
|
Currently there are 2 different trackers available, the <code>TradeTracker</code> and the <code>KlineTracker</code>.
|
|
|
|
</p>
|
|
<p>
|
|
<b>Creation and starting</b><br />
|
|
The example uses the <code>TradeTracker</code>, but the same logic can be applied to the <code>KlineTracker</code>.
|
|
</p>
|
|
<div class="tab-wrap">
|
|
<ul class="nav nav-tabs" id="tracker" role="tablist" style="margin-bottom: -16px;">
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link active" id="tracker-cryptoclients-tab" data-toggle="tab" href="#tracker-cryptoclients" role="tab" aria-controls="tracker-cryptoclients" aria-selected="true">CryptoClients</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="tracker-binance-tab" data-toggle="tab" href="#tracker-binance" role="tab" aria-controls="tracker-binance" aria-selected="false">Binance</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="tracker-bingx-tab" data-toggle="tab" href="#tracker-bingx" role="tab" aria-controls="tracker-bingx" aria-selected="false">BingX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="tracker-bitfinex-tab" data-toggle="tab" href="#tracker-bitfinex" role="tab" aria-controls="tracker-bitfinex" aria-selected="false">Bitfinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="tracker-bitget-tab" data-toggle="tab" href="#tracker-bitget" role="tab" aria-controls="tracker-bitget" aria-selected="false">Bitget</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="tracker-bitmart-tab" data-toggle="tab" href="#tracker-bitmart" role="tab" aria-controls="tracker-bitmart" aria-selected="false">BitMart</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="tracker-bybit-tab" data-toggle="tab" href="#tracker-bybit" role="tab" aria-controls="tracker-bybit" aria-selected="false">Bybit</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="tracker-coinbase-tab" data-toggle="tab" href="#tracker-coinbase" role="tab" aria-controls="tracker-coinbase" aria-selected="false">Coinbase</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="tracker-coinex-tab" data-toggle="tab" href="#tracker-coinex" role="tab" aria-controls="tracker-coinex" aria-selected="false">Coinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="tracker-cryptocom-tab" data-toggle="tab" href="#tracker-cryptocom" role="tab" aria-controls="tracker-cryptocom" aria-selected="false">Crypto.com</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="tracker-gateio-tab" data-toggle="tab" href="#tracker-gateio" role="tab" aria-controls="tracker-gateio" aria-selected="false">GateIo</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="tracker-htx-tab" data-toggle="tab" href="#tracker-htx" role="tab" aria-controls="tracker-htx" aria-selected="false">HTX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="tracker-hyperliquid-tab" data-toggle="tab" href="#tracker-hyperliquid" role="tab" aria-controls="tracker-hyperliquid" aria-selected="false">HyperLiquid</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="tracker-kraken-tab" data-toggle="tab" href="#tracker-kraken" role="tab" aria-controls="tracker-kraken" aria-selected="false">Kraken</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="tracker-kucoin-tab" data-toggle="tab" href="#tracker-kucoin" role="tab" aria-controls="tracker-kucoin" aria-selected="false">Kucoin</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="tracker-mexc-tab" data-toggle="tab" href="#tracker-mexc" role="tab" aria-controls="tracker-mexc" aria-selected="false">Mexc</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="tracker-okx-tab" data-toggle="tab" href="#tracker-okx" role="tab" aria-controls="tracker-okx" aria-selected="false">OKX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="tracker-whitebit-tab" data-toggle="tab" href="#tracker-whitebit" role="tab" aria-controls="tracker-whitebit" aria-selected="false">WhiteBit</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="tracker-xt-tab" data-toggle="tab" href="#tracker-xt" role="tab" aria-controls="tracker-xt" aria-selected="false">XT</a>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content my-3" id="myTabContent">
|
|
<div class="tab-pane fade show active" id="tracker-cryptoclients" role="tabpanel" aria-labelledby="tracker-cryptoclients-tab">
|
|
<pre><code>var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
// Assuming IExchangeTrackerFactory is injected as trackerFactory
|
|
// Create tracker dynamically by exchange name
|
|
var tracker = trackerFactory.CreateTradeTracker("Binance", symbol);
|
|
// OR by directly referencing the specific exchange
|
|
tracker = trackerFactory.Binance.CreateTradeTracker(symbol);
|
|
|
|
var startResult = await tracker.StartAsync();
|
|
if (!startResult.Success)
|
|
{
|
|
// Handle error, error info available in startResult.Error
|
|
}
|
|
// Tracker has successfully started
|
|
// Note that it might not be fully synced yet, check tracker.Status for this.
|
|
|
|
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
|
await tracker.StopAsync();
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="tracker-binance" role="tabpanel" aria-labelledby="tracker-binance-tab">
|
|
<pre><code>// Either create a new factory or inject the IBinanceTrackerFactory interface
|
|
var factory = new BinanceTrackerFactory();
|
|
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
// Create a tracker for ETH/USDT keeping track of trades in the last 5 minutes
|
|
var tracker = factory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5));
|
|
var startResult = await tracker.StartAsync();
|
|
if (!startResult.Success)
|
|
{
|
|
// Handle error, error info available in startResult.Error
|
|
}
|
|
// Tracker has successfully started
|
|
// Note that it might not be fully synced yet, check tracker.Status for this.
|
|
|
|
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
|
await tracker.StopAsync();
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="tracker-bingx" role="tabpanel" aria-labelledby="tracker-bingx-tab">
|
|
<pre><code>// Either create a new factory or inject the IBingXTrackerFactory interface
|
|
var factory = new BingXTrackerFactory();
|
|
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
// Create a tracker for ETH/USDT keeping track of trades in the last 5 minutes
|
|
var tracker = factory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5));
|
|
var startResult = await tracker.StartAsync();
|
|
if (!startResult.Success)
|
|
{
|
|
// Handle error, error info available in startResult.Error
|
|
}
|
|
// Tracker has successfully started
|
|
// Note that it might not be fully synced yet, check tracker.Status for this.
|
|
|
|
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
|
await tracker.StopAsync();
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="tracker-bitfinex" role="tabpanel" aria-labelledby="tracker-bitfinex-tab">
|
|
<pre><code>// Either create a new factory or inject the IBitfinexTrackerFactory interface
|
|
var factory = new BitfinexTrackerFactory();
|
|
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
// Create a tracker for ETH/USDT keeping track of trades in the last 5 minutes
|
|
var tracker = factory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5));
|
|
var startResult = await tracker.StartAsync();
|
|
if (!startResult.Success)
|
|
{
|
|
// Handle error, error info available in startResult.Error
|
|
}
|
|
// Tracker has successfully started
|
|
// Note that it might not be fully synced yet, check tracker.Status for this.
|
|
|
|
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
|
await tracker.StopAsync();
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="tracker-bitget" role="tabpanel" aria-labelledby="tracker-bitget-tab">
|
|
<pre><code>// Either create a new factory or inject the IBitgetTrackerFactory interface
|
|
var factory = new BitgetTrackerFactory();
|
|
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
// Create a tracker for ETH/USDT keeping track of trades in the last 5 minutes
|
|
var tracker = factory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5));
|
|
var startResult = await tracker.StartAsync();
|
|
if (!startResult.Success)
|
|
{
|
|
// Handle error, error info available in startResult.Error
|
|
}
|
|
// Tracker has successfully started
|
|
// Note that it might not be fully synced yet, check tracker.Status for this.
|
|
|
|
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
|
await tracker.StopAsync();
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="tracker-bitmart" role="tabpanel" aria-labelledby="tracker-bitmart-tab">
|
|
<pre><code>// Either create a new factory or inject the IBitMartTrackerFactory interface
|
|
var factory = new BitMartTrackerFactory();
|
|
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
// Create a tracker for ETH/USDT keeping track of trades in the last 5 minutes
|
|
var tracker = factory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5));
|
|
var startResult = await tracker.StartAsync();
|
|
if (!startResult.Success)
|
|
{
|
|
// Handle error, error info available in startResult.Error
|
|
}
|
|
// Tracker has successfully started
|
|
// Note that it might not be fully synced yet, check tracker.Status for this.
|
|
|
|
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
|
await tracker.StopAsync();
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="tracker-bybit" role="tabpanel" aria-labelledby="tracker-bybit-tab">
|
|
<pre><code>// Either create a new factory or inject the IBybitTrackerFactory interface
|
|
var factory = new BybitTrackerFactory();
|
|
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
// Create a tracker for ETH/USDT keeping track of trades in the last 5 minutes
|
|
var tracker = factory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5));
|
|
var startResult = await tracker.StartAsync();
|
|
if (!startResult.Success)
|
|
{
|
|
// Handle error, error info available in startResult.Error
|
|
}
|
|
// Tracker has successfully started
|
|
// Note that it might not be fully synced yet, check tracker.Status for this.
|
|
|
|
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
|
await tracker.StopAsync();
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="tracker-coinbase" role="tabpanel" aria-labelledby="tracker-coinbase-tab">
|
|
<pre><code>// Either create a new factory or inject the ICoinbaseTrackerFactory interface
|
|
var factory = new CoinbaseTrackerFactory();
|
|
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
// Create a tracker for ETH/USDT keeping track of trades in the last 5 minutes
|
|
var tracker = factory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5));
|
|
var startResult = await tracker.StartAsync();
|
|
if (!startResult.Success)
|
|
{
|
|
// Handle error, error info available in startResult.Error
|
|
}
|
|
// Tracker has successfully started
|
|
// Note that it might not be fully synced yet, check tracker.Status for this.
|
|
|
|
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
|
await tracker.StopAsync();
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="tracker-coinex" role="tabpanel" aria-labelledby="tracker-coinex-tab">
|
|
<pre><code>// Either create a new factory or inject the ICoinExTrackerFactory interface
|
|
var factory = new CoinExTrackerFactory();
|
|
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
// Create a tracker for ETH/USDT keeping track of trades in the last 5 minutes
|
|
var tracker = factory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5));
|
|
var startResult = await tracker.StartAsync();
|
|
if (!startResult.Success)
|
|
{
|
|
// Handle error, error info available in startResult.Error
|
|
}
|
|
// Tracker has successfully started
|
|
// Note that it might not be fully synced yet, check tracker.Status for this.
|
|
|
|
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
|
await tracker.StopAsync();
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="tracker-gateio" role="tabpanel" aria-labelledby="tracker-gateio-tab">
|
|
<pre><code>// Either create a new factory or inject the IGateIoTrackerFactory interface
|
|
var factory = new GateIoTrackerFactory();
|
|
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
// Create a tracker for ETH/USDT keeping track of trades in the last 5 minutes
|
|
var tracker = factory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5));
|
|
var startResult = await tracker.StartAsync();
|
|
if (!startResult.Success)
|
|
{
|
|
// Handle error, error info available in startResult.Error
|
|
}
|
|
// Tracker has successfully started
|
|
// Note that it might not be fully synced yet, check tracker.Status for this.
|
|
|
|
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
|
await tracker.StopAsync();
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="tracker-cryptocom" role="tabpanel" aria-labelledby="tracker-cryptocom-tab">
|
|
<pre><code>// Either create a new factory or inject the ICryptoComTrackerFactory interface
|
|
var factory = new CryptoComTrackerFactory();
|
|
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
// Create a tracker for ETH/USDT keeping track of trades in the last 5 minutes
|
|
var tracker = factory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5));
|
|
var startResult = await tracker.StartAsync();
|
|
if (!startResult.Success)
|
|
{
|
|
// Handle error, error info available in startResult.Error
|
|
}
|
|
// Tracker has successfully started
|
|
// Note that it might not be fully synced yet, check tracker.Status for this.
|
|
|
|
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
|
await tracker.StopAsync();
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="tracker-htx" role="tabpanel" aria-labelledby="tracker-htx-tab">
|
|
<pre><code>// Either create a new factory or inject the IHTXTrackerFactory interface
|
|
var factory = new HTXTrackerFactory();
|
|
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
// Create a tracker for ETH/USDT keeping track of trades in the last 5 minutes
|
|
var tracker = factory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5));
|
|
var startResult = await tracker.StartAsync();
|
|
if (!startResult.Success)
|
|
{
|
|
// Handle error, error info available in startResult.Error
|
|
}
|
|
// Tracker has successfully started
|
|
// Note that it might not be fully synced yet, check tracker.Status for this.
|
|
|
|
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
|
await tracker.StopAsync();
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="tracker-hyperliquid" role="tabpanel" aria-labelledby="tracker-hyperliquid-tab">
|
|
<pre><code>// Either create a new factory or inject the IHyperLiquidTrackerFactory interface
|
|
var factory = new HyperLiquidTrackerFactory();
|
|
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "HYPE", "USDC");
|
|
|
|
// Create a tracker for HYPE/USDC keeping track of trades in the last 5 minutes
|
|
var tracker = factory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5));
|
|
var startResult = await tracker.StartAsync();
|
|
if (!startResult.Success)
|
|
{
|
|
// Handle error, error info available in startResult.Error
|
|
}
|
|
// Tracker has successfully started
|
|
// Note that it might not be fully synced yet, check tracker.Status for this.
|
|
|
|
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
|
await tracker.StopAsync();
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="tracker-kraken" role="tabpanel" aria-labelledby="tracker-kraken-tab">
|
|
<pre><code>// Either create a new factory or inject the IKrakenTrackerFactory interface
|
|
var factory = new KrakenTrackerFactory();
|
|
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USD");
|
|
|
|
// Create a tracker for ETH/USD keeping track of trades in the last 5 minutes
|
|
var tracker = factory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5));
|
|
var startResult = await tracker.StartAsync();
|
|
if (!startResult.Success)
|
|
{
|
|
// Handle error, error info available in startResult.Error
|
|
}
|
|
// Tracker has successfully started
|
|
// Note that it might not be fully synced yet, check tracker.Status for this.
|
|
|
|
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
|
await tracker.StopAsync();
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="tracker-kucoin" role="tabpanel" aria-labelledby="tracker-kucoin-tab">
|
|
<pre><code>// Either create a new factory or inject the IKucoinTrackerFactory interface
|
|
var factory = new KucoinTrackerFactory();
|
|
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
// Create a tracker for ETH/USDT keeping track of trades in the last 5 minutes
|
|
var tracker = factory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5));
|
|
var startResult = await tracker.StartAsync();
|
|
if (!startResult.Success)
|
|
{
|
|
// Handle error, error info available in startResult.Error
|
|
}
|
|
// Tracker has successfully started
|
|
// Note that it might not be fully synced yet, check tracker.Status for this.
|
|
|
|
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
|
await tracker.StopAsync();
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="tracker-mexc" role="tabpanel" aria-labelledby="tracker-mexc-tab">
|
|
<pre><code>// Either create a new factory or inject the IMexcTrackerFactory interface
|
|
var factory = new MexcTrackerFactory();
|
|
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
// Create a tracker for ETH/USDT keeping track of trades in the last 5 minutes
|
|
var tracker = factory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5));
|
|
var startResult = await tracker.StartAsync();
|
|
if (!startResult.Success)
|
|
{
|
|
// Handle error, error info available in startResult.Error
|
|
}
|
|
// Tracker has successfully started
|
|
// Note that it might not be fully synced yet, check tracker.Status for this.
|
|
|
|
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
|
await tracker.StopAsync();
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="tracker-okx" role="tabpanel" aria-labelledby="tracker-okx-tab">
|
|
<pre><code>// Either create a new factory or inject the IOKXTrackerFactory interface
|
|
var factory = new OKXTrackerFactory();
|
|
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
// Create a tracker for ETH/USDT keeping track of trades in the last 5 minutes
|
|
var tracker = factory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5));
|
|
var startResult = await tracker.StartAsync();
|
|
if (!startResult.Success)
|
|
{
|
|
// Handle error, error info available in startResult.Error
|
|
}
|
|
// Tracker has successfully started
|
|
// Note that it might not be fully synced yet, check tracker.Status for this.
|
|
|
|
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
|
await tracker.StopAsync();
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="tracker-whitebit" role="tabpanel" aria-labelledby="tracker-whitebit-tab">
|
|
<pre><code>// Either create a new factory or inject the IWhiteBitTrackerFactory interface
|
|
var factory = new WhiteBitTrackerFactory();
|
|
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
// Create a tracker for ETH/USDT keeping track of trades in the last 5 minutes
|
|
var tracker = factory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5));
|
|
var startResult = await tracker.StartAsync();
|
|
if (!startResult.Success)
|
|
{
|
|
// Handle error, error info available in startResult.Error
|
|
}
|
|
// Tracker has successfully started
|
|
// Note that it might not be fully synced yet, check tracker.Status for this.
|
|
|
|
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
|
await tracker.StopAsync();
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="tracker-xt" role="tabpanel" aria-labelledby="tracker-xt-tab">
|
|
<pre><code>// Either create a new factory or inject the IXTTrackerFactory interface
|
|
var factory = new XTTrackerFactory();
|
|
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
|
|
// Create a tracker for ETH/USDT keeping track of trades in the last 5 minutes
|
|
var tracker = factory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5));
|
|
var startResult = await tracker.StartAsync();
|
|
if (!startResult.Success)
|
|
{
|
|
// Handle error, error info available in startResult.Error
|
|
}
|
|
// Tracker has successfully started
|
|
// Note that it might not be fully synced yet, check tracker.Status for this.
|
|
|
|
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
|
await tracker.StopAsync();
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<p>
|
|
<b>Stats and comparing data</b><br />
|
|
|
|
Using the <code>tracker.GetData(fromTime, toTime)</code> method the trackers exposes the data, or a subset of the data, can be retrieved:
|
|
<pre><code>// Get all the data currently tracked:
|
|
var data = tracker.GetData();
|
|
|
|
// Get the data for the last minute:
|
|
var data = tracker.GetData(DateTime.UtcNow.AddMinutes(-1));
|
|
|
|
// Get the data for the second last minute:
|
|
var data = tracker.GetData(DateTime.UtcNow.AddMinutes(-2), DateTime.UtcNow.AddMinutes(-1));</code></pre>
|
|
</p>
|
|
<p>
|
|
In a similar way statistics about the full data, or a subset of it, can be retrieved using the <code>tracker.GetStats(fromTime, toTime)</code> method:
|
|
<pre><code>// Get statistics on all the data:
|
|
var stats = tracker.GetStats();
|
|
|
|
// Get statistics for the last minute:
|
|
var stats = tracker.GetStats(DateTime.UtcNow.AddMinutes(-1));
|
|
|
|
// Get statistics for the second last minute:
|
|
var stats = tracker.GetStats(DateTime.UtcNow.AddMinutes(-2), DateTime.UtcNow.AddMinutes(-1));</code></pre>
|
|
|
|
See below for an overview of what these stats include.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
Stats can also be compared to eachother to see how much values have changed using the <code>stats.CompareTo(otherStats)</code> method:
|
|
|
|
<pre><code>var statsSecondLastMinute = tracker.GetStats(compareTime.AddMinutes(-2), compareTime.AddMinutes(-1));
|
|
var statsLastMinute = tracker.GetStats(compareTime.AddMinutes(-1), compareTime);
|
|
var comparison = statsLastMinute.CompareTo(statsSecondLastMinute);
|
|
|
|
Console.WriteLine($"The volume of last minute compared to the minute before that: {comparison.VolumeDif?.Difference} ({comparison.VolumeDif?.PercentageDifference}%)");
|
|
// Output: The volume of last minute compared to the minute before that: -1261,57350000 (-85,2572%)</code></pre>
|
|
</p>
|
|
|
|
<p>
|
|
<b>The <code>TradeTracker</code> object</b><br />
|
|
|
|
</p>
|
|
<p>
|
|
The following properties and events are exposed by the <code>TradeTracker</code> object:
|
|
<table class="table table-bordered">
|
|
<tr><th>Field</th><th>Description</th></tr>
|
|
<tr>
|
|
<td>Count</td>
|
|
<td>The total number of trades currently tracked</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Exchange</td>
|
|
<td>The name of the exchange</td>
|
|
</tr>
|
|
<tr>
|
|
<td>SymbolName</td>
|
|
<td>The name of the symbol being tracked</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Symbol</td>
|
|
<td>The symbol as passed in the constructor</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Limit</td>
|
|
<td>The max number of results tracked</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Period</td>
|
|
<td>The max age of results tracked</td>
|
|
</tr>
|
|
<tr>
|
|
<td>SyncedFrom</td>
|
|
<td>The timestamp from which on the trades are registered</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Status</td>
|
|
<td>The current synchronization status. Note the <code>PartiallySynced</code> means that the connection is active, but the data set is not yet complete. For example if the tracker is set to track 5 minutes of trades, it could be that currently only 3 minutes of data is tracked and it will take 2 more minutes to be fully synced.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Last</td>
|
|
<td>The current last trade</td>
|
|
</tr>
|
|
<tr>
|
|
<td>OnAdded</td>
|
|
<td>Event for when a new trade is added</td>
|
|
</tr>
|
|
<tr>
|
|
<td>OnRemoved</td>
|
|
<td>Event for when a trade is removed from the tracker due to not being within the set tracking period/limit anymore</td>
|
|
</tr>
|
|
<tr>
|
|
<td>OnStatusChanged</td>
|
|
<td>Event for when the status of the tracker changes</td>
|
|
</tr>
|
|
|
|
</table>
|
|
</p>
|
|
<p>
|
|
|
|
The following properties are available in the <code>TradesStats</code> object:
|
|
<table class="table table-bordered">
|
|
<tr><th>Field</th><th>Description</th></tr>
|
|
<tr>
|
|
<td>TradeCount</td>
|
|
<td>The number trades in this data set</td>
|
|
</tr>
|
|
<tr>
|
|
<td>FirstTradeTime</td>
|
|
<td>The timestamp of the first trade in this data set</td>
|
|
</tr>
|
|
<tr>
|
|
<td>LastTradeTime</td>
|
|
<td>The timestamp of the last trade in this data set</td>
|
|
</tr>
|
|
<tr>
|
|
<td>AveragePrice</td>
|
|
<td>The average price of the trades in this dataset</td>
|
|
</tr>
|
|
<tr>
|
|
<td>VolumeWeightedAveragePrice</td>
|
|
<td>The volume weighted average price for trades in this dataset</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Volume</td>
|
|
<td>The total volume of all trades in this set</td>
|
|
</tr>
|
|
<tr>
|
|
<td>QuoteVolume</td>
|
|
<td>The total volume of all trades in this set denoted in the quote asset</td>
|
|
</tr>
|
|
<tr>
|
|
<td>BuySellRatio</td>
|
|
<td>The buy sell ratio of all trades in this data set. The factor of how much of the trades were a buy.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Complete</td>
|
|
<td>Whether the data set is complete. A set is not complete when not all data is available. For example, when only 1 hour of data is available in the tracker but stats are requested for the last 2 hours.</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p>
|
|
<b>The <code>KlineTracker</code> object</b><br />
|
|
|
|
</p>
|
|
<p>
|
|
The following properties and events are exposed by the <code>KlineTracker</code> object:
|
|
<table class="table table-bordered">
|
|
<tr><th>Field</th><th>Description</th></tr>
|
|
<tr>
|
|
<td>Count</td>
|
|
<td>The total number of klines currently tracked</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Exchange</td>
|
|
<td>The name of the exchange</td>
|
|
</tr>
|
|
<tr>
|
|
<td>SymbolName</td>
|
|
<td>The name of the symbol being tracked</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Symbol</td>
|
|
<td>The symbol as passed in the constructor</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Limit</td>
|
|
<td>The max number of results tracked</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Period</td>
|
|
<td>The max age of results tracked</td>
|
|
</tr>
|
|
<tr>
|
|
<td>SyncedFrom</td>
|
|
<td>The timestamp from which on the klines are registered</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Status</td>
|
|
<td>The current synchronization status. Note the <code>PartiallySynced</code> means that the connection is active, but the data set is not yet complete. For example if the tracker is set to track 10 hours of klines, it could be that currently only 9 hours of data is tracked and it will take another hour to be fully synced.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Last</td>
|
|
<td>The current last kline</td>
|
|
</tr>
|
|
<tr>
|
|
<td>OnAdded</td>
|
|
<td>Event for when a new kline is added</td>
|
|
</tr>
|
|
<tr>
|
|
<td>OnRemoved</td>
|
|
<td>Event for when a kline is removed from the tracker due to not being within the set tracking period/limit anymore</td>
|
|
</tr>
|
|
<tr>
|
|
<td>OnStatusChanged</td>
|
|
<td>Event for when the status of the tracker changes</td>
|
|
</tr>
|
|
|
|
</table>
|
|
</p>
|
|
<p>
|
|
|
|
The following properties are available on the <code>KlinesStats</code> object:
|
|
<table class="table table-bordered">
|
|
<tr><th>Field</th><th>Description</th></tr>
|
|
<tr>
|
|
<td>KlineCount</td>
|
|
<td>The number klines in this data set</td>
|
|
</tr>
|
|
<tr>
|
|
<td>FirstOpenTime</td>
|
|
<td>The open time of the first kline in this data set</td>
|
|
</tr>
|
|
<tr>
|
|
<td>LastOpenTime</td>
|
|
<td>The open time of the last kline in this data set</td>
|
|
</tr>
|
|
<tr>
|
|
<td>LowPrice</td>
|
|
<td>The lowest price for all klines in this set</td>
|
|
</tr>
|
|
<tr>
|
|
<td>HighPrice</td>
|
|
<td>The highest price for all kline in this set</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Volume</td>
|
|
<td>The total volume of all klines in this set</td>
|
|
</tr>
|
|
<tr>
|
|
<td>AverageVolume</td>
|
|
<td>The average volume per kline for all klines in this set</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Complete</td>
|
|
<td>Whether the data set is complete. A set is not complete when not all data is available. For example, when only 1 hour of data is available in the tracker but stats are requested for the last 2 hours.</td>
|
|
</tr>
|
|
|
|
</table>
|
|
</p>
|
|
</section>
|
|
|
|
<hr class="divider">
|
|
<!-- Layout
|
|
============================ -->
|
|
<section id="idocs_logging">
|
|
<h2>Logging</h2>
|
|
|
|
<p>
|
|
The library provides extensive logging, which depends on the dotnet `Microsoft.Extensions.Logging.ILogger` interface. This should provide ease of use when connecting the library logging to your existing logging implementation.
|
|
</p>
|
|
<p>
|
|
When using the Dotnet dependency injection the logging configuration will de determined by the ILogger configuration.
|
|
</p>
|
|
|
|
<p>
|
|
<b>External log providers</b><br />
|
|
External logging libraries can be configured as expected. For example Serilog:
|
|
<pre><code>using Binance.Net;
|
|
using Serilog;
|
|
|
|
Log.Logger = new LoggerConfiguration()
|
|
.MinimumLevel.Debug()
|
|
.WriteTo.Console()
|
|
.CreateLogger();
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
builder.Services.AddBinance();
|
|
builder.Host.UseSerilog();
|
|
var app = builder.Build();
|
|
|
|
// startup
|
|
|
|
app.Run();</code></pre>
|
|
</p>
|
|
|
|
<p>
|
|
<b>Logging without dependency injection</b><br />
|
|
A LoggerFactory instance can be provided to the client to configure the logging
|
|
<pre><code>var logFactory = new LoggerFactory();
|
|
logFactory.AddProvider(new ConsoleLoggerProvider());
|
|
var binanceClient = new BinanceRestClient(new HttpClient(), logFactory, options => { });</code></pre>
|
|
</p>
|
|
</section>
|
|
|
|
<hr class="divider">
|
|
|
|
<!-- Layout
|
|
============================ -->
|
|
<section id="idocs_ratelimiting">
|
|
<h2>Ratelimiting</h2>
|
|
<p>
|
|
The client libraries have build in support for rate limiting. Rate limiting in this case means that requests are throttled (or failed before sending based on configuration) when the client detects a server rate limit will be exceeded. Whether or not rate limiting is applied can be configured in the DI registration or client options. Not all libraries currently have rate limiting configured.
|
|
|
|
<div class="alert alert-info">What to do when a limit is reached can be configured with the <code>RateLimitingBehaviour</code> client options, either <code>Fail</code> for returning an error or <code>Wait</code> to wait until the request can safely be send.</div>
|
|
|
|
</p>
|
|
<p>
|
|
Client side rate limiting can only correctly work if there is only a single program talking to the exchange. When multiple different application send requests at the same time it's impossible for the client side to keep track of the rate limits. When using multiple concurrent applications it is advised to turn off rate limiting. Also note that when requests are rate limited with RateLimitBehaviour.Wait that the order of the requests being send is not guarenteed.
|
|
</p>
|
|
|
|
<p>Client side rate limiting is currently implemented for the following libraries:</p>
|
|
<div class="tab-wrap">
|
|
<ul class="nav nav-tabs" id="limit" role="tablist" style="margin-bottom: -16px;">
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link active" id="limit-cc-tab" data-toggle="tab" href="#limit-cc" role="tab" aria-controls="limit-cc" aria-selected="true">CryptoClients</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="limit-binance-tab" data-toggle="tab" href="#limit-binance" role="tab" aria-controls="limit-binance" aria-selected="false">Binance</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="limit-bingx-tab" data-toggle="tab" href="#limit-bingx" role="tab" aria-controls="limit-bingx" aria-selected="false">BingX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="limit-bitget-tab" data-toggle="tab" href="#limit-bitget" role="tab" aria-controls="limit-bitget" aria-selected="false">Bitget</a>
|
|
</li>
|
|
<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-cryptocom-tab" data-toggle="tab" href="#limit-cryptocom" role="tab" aria-controls="limit-cryptocom" aria-selected="false">Crypto.com</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>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="limit-htx-tab" data-toggle="tab" href="#limit-htx" role="tab" aria-controls="limit-htx" aria-selected="false">HTX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="limit-hyperliquid-tab" data-toggle="tab" href="#limit-hyperliquid" role="tab" aria-controls="limit-hyperliquid" aria-selected="false">HyperLiquid</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="limit-kraken-tab" data-toggle="tab" href="#limit-kraken" role="tab" aria-controls="limit-kraken" aria-selected="false">Kraken</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="limit-kucoin-tab" data-toggle="tab" href="#limit-kucoin" role="tab" aria-controls="limit-kucoin" aria-selected="false">Kucoin</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="limit-mexc-tab" data-toggle="tab" href="#limit-mexc" role="tab" aria-controls="limit-mexc" aria-selected="false">Mexc</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="limit-okx-tab" data-toggle="tab" href="#limit-okx" role="tab" aria-controls="limit-okx" aria-selected="false">OKX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="limit-whitebit-tab" data-toggle="tab" href="#limit-whitebit" role="tab" aria-controls="limit-whitebit" aria-selected="false">WhiteBit</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="limit-xt-tab" data-toggle="tab" href="#limit-xt" role="tab" aria-controls="limit-xt" aria-selected="false">XT</a>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content my-3" id="myTabContent">
|
|
<div class="tab-pane fade show active" id="limit-cc" role="tabpanel" aria-labelledby="limit-cc-tab">
|
|
<pre><code>services.AddCryptoClients(x =>
|
|
x.RatelimiterEnabled = true;
|
|
x.RateLimitingBehaviour = RateLimitingBehaviour.Wait;
|
|
});</code></pre>
|
|
<p>To be notified of when a rate limit is hit the static <code>Exchanges.RateLimiter</code> exposes an event which triggers when a rate limit is reached</p>
|
|
<pre><code>BinanceExchange.RateLimiter.RateLimitTriggered += (rateLimitEvent) => Console.WriteLine("Limit triggered: " + rateLimitEvent);
|
|
|
|
// Output: Limit triggered: RateLimitEvent { ApiLimit = Spot Socket, LimitDescription = Limit of 6000 per 00:01:00, RequestDefinition = GET 1, Host = wss://ws-api.binance.com, Current = 5752, RequestWeight = 250, Limit = 6000, TimePeriod = 00:01:00, DelayTime = 00:00:38.7784145, Behaviour = Wait }
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="limit-binance" role="tabpanel" aria-labelledby="limit-binance-tab">
|
|
<pre><code>services.AddBinance(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>BinanceExchange.RateLimiter</code> exposes an event which triggers when a rate limit is reached</p>
|
|
<pre><code>BinanceExchange.RateLimiter.RateLimitTriggered += (rateLimitEvent) => Console.WriteLine("Limit triggered: " + rateLimitEvent);
|
|
|
|
// Output: Limit triggered: RateLimitEvent { ApiLimit = Spot Socket, LimitDescription = Limit of 6000 per 00:01:00, RequestDefinition = GET 1, Host = wss://ws-api.binance.com, Current = 5752, RequestWeight = 250, Limit = 6000, TimePeriod = 00:01:00, DelayTime = 00:00:38.7784145, Behaviour = Wait }
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="limit-bingx" role="tabpanel" aria-labelledby="limit-bingx-tab">
|
|
<pre><code>services.AddBingX(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>BingXExchange.RateLimiter</code> exposes an event which triggers when a rate limit is reached</p>
|
|
<pre><code>BingXExchange.RateLimiter.RateLimitTriggered += (rateLimitEvent) => Console.WriteLine("Limit triggered: " + rateLimitEvent);
|
|
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="limit-bitget" role="tabpanel" aria-labelledby="limit-bitget-tab">
|
|
<pre><code>services.AddBitget(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>BitgetExchange.RateLimiter</code> exposes an event which triggers when a rate limit is reached</p>
|
|
<pre><code>BitgetExchange.RateLimiter.RateLimitTriggered += (rateLimitEvent) => Console.WriteLine("Limit triggered: " + rateLimitEvent);
|
|
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="limit-bitmart" role="tabpanel" aria-labelledby="limit-bitmart-tab">
|
|
<pre><code>services.AddBitMart(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>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-cryptocom" role="tabpanel" aria-labelledby="limit-cryptocom-tab">
|
|
<pre><code>services.AddCryptoCom(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>CryptoComExchange.RateLimiter</code> exposes an event which triggers when a rate limit is reached</p>
|
|
<pre><code>CryptoComExchange.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">
|
|
<pre><code>services.AddGateIo(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>GateIoExchange.RateLimiter</code> exposes an event which triggers when a rate limit is reached</p>
|
|
<pre><code>GateIoExchange.RateLimiter.RateLimitTriggered += (rateLimitEvent) => Console.WriteLine("Limit triggered: " + rateLimitEvent);
|
|
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="limit-htx" role="tabpanel" aria-labelledby="limit-htx-tab">
|
|
<pre><code>services.AddHTX(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>HTXExchange.RateLimiter</code> exposes an event which triggers when a rate limit is reached</p>
|
|
<pre><code>HTXExchange.RateLimiter.RateLimitTriggered += (rateLimitEvent) => Console.WriteLine("Limit triggered: " + rateLimitEvent);
|
|
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="limit-hyperliquid" role="tabpanel" aria-labelledby="limit-hyperliquid-tab">
|
|
<pre><code>services.AddHyperLiquid(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>HyperLiquidExchange.RateLimiter</code> exposes an event which triggers when a rate limit is reached</p>
|
|
<pre><code>HyperLiquidExchange.RateLimiter.RateLimitTriggered += (rateLimitEvent) => Console.WriteLine("Limit triggered: " + rateLimitEvent);
|
|
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="limit-kraken" role="tabpanel" aria-labelledby="limit-kraken-tab">
|
|
<pre><code>services.AddKraken(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>KrakenExchange.RateLimiter</code> exposes an event which triggers when a rate limit is reached</p>
|
|
<pre><code>KrakenExchange.RateLimiter.RateLimitTriggered += (rateLimitEvent) => Console.WriteLine("Limit triggered: " + rateLimitEvent);
|
|
|
|
// Output: Limit triggered: RateLimitEvent { ApiLimit = Spot Rest, LimitDescription = Limit of 15 with a decay rate of 0,33, RequestDefinition = POST 0/private/TradesHistory authenticated, Host = api.kraken.com, Current = 14, RequestWeight = 2, Limit = 15, TimePeriod = 00:00:01, DelayTime = 00:00:04, Behaviour = Wait }</code></pre>
|
|
|
|
<p>Kraken applies different rate limits based on the account verification tier. By default the rate limit is set to the most conservative <code>Starter</code> tier. To change the rate limit tier call the <code>Configure</code> method</p>
|
|
<pre><code>KrakenExchange.RateLimiter.Configure(Kraken.Net.Enums.RateLimitTier.Pro);</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="limit-kucoin" role="tabpanel" aria-labelledby="limit-kucoin-tab">
|
|
<pre><code>services.AddKucoin(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>KucoinExchange.RateLimiter</code> exposes an event which triggers when a rate limit is reached</p>
|
|
<pre><code>KucoinExchange.RateLimiter.RateLimitTriggered += (rateLimitEvent) => Console.WriteLine("Limit triggered: " + rateLimitEvent);
|
|
|
|
// Output: Limit triggered: RateLimitEvent { ApiLimit = Public Rest, LimitDescription = Limit of 2000 per 00:00:30, RequestDefinition = GET api/v1/market/stats, Host = https://api.kucoin.com/, Current = 1995, RequestWeight = 15, Limit = 2000, TimePeriod = 00:00:30, DelayTime = 00:00:19.8111238, Behaviour = Wait }</code></pre>
|
|
|
|
<p>Kucoin applies different rate limits based on the account VIP level. By default the rate limit is set to the most conservative <code>VIP0</code> tier. To change the rate limit tier call the <code>Configure</code> method</p>
|
|
<pre><code>KucoinExchange.RateLimiter.Configure(Kucoin.Net.Enums.VipLevel.Vip5);</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="limit-mexc" role="tabpanel" aria-labelledby="limit-mexc-tab">
|
|
<pre><code>services.AddMexc(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>MexcExchange.RateLimiter</code> exposes an event which triggers when a rate limit is reached</p>
|
|
<pre><code>MexcExchange.RateLimiter.RateLimitTriggered += (rateLimitEvent) => Console.WriteLine("Limit triggered: " + rateLimitEvent);
|
|
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="limit-okx" role="tabpanel" aria-labelledby="limit-okx-tab">
|
|
<pre><code>services.AddOKX(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>OKXExchange.RateLimiter</code> exposes an event which triggers when a rate limit is reached</p>
|
|
<pre><code>OKXExchange.RateLimiter.RateLimitTriggered += (rateLimitEvent) => Console.WriteLine("Limit triggered: " + rateLimitEvent);
|
|
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="limit-whitebit" role="tabpanel" aria-labelledby="limit-whitebit-tab">
|
|
<pre><code>services.AddWhiteBit(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>WhiteBitExchange.RateLimiter</code> exposes an event which triggers when a rate limit is reached</p>
|
|
<pre><code>WhiteBitExchange.RateLimiter.RateLimitTriggered += (rateLimitEvent) => Console.WriteLine("Limit triggered: " + rateLimitEvent);
|
|
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="limit-xt" role="tabpanel" aria-labelledby="limit-xt-tab">
|
|
<pre><code>services.AddXT(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>XTExchange.RateLimiter</code> exposes an event which triggers when a rate limit is reached</p>
|
|
<pre><code>XTExchange.RateLimiter.RateLimitTriggered += (rateLimitEvent) => Console.WriteLine("Limit triggered: " + rateLimitEvent);
|
|
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<section id="idocs_caching">
|
|
<h2>Caching</h2>
|
|
<p>
|
|
Every REST API client based on the CryptoExchange.Net base library automatically supports caching of GET HTTP requests. A few advantages of caching:
|
|
<ol>
|
|
<li>Performance improvement, data response will be much faster as no roundtrip to the server is needed</li>
|
|
<li>Reduced resource usage, returning data from the cache uses less resources than reading the server response, though there is some memory overhead</li>
|
|
<li>Prevent rate limiting, the cache can be queried as many times as you like without having to worry about getting rate limited by the server</li>
|
|
</ol>
|
|
|
|
<div class="alert alert-info">Caching is only applied for successful GET requests as GET requests by definition should not change state. Other HTTP methods (POST, DELETE, etc) generally do change state, so caching those call would prevent an action being executed.</div>
|
|
|
|
</p>
|
|
<p>
|
|
To enable caching for GET requests set <code>CachingEnabled</code> to <code>true</code> in the client options. Optionally set the <code>CachingMaxAge</code> option to the desired value (default is 5 seconds).
|
|
</p>
|
|
<p>
|
|
To determine whether a request has gotten the data from the server or from the local cache the <code>DataSource</code> property on the call result can inspected:
|
|
<pre><code>var result = await bitfinexRestClient.SpotApi.Account.Get30DaySummaryAndFeesAsync();
|
|
var responseSource = result.DataSource;</code></pre>
|
|
</p>
|
|
|
|
</section>
|
|
|
|
<hr class="divider">
|
|
|
|
<!-- Navbar
|
|
============================ -->
|
|
<section id="idocs_examples">
|
|
<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>
|
|
|
|
<b id="idocs_example_symbols">Get Symbols</b><br />
|
|
<p>Get a list of supported symbols on the exchange and information about the symbols</p>
|
|
<div class="accordion" id="accordionSymbols">
|
|
<div class="card">
|
|
<div class="card-header" id="headingSymbols">
|
|
<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 id="collapseSymbols" class="collapse" aria-labelledby="headingSymbols" data-parent="#accordionSymbols">
|
|
<div class="card-body">
|
|
<div>
|
|
|
|
<ul class="nav nav-tabs" id="example-symbols" role="tablist" style="margin-bottom: -16px;">
|
|
<li class="nav-item" role="presentation">
|
|
<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">CryptoClients</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<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="false">Binance</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-symbols-bingx-tab" data-toggle="tab" href="#example-symbols-bingx" role="tab" aria-controls="example-symbols-bingx" aria-selected="false">BingX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<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>
|
|
<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>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-symbols-bitmart-tab" data-toggle="tab" href="#example-symbols-bitmart" role="tab" aria-controls="example-symbols-bitmart" aria-selected="false">BitMart</a>
|
|
</li>
|
|
<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>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-symbols-cryptocom-tab" data-toggle="tab" href="#example-symbols-cryptocom" role="tab" aria-controls="example-symbols-cryptocom" aria-selected="false">Crypto.com</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-symbols-gateio-tab" data-toggle="tab" href="#example-symbols-gateio" role="tab" aria-controls="example-symbols-gateio" aria-selected="false">GateIo</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-symbols-htx-tab" data-toggle="tab" href="#example-symbols-htx" role="tab" aria-controls="example-symbols-htx" aria-selected="false">HTX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-symbols-hyperliquid-tab" data-toggle="tab" href="#example-symbols-hyperliquid" role="tab" aria-controls="example-symbols-hyperliquid" aria-selected="false">HyperLiquid</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>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-symbols-whitebit-tab" data-toggle="tab" href="#example-symbols-whitebit" role="tab" aria-controls="example-symbols-whitebit" aria-selected="false">WhiteBit</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-symbols-xt-tab" data-toggle="tab" href="#example-symbols-xt" role="tab" aria-controls="example-symbols-xt" aria-selected="false">XT</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>// This example uses Binance, but can be any supported exchange. For example Bybit, Kraken, Kucoin etc
|
|
|
|
// Directly reference the Exchange API:
|
|
await exchangeRestClient.Binance.SpotApi.ExchangeData.GetExchangeInfoAsync();
|
|
|
|
// Or make it fully dynamic, either request on a single exchange:
|
|
await exchangeRestClient.GetSpotSymbolClient("Binance")!.GetSpotSymbolsAsync(new GetSymbolsRequest());
|
|
// Or request multiple exchanges at the same time:
|
|
await exchangeRestClient.GetSpotSymbolsAsync(new GetSymbolsRequest(), ["Binance", "Kraken", "OKX"]);</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-bingx" role="tabpanel" aria-labelledby="example-symbols-bingx-tab">
|
|
<pre><code>await bingXClient.SpotApi.ExchangeData.GetSymbolsAsync();</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.SpotApiV2.ExchangeData.GetSymbolsAsync();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-symbols-bitmart" role="tabpanel" aria-labelledby="example-symbols-bitmart-tab">
|
|
<pre><code>await bitMartClient.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-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>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-symbols-cryptocom" role="tabpanel" aria-labelledby="example-symbols-cryptocom-tab">
|
|
<pre><code>await cryptoComClient.ExchangeApi.ExchangeData.GetSymbolsAsync();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-symbols-gateio" role="tabpanel" aria-labelledby="example-symbols-gateio-tab">
|
|
<pre><code>await gateIoClient.SpotApi.ExchangeData.GetSymbolsAsync();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-symbols-htx" role="tabpanel" aria-labelledby="example-symbols-htx-tab">
|
|
<pre><code>await htxClient.SpotApi.ExchangeData.GetSymbolsAsync();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-symbols-hyperliquid" role="tabpanel" aria-labelledby="example-symbols-hyperliquid-tab">
|
|
<pre><code>await hyperLiquidClient.SpotApi.ExchangeData.GetExchangeInfoAsync();</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 class="tab-pane fade" id="example-symbols-whitebit" role="tabpanel" aria-labelledby="example-symbols-whitebit-tab">
|
|
<pre><code>await whitebitClient.V4Api.ExchangeData.GetSymbolsAsync();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-symbols-xt" role="tabpanel" aria-labelledby="example-symbols-xt-tab">
|
|
<pre><code>await xtClient.SpotApi.ExchangeData.GetSymbolsAsync();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<b id="idocs_example_ticker">Getting Ticker</b><br />
|
|
<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">CryptoClients</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-bingx-tab" data-toggle="tab" href="#example-ticker-bingx" role="tab" aria-controls="example-ticker-bingx" aria-selected="true">BingX</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-bitmart-tab" data-toggle="tab" href="#example-ticker-bitmart" role="tab" aria-controls="example-ticker-bitmart" aria-selected="false">BitMart</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-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>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-ticker-cryptocom-tab" data-toggle="tab" href="#example-ticker-cryptocom" role="tab" aria-controls="example-ticker-cryptocom" aria-selected="false">Crypto.com</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-ticker-gateio-tab" data-toggle="tab" href="#example-ticker-gateio" role="tab" aria-controls="example-ticker-gateio" aria-selected="false">GateIo</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-ticker-htx-tab" data-toggle="tab" href="#example-ticker-htx" role="tab" aria-controls="example-ticker-htx" aria-selected="false">HTX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-ticker-hyperliquid-tab" data-toggle="tab" href="#example-ticker-hyperliquid" role="tab" aria-controls="example-ticker-hyperliquid" aria-selected="false">HyperLiquid</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>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-ticker-whitebit-tab" data-toggle="tab" href="#example-ticker-whitebit" role="tab" aria-controls="example-ticker-whitebit" aria-selected="false">WhiteBit</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-ticker-xt-tab" data-toggle="tab" href="#example-ticker-xt" role="tab" aria-controls="example-ticker-xt" aria-selected="false">XT</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>// This example uses Binance, but can be any supported exchange. For example Bybit, Kraken, Kucoin etc
|
|
|
|
// Directly reference the Exchange API:
|
|
await exchangeRestClient.Binance.SpotApi.ExchangeData.GetTickerAsync("ETHUSDT");
|
|
|
|
// Or make it fully dynamic, either request on a single exchange:
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
await exchangeRestClient.GetSpotTickerClient("Binance")!.GetSpotTickerAsync(new GetTickerRequest(symbol));
|
|
// Or request multiple exchanges at the same time:
|
|
await exchangeRestClient.GetSpotTickerAsync(new GetTickerRequest(symbol), ["Binance", "Kraken", "OKX"]);</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-bingx" role="tabpanel" aria-labelledby="example-ticker-bingx-tab">
|
|
<pre><code>await bingXClient.SpotApi.ExchangeData.GetTickersAsync("BTC-USDT");</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.SpotApiV2.ExchangeData.GetTickersAsync("BTCUSDT");</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-ticker-bitmart" role="tabpanel" aria-labelledby="example-ticker-bitmart-tab">
|
|
<pre><code>await bitMartClient.SpotApi.ExchangeData.GetTickerAsync("BTC_USDT");</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-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>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-ticker-cryptocom" role="tabpanel" aria-labelledby="example-ticker-cryptocom-tab">
|
|
<pre><code>await cryptoComClient.ExchangeApi.ExchangeData.GetTickersAsync("BTC_USDT");</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-ticker-gateio" role="tabpanel" aria-labelledby="example-ticker-gateio-tab">
|
|
<pre><code>await gateioClient.SpotApi.ExchangeData.GetTickersAsync("BTC_USDT");</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-ticker-htx" role="tabpanel" aria-labelledby="example-ticker-htx-tab">
|
|
<pre><code>await htxClient.SpotApi.ExchangeData.GetTickerAsync("BTCUSDT");</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-ticker-hyperliquid" role="tabpanel" aria-labelledby="example-ticker-hyperliquid-tab">
|
|
<pre><code>// HyperLiquid API doesn't offer a symbol filter, so we have to filter client side
|
|
var tickersResult = await hyperLiquidClient.SpotApi.ExchangeData.GetExchangeInfoAndTickersAsync();
|
|
var ticker = tickersResult.Data.Tickers.Single(x => x.Symbol == "HYPE/USDC");</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 class="tab-pane fade" id="example-ticker-whitebit" role="tabpanel" aria-labelledby="example-ticker-whitebit-tab">
|
|
<pre><code>// WhiteBit API doesn't offer a symbol filter, so we have to filter client side
|
|
var tickersResult = await whitebitClient.V4Api.ExchangeData.GetTickersAsync();
|
|
var ticker = tickersResult.Data.Single(x => x.Symbol == "BTC_USDT");</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-ticker-xt" role="tabpanel" aria-labelledby="example-ticker-xt-tab">
|
|
<pre><code>await xtClient.SpotApi.ExchangeData.GetTickersAsync("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">CryptoClients</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-bingx-tab" data-toggle="tab" href="#example-balances-bingx" role="tab" aria-controls="example-balances-bingx" aria-selected="true">BingX</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-bitmart-tab" data-toggle="tab" href="#example-balances-bitmart" role="tab" aria-controls="example-balances-bitmart" aria-selected="false">BitMart</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-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>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-balances-cryptocom-tab" data-toggle="tab" href="#example-balances-cryptocom" role="tab" aria-controls="example-balances-cryptocom" aria-selected="false">Crypto.com</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-balances-gateio-tab" data-toggle="tab" href="#example-balances-gateio" role="tab" aria-controls="example-balances-gateio" aria-selected="false">GateIo</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-balances-htx-tab" data-toggle="tab" href="#example-balances-htx" role="tab" aria-controls="example-balances-htx" aria-selected="false">HTX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-balances-hyperliquid-tab" data-toggle="tab" href="#example-balances-hyperliquid" role="tab" aria-controls="example-balances-hyperliquid" aria-selected="false">HyperLiquid</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>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-balances-whitebit-tab" data-toggle="tab" href="#example-balances-whitebit" role="tab" aria-controls="example-balances-whitebit" aria-selected="false">WhiteBit</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-balances-xt-tab" data-toggle="tab" href="#example-balances-xt" role="tab" aria-controls="example-balances-xt" aria-selected="false">XT</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>// This example uses Binance, but can be any supported exchange. For example Bybit, Kraken, Kucoin etc
|
|
|
|
// Directly reference the Exchange API:
|
|
await exchangeRestClient.Binance.SpotApi.Account.GetBalancesAsync();
|
|
|
|
// Or make it fully dynamic, either request on a single exchange:
|
|
await exchangeRestClient.GetBalancesClient(TradingMode.Spot, "Binance")!.GetBalancesAsync(new GetBalancesRequest());
|
|
// Or request multiple exchanges at the same time:
|
|
await exchangeRestClient.GetBalancesAsync(new GetBalancesRequest(TradingMode.Spot), ["Binance", "Kraken", "OKX"]);</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-bingx" role="tabpanel" aria-labelledby="example-balances-bingx-tab">
|
|
<pre><code>await bingXClient.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.SpotApiV2.Account.GetSpotBalancesAsync();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-balances-bitmart" role="tabpanel" aria-labelledby="example-balances-bitmart-tab">
|
|
<pre><code>await bitMartClient.SpotApi.Account.GetSpotBalancesAsync();</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>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-balances-cryptocom" role="tabpanel" aria-labelledby="example-balances-cryptocom-tab">
|
|
<pre><code>await cryptoComClient.ExchangeApi.Account.GetBalancesAsync();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-balances-gateio" role="tabpanel" aria-labelledby="example-balances-gateio-tab">
|
|
<pre><code>await gateioClient.SpotApi.Account.GetBalancesAsync();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-balances-htx" role="tabpanel" aria-labelledby="example-balances-htx-tab">
|
|
<pre><code>// Need an account id, you probably want to already have done this before placing the order
|
|
var accounts = await htxClient.SpotApi.Account.GetAccountsAsync();
|
|
var account = accounts.Data.Single(a => a.Type == AccountType.Spot);
|
|
|
|
var result = await htxClient.SpotApi.Account.GetBalancesAsync();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-balances-hyperliquid" role="tabpanel" aria-labelledby="example-balances-hyperliquid-tab">
|
|
<pre><code>await hyperLiquidClient.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 class="tab-pane fade" id="example-balances-whitebit" role="tabpanel" aria-labelledby="example-balances-whitebit-tab">
|
|
<pre><code>await whitebitClient.V4Api.Account.GetSpotBalancesAsync();</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-balances-xt" role="tabpanel" aria-labelledby="example-balances-xt-tab">
|
|
<pre><code>await xtClient.SpotApi.Account.GetBalancesAsync();</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="card">
|
|
<div class="card-header" id="headingPlaceOrder">
|
|
<h5 class="mb-0"> <a href="#" class="collapsed" data-toggle="collapse" data-target="#collapsePlaceOrder" aria-expanded="false" aria-controls="collapseOne">Show</a> </h5>
|
|
</div>
|
|
<div id="collapsePlaceOrder" class="collapse" aria-labelledby="headingPlaceOrder" data-parent="#accordionPlaceOrder">
|
|
<div class="card-body">
|
|
<div>
|
|
|
|
<ul class="nav nav-tabs" id="example-place" role="tablist" style="margin-bottom: -16px;">
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link active" id="example-place-general-tab" data-toggle="tab" href="#example-place-general" role="tab" aria-controls="example-place-general" aria-selected="true">CryptoClients</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-place-binance-tab" data-toggle="tab" href="#example-place-binance" role="tab" aria-controls="example-place-binance" aria-selected="true">Binance</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-place-binance-tab" data-toggle="tab" href="#example-place-bingx" role="tab" aria-controls="example-place-bingx" aria-selected="true">BingX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-place-bitfinex-tab" data-toggle="tab" href="#example-place-bitfinex" role="tab" aria-controls="example-place-bitfinex" aria-selected="false">Bitfinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-place-bitget-tab" data-toggle="tab" href="#example-place-bitget" role="tab" aria-controls="example-place-bitget" aria-selected="false">Bitget</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-place-bitmart-tab" data-toggle="tab" href="#example-place-bitmart" role="tab" aria-controls="example-place-bitmart" aria-selected="false">BitMart</a>
|
|
</li>
|
|
<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>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-place-cryptocom-tab" data-toggle="tab" href="#example-place-cryptocom" role="tab" aria-controls="example-place-cryptocom" aria-selected="false">Crypto.com</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-place-gateio-tab" data-toggle="tab" href="#example-place-gateio" role="tab" aria-controls="example-place-gateio" aria-selected="false">GateIo</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-place-htx-tab" data-toggle="tab" href="#example-place-htx" role="tab" aria-controls="example-place-htx" aria-selected="false">HTX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-place-hyperliquid-tab" data-toggle="tab" href="#example-place-hyperliquid" role="tab" aria-controls="example-place-hyperliquid" aria-selected="false">HyperLiquid</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-place-kraken-tab" data-toggle="tab" href="#example-place-kraken" role="tab" aria-controls="example-place-kraken" aria-selected="false">Kraken</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-place-kucoin-tab" data-toggle="tab" href="#example-place-kucoin" role="tab" aria-controls="example-place-kucoin" aria-selected="false">Kucoin</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-place-mexc-tab" data-toggle="tab" href="#example-place-mexc" role="tab" aria-controls="example-place-mexc" aria-selected="false">Mexc</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-place-okx-tab" data-toggle="tab" href="#example-place-okx" role="tab" aria-controls="example-place-okx" aria-selected="false">OKX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-place-whitebit-tab" data-toggle="tab" href="#example-place-whitebit" role="tab" aria-controls="example-place-whitebit" aria-selected="false">WhiteBit</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-place-xt-tab" data-toggle="tab" href="#example-place-xt" role="tab" aria-controls="example-place-xt" aria-selected="false">XT</a>
|
|
</li>
|
|
</ul>
|
|
<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">
|
|
<pre><code>// This example uses Binance, but can be any supported exchange. For example Bybit, Kraken, Kucoin etc
|
|
|
|
// Directly reference the Exchange API:
|
|
await exchangeRestClient.Binance.SpotApi.Trading.PlaceOrderAsync("BTCUSDT", Binance.Net.Enums.OrderSide.Buy, Binance.Net.Enums.SpotOrderType.Limit, 0.1m, price: 50000, timeInForce: Binance.Net.Enums.TimeInForce.GoodTillCanceled);
|
|
|
|
// Or make it fully dynamic:
|
|
await exchangeRestClient.GetSpotOrderClient("Binance")!.PlaceSpotOrderAsync(new PlaceSpotOrderRequest(new SharedSymbol(TradingMode.Spot, "ETH", "USDT"), SharedOrderSide.Buy, SharedOrderType.Limit, 0.1m, price: 50000));</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-place-binance" role="tabpanel" aria-labelledby="example-place-binance-tab">
|
|
<pre><code>await binanceClient.SpotApi.Trading.PlaceOrderAsync("BTCUSDT", OrderSide.Buy, SpotOrderType.Limit, 0.1m, price: 50000, timeInForce: TimeInForce.GoodTillCanceled);</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-place-bingx" role="tabpanel" aria-labelledby="example-place-bingx-tab">
|
|
<pre><code>await bingXClient.SpotApi.Trading.PlaceOrderAsync("BTC-USDT", OrderSide.Buy, OrderType.Limit, 0.1m, price: 50000);</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-place-bitfinex" role="tabpanel" aria-labelledby="example-place-bitfinex-tab">
|
|
<pre><code>await bitfinexClient.SpotApi.Trading.PlaceOrderAsync("tBTCUST", OrderSide.Buy, OrderType.Limit, 0.1m, 50000);</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-place-bitget" role="tabpanel" aria-labelledby="example-place-bitget-tab">
|
|
<pre><code>await bitgetRestClient.SpotApiV2.Trading.PlaceOrderAsync("BTCUSDT_SPBL", OrderSide.Buy, OrderType.Limit, 0.1m, timeInForce: TimeInForce.GoodTillCanceled, price: 50000);</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-place-bitmart" role="tabpanel" aria-labelledby="example-place-bitmart-tab">
|
|
<pre><code>await bitMartClient.SpotApi.Trading.PlaceOrderAsync("BTC_USDT", OrderSide.Buy, OrderType.Limit, 0.1m, price: 50000);</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-place-bybit" role="tabpanel" aria-labelledby="example-place-bybit-tab">
|
|
<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-coinbase" role="tabpanel" aria-labelledby="example-place-coinbase-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-cryptocom" role="tabpanel" aria-labelledby="example-place-cryptocom-tab">
|
|
<pre><code>await cryptoComClient.ExchangeApi.Trading.PlaceOrderAsync("BTC_USDT", OrderSide.Buy, OrderType.Limit, 0.1m, price: 50000, timeInForce: TimeInForce.GoodTillCancel);</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-place-gateio" role="tabpanel" aria-labelledby="example-place-gateio-tab">
|
|
<pre><code>await gateIoClient.SpotApi.Trading.PlaceOrderAsync("BTC_USDT", OrderSide.Buy, NewOrderType.Limit, 0.1m, 50000, timeInForce: TimeInForce.GoodTillCancel);</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-place-htx" role="tabpanel" aria-labelledby="example-place-htx-tab">
|
|
<pre><code>// Need an account id, you probably want to already have done this before placing the order
|
|
var accounts = await htxClient.SpotApi.Account.GetAccountsAsync();
|
|
var account = accounts.Data.Single(a => a.Type == AccountType.Spot);
|
|
|
|
var result = await htxClient.SpotApi.Trading.PlaceOrderAsync(account.Id, "BTCUSDT", OrderSide.Buy, OrderType.Limit, 0.1m, price: 50000);</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-place-hyperliquid" role="tabpanel" aria-labelledby="example-place-hyperliquid-tab">
|
|
<pre><code>// BTC not support on HyperLiquid Spot trading, example uses HYPE/USDC Pair
|
|
await hyperLiquidClient.SpotApi.Trading.PlaceOrderAsync("HYPE/USDC",OrderSide.Buy, OrderType.Limit, 1m, 20);</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-place-kraken" role="tabpanel" aria-labelledby="example-place-kraken-tab">
|
|
<pre><code>await krakenClient.SpotApi.Trading.PlaceOrderAsync("BTCUSDT",OrderSide.Buy, OrderType.Limit, 0.1m, 50000);</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-place-kucoin" role="tabpanel" aria-labelledby="example-place-kucoin-tab">
|
|
<pre><code>await kucoinClient.SpotApi.Trading.PlaceOrderAsync("BTC-USDT", OrderSide.Buy, NewOrderType.Limit, 0.1m, 50000);</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-place-mexc" role="tabpanel" aria-labelledby="example-place-mexc-tab">
|
|
<pre><code>await mexcClient.SpotApi.Trading.PlaceOrderAsync("BTCUSDT", Mexc.Net.Enums.OrderSide.Buy, Mexc.Net.Enums.OrderType.Limit, 0.1m, price: 50000);</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-place-okx" role="tabpanel" aria-labelledby="example-place-okx-tab">
|
|
<pre><code>await okxClient.UnifiedApi.Trading.PlaceOrderAsync("BTC-USDT", OKXOrderSide.Buy, OKXOrderType.LimitOrder, 0.1m, 50000);</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-place-whitebit" role="tabpanel" aria-labelledby="example-place-whitebit-tab">
|
|
<pre><code>await whitebitClient.V4Api.Trading.PlaceSpotOrderAsync("BTC_USDT", OrderSide.Buy, NewOrderType.Limit, 0.1m, price: 50000);</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-place-xt" role="tabpanel" aria-labelledby="example-place-xt-tab">
|
|
<pre><code>await xtClient.SpotApi.Trading.PlaceOrderAsync("eth_usdt", OrderSide.Buy, OrderType.Limit, TimeInForce.GoodTillCanceled, BusinessType.Spot, 0.1m, price: 50000);</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<b id="idocs_example_stream_ticker">Subscribe Ticker Updates</b><br />
|
|
<p>Subscribe to the websocket ticker update stream</p>
|
|
<div class="accordion" id="accordionStreamTicker">
|
|
<div class="card">
|
|
<div class="card-header" id="headingStreamTicker">
|
|
<h5 class="mb-0"> <a href="#" class="collapsed" data-toggle="collapse" data-target="#collapseStreamTicker" aria-expanded="false" aria-controls="collapseOne">Show</a> </h5>
|
|
</div>
|
|
<div id="collapseStreamTicker" class="collapse" aria-labelledby="headingStreamTicker" data-parent="#accordionStreamTicker">
|
|
<div class="card-body">
|
|
<div>
|
|
|
|
<ul class="nav nav-tabs" id="example-stream-ticker" role="tablist" style="margin-bottom: -16px;">
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link active" id="example-stream-ticker-cc-tab" data-toggle="tab" href="#example-stream-ticker-cc" role="tab" aria-controls="example-stream-ticker-cc" aria-selected="true">CryptoClients</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-ticker-binance-tab" data-toggle="tab" href="#example-stream-ticker-binance" role="tab" aria-controls="example-stream-ticker-binance" aria-selected="true">Binance</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-ticker-bingx-tab" data-toggle="tab" href="#example-stream-ticker-bingx" role="tab" aria-controls="example-stream-ticker-bingx" aria-selected="false">BingX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-ticker-bitfinex-tab" data-toggle="tab" href="#example-stream-ticker-bitfinex" role="tab" aria-controls="example-stream-ticker-bitfinex" aria-selected="false">Bitfinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-ticker-bitget-tab" data-toggle="tab" href="#example-stream-ticker-bitget" role="tab" aria-controls="example-stream-ticker-bitget" aria-selected="false">Bitget</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-ticker-bitmart-tab" data-toggle="tab" href="#example-stream-ticker-bitmart" role="tab" aria-controls="example-stream-ticker-bitmart" aria-selected="false">BitMart</a>
|
|
</li>
|
|
<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>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-ticker-cryptocom-tab" data-toggle="tab" href="#example-stream-ticker-cryptocom" role="tab" aria-controls="example-stream-ticker-cryptocom" aria-selected="false">Crypto.com</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-ticker-gateio-tab" data-toggle="tab" href="#example-stream-ticker-gateio" role="tab" aria-controls="example-stream-ticker-gateio" aria-selected="false">GateIo</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-ticker-htx-tab" data-toggle="tab" href="#example-stream-ticker-htx" role="tab" aria-controls="example-stream-ticker-htx" aria-selected="false">HTX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-ticker-hyperliquid-tab" data-toggle="tab" href="#example-stream-ticker-hyperliquid" role="tab" aria-controls="example-stream-ticker-hyperliquid" aria-selected="false">HyperLiquid</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-ticker-kraken-tab" data-toggle="tab" href="#example-stream-ticker-kraken" role="tab" aria-controls="example-stream-ticker-kraken" aria-selected="false">Kraken</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-ticker-kucoin-tab" data-toggle="tab" href="#example-stream-ticker-kucoin" role="tab" aria-controls="example-stream-ticker-kucoin" aria-selected="false">Kucoin</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-ticker-mexc-tab" data-toggle="tab" href="#example-stream-ticker-mexc" role="tab" aria-controls="example-stream-ticker-mexc" aria-selected="false">Mexc</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-ticker-okx-tab" data-toggle="tab" href="#example-stream-ticker-okx" role="tab" aria-controls="example-stream-ticker-okx" aria-selected="false">OKX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-ticker-whitebit-tab" data-toggle="tab" href="#example-stream-ticker-whitebit" role="tab" aria-controls="example-stream-ticker-whitebit" aria-selected="false">WhiteBit</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-ticker-xt-tab" data-toggle="tab" href="#example-stream-ticker-xt" role="tab" aria-controls="example-stream-ticker-xt" aria-selected="false">XT</a>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content my-3" id="myTabContent">
|
|
<div class="tab-pane fade show active" id="example-stream-ticker-cc" role="tabpanel" aria-labelledby="example-stream-ticker-cc-tab">
|
|
<pre><code>// This example uses Binance, but can be any supported exchange. For example Bybit, Kraken, Kucoin etc
|
|
|
|
// Directly reference the Exchange API:
|
|
await exchangeSocketClient.Binance.SpotApi.ExchangeData.SubscribeToTickerUpdatesAsync("ETHUSDT", data => {
|
|
// Handle update
|
|
});
|
|
|
|
// Or make it fully dynamic, either subscribe on a single exchange:
|
|
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
|
|
await exchangeSocketClient.GetTickerClient(TradingMode.Spot, "Binance")!.SubscribeToTickerUpdatesAsync(new SubscribeTickerRequest(symbol), data => {
|
|
// Handle update
|
|
});
|
|
// Or subscribe on multiple exchanges at the same time:
|
|
await exchangeSocketClient.SubscribeToTickerUpdatesAsync(new SubscribeTickerRequest(symbol), data => {
|
|
// Handle update
|
|
}, ["Binance", "Kraken", "OKX"]);</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-ticker-binance" role="tabpanel" aria-labelledby="example-stream-ticker-binance-tab">
|
|
<pre><code>await binanceSocketClient.SpotApi.ExchangeData.SubscribeToTickerUpdatesAsync("ETHUSDT", data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-ticker-bingx" role="tabpanel" aria-labelledby="example-stream-ticker-bingx-tab">
|
|
<pre><code>await bingXSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETH-USDT", data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-ticker-bitfinex" role="tabpanel" aria-labelledby="example-stream-ticker-bitfinex-tab">
|
|
<pre><code>await bitfinexSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("tETHUST", data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-ticker-bitget" role="tabpanel" aria-labelledby="example-stream-ticker-bitget-tab">
|
|
<pre><code>await bitgetSocketClient.SpotApiV2.SubscribeToTickerUpdatesAsync("ETHUSDT", data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-ticker-bitmart" role="tabpanel" aria-labelledby="example-stream-ticker-bitmart-tab">
|
|
<pre><code>await bitmartSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETH_USDT", data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<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">
|
|
<pre><code>await coinExSocketClient.SpotApiV2.SubscribeToTickerUpdatesAsync(new[] { "ETHUSDT" }, data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-ticker-cryptocom" role="tabpanel" aria-labelledby="example-stream-ticker-cryptocom-tab">
|
|
<pre><code>await cryptoComSocketClient.ExchangeApi.SubscribeToTickerUpdatesAsync("ETH_USDT", data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-ticker-gateio" role="tabpanel" aria-labelledby="example-stream-ticker-gateio-tab">
|
|
<pre><code>await gateioSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETH_USDT", data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-ticker-hyperliquid" role="tabpanel" aria-labelledby="example-stream-ticker-hyperliquid-tab">
|
|
<pre><code>await hyperLiquidSocketClient.SpotApi.SubscribeToSymbolUpdatesAsync("HYPE/USDC", data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-ticker-htx" role="tabpanel" aria-labelledby="example-stream-ticker-htx-tab">
|
|
<pre><code>await htxSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ethusdt", data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-ticker-kraken" role="tabpanel" aria-labelledby="example-stream-ticker-kraken-tab">
|
|
<pre><code>await krakenSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETHUSD", data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-ticker-kucoin" role="tabpanel" aria-labelledby="example-stream-ticker-kucoin-tab">
|
|
<pre><code>await kucoinSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETH-USDT", data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-ticker-mexc" role="tabpanel" aria-labelledby="example-stream-ticker-mexc-tab">
|
|
<pre><code>await mexcSocketClient.SpotApi.SubscribeToMiniTickerUpdatesAsync("ETHUSDT", data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-ticker-okx" role="tabpanel" aria-labelledby="example-stream-ticker-okx-tab">
|
|
<pre><code>await okxSocketClient.UnifiedApi.ExchangeData.SubscribeToTickerUpdatesAsync("ETHUSDT", data => {
|
|
// Handle update
|
|
});
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-ticker-whitebit" role="tabpanel" aria-labelledby="example-stream-ticker-whitebit-tab">
|
|
<pre><code>await whitebitSocketClient.V4Api.SubscribeToTickerUpdatesAsync("ETH_USDT", data => {
|
|
// Handle update
|
|
});
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-ticker-xt" role="tabpanel" aria-labelledby="example-stream-ticker-xt-tab">
|
|
<pre><code>await xtSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("eth_usdt", data => {
|
|
// Handle update
|
|
});
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<b id="idocs_example_stream_order">Subscribe Order Updates</b><br />
|
|
<p>Subscribe to the websocket authenticated user order update stream</p>
|
|
<div class="accordion" id="accordionStreamOrder">
|
|
<div class="card">
|
|
<div class="card-header" id="headingStreamOrder">
|
|
<h5 class="mb-0"> <a href="#" class="collapsed" data-toggle="collapse" data-target="#collapseStreamOrder" aria-expanded="false" aria-controls="collapseOne">Show</a> </h5>
|
|
</div>
|
|
<div id="collapseStreamOrder" class="collapse" aria-labelledby="headingStreamOrder" data-parent="#accordionStreamOrder">
|
|
<div class="card-body">
|
|
<div>
|
|
|
|
<ul class="nav nav-tabs" id="example-stream-order" role="tablist" style="margin-bottom: -16px;">
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link active" id="example-stream-order-cc-tab" data-toggle="tab" href="#example-stream-order-cc" role="tab" aria-controls="example-stream-order-cc" aria-selected="true">CryptoClients</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-order-binance-tab" data-toggle="tab" href="#example-stream-order-binance" role="tab" aria-controls="example-stream-order-binance" aria-selected="false">Binance</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-order-bitfinex-tab" data-toggle="tab" href="#example-stream-order-bingx" role="tab" aria-controls="example-stream-order-bingx" aria-selected="false">BingX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-order-bitfinex-tab" data-toggle="tab" href="#example-stream-order-bitfinex" role="tab" aria-controls="example-stream-order-bitfinex" aria-selected="false">Bitfinex</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-order-bitget-tab" data-toggle="tab" href="#example-stream-order-bitget" role="tab" aria-controls="example-stream-order-bitget" aria-selected="false">Bitget</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-order-bitmart-tab" data-toggle="tab" href="#example-stream-order-bitmart" role="tab" aria-controls="example-stream-order-bitmart" aria-selected="false">BitMart</a>
|
|
</li>
|
|
<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>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-order-cryptocom-tab" data-toggle="tab" href="#example-stream-order-cryptocom" role="tab" aria-controls="example-stream-order-cryptocom" aria-selected="false">Crypto.com</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-order-gateio-tab" data-toggle="tab" href="#example-stream-order-gateio" role="tab" aria-controls="example-stream-order-gateio" aria-selected="false">GateIo</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-order-htx-tab" data-toggle="tab" href="#example-stream-order-htx" role="tab" aria-controls="example-stream-order-htx" aria-selected="false">HTX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-order-hyperliquid-tab" data-toggle="tab" href="#example-stream-order-hyperliquid" role="tab" aria-controls="example-stream-order-hyperliquid" aria-selected="false">HyperLiquid</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-order-kraken-tab" data-toggle="tab" href="#example-stream-order-kraken" role="tab" aria-controls="example-stream-order-kraken" aria-selected="false">Kraken</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-order-kucoin-tab" data-toggle="tab" href="#example-stream-order-kucoin" role="tab" aria-controls="example-stream-order-kucoin" aria-selected="false">Kucoin</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-order-mexc-tab" data-toggle="tab" href="#example-stream-order-mexc" role="tab" aria-controls="example-stream-order-mexc" aria-selected="false">Mexc</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-order-okx-tab" data-toggle="tab" href="#example-stream-order-okx" role="tab" aria-controls="example-stream-order-okx" aria-selected="false">OKX</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-order-whitebit-tab" data-toggle="tab" href="#example-stream-order-whitebit" role="tab" aria-controls="example-stream-order-whitebit" aria-selected="false">WhiteBit</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link" id="example-stream-order-xt-tab" data-toggle="tab" href="#example-stream-order-xt" role="tab" aria-controls="example-stream-order-xt" aria-selected="false">XT</a>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content my-3" id="myTabContent">
|
|
<div class="tab-pane fade show active" id="example-stream-order-cc" role="tabpanel" aria-labelledby="example-stream-order-cc-tab">
|
|
<pre><code>// This example uses Binance, but can be any exchange support. For example Bybit, Kraken, Kucoin etc
|
|
// Binance requires a listenkey to start the user stream
|
|
|
|
//Directly reference the Exchange API:
|
|
var listenKey = await exchangeRestClient.Binance.SpotApi.Account.StartUserStreamAsync();
|
|
await exchangeSocketClient.Binance.SpotApi.Account.SubscribeToUserDataUpdatesAsync(listenKey.Data, data =>
|
|
{
|
|
// Handle update
|
|
}, null, null, null);
|
|
|
|
|
|
// Or make it fully dynamic:
|
|
string? listenKey = null;
|
|
var listenkeyClient = exchangeRestClient.GetListenKeyClient(TradingMode.Spot, "Binance");
|
|
if (listenkeyClient != null)
|
|
{
|
|
// Exchange needs a listenkey; so request that
|
|
var listenKeyResult = await listenkeyClient.StartListenKeyAsync(new StartListenKeyRequest());
|
|
listenKey = listenKeyResult.Data;
|
|
}
|
|
await exchangeSocketClient.GetSpotOrderClient("Binance")!.SubscribeToSpotOrderUpdatesAsync(new SubscribeSpotOrderRequest(listenKey: listenKey), data =>
|
|
{
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-order-binance" role="tabpanel" aria-labelledby="example-stream-order-binance-tab">
|
|
<pre><code>// Retrieve the listen key
|
|
var listenKey = await binanceClient.SpotApi.Account.StartUserStreamAsync();
|
|
|
|
// Subscribe using the key
|
|
await binanceSocketClient.SpotApi.Account.SubscribeToUserDataUpdatesAsync(listenKey.Data, data => {
|
|
// Handle update
|
|
}, null, null, null);
|
|
|
|
// The listen key will stay valid for 60 minutes, after this no updates will be send anymore
|
|
// To extend the life time of the listen key it is recommended to call the KeepAliveUserStreamAsync method every 30 minutes
|
|
_ = Task.Run(async () => {
|
|
while (true)
|
|
{
|
|
await Task.Delay(Timespan.FromMinutes(30));
|
|
await binanceClient.SpotApi.Account.KeepAliveUserStreamAsync(listenKey.Data);
|
|
}
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-order-bingx" role="tabpanel" aria-labelledby="example-stream-order-bingx-tab">
|
|
<pre><code>// Retrieve the listen key
|
|
var listenKey = await bingXRestClient.SpotApi.Account.StartUserStreamAsync();
|
|
|
|
// Subscribe using the key
|
|
await bingXSocketClient.SpotApi.SubscribeToBalanceUpdatesAsync(listenKey.Data, data => {
|
|
// Handle update
|
|
});
|
|
|
|
// The listen key will stay valid for 60 minutes, after this no updates will be send anymore
|
|
// To extend the life time of the listen key it is recommended to call the KeepAliveUserStreamAsync method every 30 minutes
|
|
_ = Task.Run(async () => {
|
|
while (true)
|
|
{
|
|
await Task.Delay(Timespan.FromMinutes(30));
|
|
await bingXClient.SpotApi.Account.KeepAliveUserStreamAsync(listenKey.Data);
|
|
}
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-order-bitfinex" role="tabpanel" aria-labelledby="example-stream-order-bitfinex-tab">
|
|
<pre><code>await bitfinexSocketClient.SpotApi.SubscribeToUserUpdatesAsync(orderHandler: data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-order-bitget" role="tabpanel" aria-labelledby="example-stream-order-bitget-tab">
|
|
<pre><code>await bitgetSocketClient.SpotApiV2.SubscribeToOrderUpdatesAsync(data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-order-bitmart" role="tabpanel" aria-labelledby="example-stream-order-bitmart-tab">
|
|
<pre><code>await bitMartSocketClient.SpotApi.SubscribeToOrderUpdatesAsync(data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<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">
|
|
<pre><code>await coinExSocketClient.SpotApiV2.SubscribeToOrderUpdatesAsync(data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-order-cryptocom" role="tabpanel" aria-labelledby="example-stream-order-cryptocom-tab">
|
|
<pre><code>await cryptoComSocketClient.ExchangeApi.SubscribeToOrderUpdatesAsync(data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-order-gateio" role="tabpanel" aria-labelledby="example-stream-order-gateio-tab">
|
|
<pre><code>await gateioSocketClient.SpotApi.SubscribeToOrderUpdatesAsync(data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-order-htx" role="tabpanel" aria-labelledby="example-stream-order-htx-tab">
|
|
<pre><code>await htxSocketClient.SpotApi.SubscribeToOrderUpdatesAsync(onOrderMatched: data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-order-hyperliquid" role="tabpanel" aria-labelledby="example-stream-order-hyperliquid-tab">
|
|
<pre><code>await hyperLiquidSocketClient.SpotApi.SubscribeToOrderUpdatesAsync(null, data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-order-kraken" role="tabpanel" aria-labelledby="example-stream-order-kraken-tab">
|
|
<pre><code>// Retrieve the token
|
|
var token = await krakenClient.SpotApi.Account.GetWebsocketTokenAsync();
|
|
|
|
// Subscribe using the token
|
|
await krakenSocketClient.SpotApi.SubscribeToOrderUpdatesAsync(token.Data.Token, data => {
|
|
// Handle update
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-order-kucoin" role="tabpanel" aria-labelledby="example-stream-order-kucoin-tab">
|
|
<pre><code>await kucoinSocketClient.SpotApi.SubscribeToOrderUpdatesAsync(data => {
|
|
// Handle update
|
|
}, null, null);</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-order-mexc" role="tabpanel" aria-labelledby="example-stream-order-mexc-tab">
|
|
<pre><code>// Retrieve the listen key
|
|
var token = await mexcClient.SpotApi.Account.StartUserStreamAsync();
|
|
|
|
// Subscribe using the key
|
|
await mexcSocketClient.SpotApi.SubscribeToOrderUpdatesAsync(token.Data, data => {
|
|
// Handle update
|
|
});
|
|
|
|
// The listen key will stay valid for 60 minutes, after this the connection is closed and reconnecting with the same listen key will fail
|
|
// To extend the life time of the listen key it is recommended to call the KeepAliveUserStreamAsync method every 30 minutes
|
|
_ = Task.Run(async () => {
|
|
while (true)
|
|
{
|
|
await Task.Delay(Timespan.FromMinutes(30));
|
|
await mexcClient.SpotApi.Account.KeepAliveUserStreamAsync(token.Data);
|
|
}
|
|
});</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-order-okx" role="tabpanel" aria-labelledby="example-stream-order-okx-tab">
|
|
<pre><code>await okxSocketClient.UnifiedApi.Trading.SubscribeToOrderUpdatesAsync(OKXInstrumentType.Spot, null, null, data => {
|
|
// Handle update
|
|
});
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-order-whitebit" role="tabpanel" aria-labelledby="example-stream-order-whitebit-tab">
|
|
<pre><code>// It's required for the WhiteBit API to specify which symbols to subscribe to
|
|
await whitebitSocketClient.V4Api.SubscribeToOpenOrderUpdatesAsync(["ETH_USDT", "BTC_USDT"], data => {
|
|
// Handle update
|
|
});
|
|
</code></pre>
|
|
</div>
|
|
<div class="tab-pane fade" id="example-stream-order-xt" role="tabpanel" aria-labelledby="example-stream-order-xt-tab">
|
|
<pre><code>// Retrieve the token
|
|
var listenKey = await xtRestClient.SpotApi.Account.GetWebsocketTokenAsync();
|
|
|
|
// Subscribe using the key
|
|
await xtSocketClient.SpotApi.SubscribeToBalanceUpdatesAsync(listenKey.Data, data => {
|
|
// Handle update
|
|
});
|
|
|
|
// The listen key will stay valid for 48 hours, after this no updates will be send anymore
|
|
// To extend the life time of the token it is recommended to call the GetWebsocketTokenAsync method at a set interval which will extend the lifetime
|
|
_ = Task.Run(async () => {
|
|
while (true)
|
|
{
|
|
await Task.Delay(Timespan.FromHours(4));
|
|
await xtRestClient.SpotApi.Account.GetWebsocketTokenAsync();
|
|
}
|
|
});
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</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. 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">
|
|
<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]/[BaseAsset]/[QuoteAsset]</code> for example <code>/Ticker/Kraken/ETH/BTC</code><br />
|
|
|
|
</p>
|
|
<pre><code class="language-csharp">using CryptoExchange.Net.Interfaces;
|
|
using CryptoClients.Net.Enums;
|
|
using CryptoClients.Net.Interfaces;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
builder.Services.AddCryptoClients();
|
|
var app = builder.Build();
|
|
|
|
app.MapGet("Ticker/{exchange}/{baseAsset}/{quoteAsset}", async ([FromServices] IExchangeRestClient client, Exchange exchange, string baseAsset, string quoteAsset) =>
|
|
{
|
|
var spotClient = client.GetSpotTickerClient(exchange)!;
|
|
var result = await spotClient.GetSpotTickerAsync(new GetTickerRequest(new SharedSymbol(TradingMode.Spot, baseAsset, quoteAsset)));
|
|
return result.Data;
|
|
});
|
|
|
|
app.Run();
|
|
</pre></code>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
<hr class="divider">
|
|
|
|
<!-- Sidebar
|
|
============================ -->
|
|
<section id="idocs_glossary">
|
|
<h2>Glossary</h2>
|
|
|
|
<table class="table table-bordered">
|
|
<tr><th>Definition</th><th>Synonyms</th><th>Meaning</th></tr>
|
|
<tr>
|
|
<td>Symbol</td>
|
|
<td>Market, Pair</td>
|
|
<td>An asset pair on which can be traded, for example <code>BTC-ETH</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Asset</td>
|
|
<td>Currency, Coin</td>
|
|
<td>A coin for which you can hold balance and which makes up Symbols. For example both <code>BTC</code>, <code>ETH</code> or <code>USD</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Trade</td>
|
|
<td>Execution, Fill</td>
|
|
<td>The (partial) execution of an order. Orders can have multiple trades</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Quantity</td>
|
|
<td>Amount, Size</td>
|
|
<td>The amount of asset</td>
|
|
</tr>
|
|
<tr>
|
|
<td>QuoteQuantity</td>
|
|
<td>Value</td>
|
|
<td>The amount of quote asset</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Fee</td>
|
|
<td>Commission</td>
|
|
<td>The fee paid for an order, trade or withdrawal</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Kline</td>
|
|
<td>Candlestick, OHLC</td>
|
|
<td>K-line data, used for candlestick charts. Contains Open/High/Low/Close/Volume</td>
|
|
</tr>
|
|
<tr>
|
|
<td>KlineInterval</td>
|
|
<td>Period</td>
|
|
<td>The time period of a single kline</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Open order</td>
|
|
<td>Active order, Unexecuted order</td>
|
|
<td>An order which has not yet been fully filled</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Closed order</td>
|
|
<td>Completed order, executed order</td>
|
|
<td>An order which is no longer active. Can be canceled or fully filled</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Network</td>
|
|
<td>Chain</td>
|
|
<td>The network of an asset. For example <code>ETH</code> allows multiple networks like <code>ERC20</code> and <code>BEP2</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Orderbook</td>
|
|
<td>Market depth</td>
|
|
<td>A list of (the top rows of) the current best bids and asks</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Ticker</td>
|
|
<td>Stats</td>
|
|
<td>Statistics over the last 24 hours</td>
|
|
</tr>
|
|
</table>
|
|
</section>
|
|
|
|
<hr class="divider">
|
|
|
|
<!-- FAQ
|
|
============================ -->
|
|
<section id="idocs_faq">
|
|
<h2>FAQ</h2>
|
|
<b>I occasionally get a NullReferenceException, what's wrong?</b><br />
|
|
<p>
|
|
You probably don't check the result status of a call and just assume the data is always there. <code>NullReferenceExecption</code> will happen when you have code like this <code>var symbol = client.GetTickersAync().Result.Data.Symbol</code> because the <code>Data</code> property is null when the call fails. Instead check if the call is successful:
|
|
<pre><code>var tickerResult = await client.SpotApi.ExchangeData.GetTickersAync();
|
|
if(!tickerResult.Success)
|
|
{
|
|
// Handle error
|
|
}
|
|
else
|
|
{
|
|
// Handle result, it is now safe to access the Data property
|
|
var symbol = tickerResult.Data.Symbol;
|
|
}</code></pre>
|
|
</p>
|
|
|
|
<b>The socket client stops sending updates after a little while</b><br />
|
|
<p>
|
|
You probably didn't keep a reference to the socket client and it got disposed.
|
|
<pre><code>// WRONG
|
|
private void SomeMethod()
|
|
{
|
|
var socketClient = new BinanceSocketClient();
|
|
socketClient.Spot.SubscribeToOrderBookUpdatesAsync("BTCUSDT", data => {
|
|
// Handle data
|
|
});
|
|
}</code></pre>
|
|
<pre><code>// RIGHT
|
|
private BinanceSocketClient _socketClient = new BinanceSocketClient();
|
|
|
|
// .. rest of the class
|
|
|
|
private void SomeMethod()
|
|
{
|
|
_socketClient.Spot.SubscribeToOrderBookUpdates("BTCUSDT", data => {
|
|
// Handle data
|
|
});
|
|
}</code></pre>
|
|
</p>
|
|
|
|
<b>Can I use the TestNet/US/other API with this library?</b><br />
|
|
<p>
|
|
Yes, generally these are all supported and can be configured by setting the Environment in the client options. Some known environments should be available in the [Exchange]Environment class:
|
|
<pre><code>// Change environment to test
|
|
var client = new BinanceRestClient(options =>
|
|
{
|
|
options.Environment = BinanceEnvironment.Testnet;
|
|
});</code></pre>
|
|
</p>
|
|
|
|
<b>How are timestamps handled?</b><br />
|
|
<p>
|
|
Exchange API's treat all timestamps as UTC, both incoming and outgoing. The client libraries do no conversion so received timestamps are always in UTC. When sending requests make sure to use UTC time as well.
|
|
</p>
|
|
|
|
</section>
|
|
|
|
<hr class="divider">
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<!-- Content end -->
|
|
|
|
</div>
|
|
<!-- Document Wrapper end -->
|
|
|
|
<!-- Back To Top -->
|
|
<a id="back-to-top" data-toggle="tooltip" title="Back to Top" href="javascript:void(0)"><i class="fa fa-chevron-up"></i></a>
|
|
|
|
<!-- JavaScript
|
|
============================ -->
|
|
<script src="assets/vendor/jquery/jquery.min.js"></script>
|
|
<script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
|
|
<!-- Highlight JS -->
|
|
<!--<script src="assets/vendor/highlight.js/highlight.min.js"></script>-->
|
|
<!-- and it's easy to individually load additional languages -->
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/csharp.min.js"></script>
|
|
<!-- Easing -->
|
|
<script src="assets/vendor/jquery.easing/jquery.easing.min.js"></script>
|
|
<!-- Magnific Popup -->
|
|
<script src="assets/vendor/magnific-popup/jquery.magnific-popup.min.js"></script>
|
|
<!-- Custom Script -->
|
|
<script src="assets/js/theme.js"></script>
|
|
<script>hljs.highlightAll();</script>
|
|
</body>
|
|
</html>
|