mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-08-12 17:03:10 +00:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dec94678ec | |||
| 1a49fc8251 | |||
| 29b0875960 | |||
| 976ccab1da | |||
| 02bbd37bb6 | |||
| 1bbbec7f2b | |||
| 0262f04913 | |||
| fd1ec17d72 | |||
| 4bdad7fe0c | |||
| 74f73dc790 | |||
| 0527a8a76e | |||
| c693eb8c02 | |||
| 3eb28c7fed | |||
| 618c4922b9 | |||
| c81b15861d | |||
| 4a5832cccd | |||
| 4e47c4cbdf | |||
| 2af1520ecc | |||
| cf397af3ab | |||
| a1479705e2 |
@@ -443,6 +443,16 @@ namespace CryptoExchange.Net.Authentication
|
||||
return DateTimeConverter.ConvertToMilliseconds(GetTimestamp(apiClient)).Value.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get millisecond timestamp as a long including the time sync offset from the api client
|
||||
/// </summary>
|
||||
/// <param name="apiClient"></param>
|
||||
/// <returns></returns>
|
||||
protected long GetMillisecondTimestampLong(RestApiClient apiClient)
|
||||
{
|
||||
return DateTimeConverter.ConvertToMilliseconds(GetTimestamp(apiClient)).Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the serialized request body
|
||||
/// </summary>
|
||||
|
||||
@@ -38,9 +38,7 @@ namespace CryptoExchange.Net.Clients
|
||||
/// </summary>
|
||||
public bool OutputOriginalData { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not API credentials have been configured for this client. Does not check the credentials are actually valid.
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public bool Authenticated => ApiOptions.ApiCredentials != null || ClientOptions.ApiCredentials != null;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -87,8 +87,12 @@ namespace CryptoExchange.Net.Converters.SystemTextJson
|
||||
|
||||
if (prop.JsonConverterType == null && IsSimple(prop.PropertyInfo.PropertyType))
|
||||
{
|
||||
if (prop.PropertyInfo.PropertyType == typeof(string))
|
||||
if (prop.TargetType == typeof(string))
|
||||
writer.WriteStringValue(Convert.ToString(objValue, CultureInfo.InvariantCulture));
|
||||
else if(prop.TargetType.IsEnum)
|
||||
writer.WriteStringValue(EnumConverter.GetString(objValue));
|
||||
else if (prop.TargetType == typeof(bool))
|
||||
writer.WriteBooleanValue((bool)objValue);
|
||||
else
|
||||
writer.WriteRawValue(Convert.ToString(objValue, CultureInfo.InvariantCulture)!);
|
||||
}
|
||||
@@ -187,12 +191,12 @@ namespace CryptoExchange.Net.Converters.SystemTextJson
|
||||
_converterOptionsCache.TryAdd(attribute.JsonConverterType, newOptions);
|
||||
}
|
||||
|
||||
value = JsonDocument.ParseValue(ref reader).Deserialize(targetType, newOptions);
|
||||
value = JsonDocument.ParseValue(ref reader).Deserialize(attribute.PropertyInfo.PropertyType, newOptions);
|
||||
}
|
||||
else if (attribute.DefaultDeserialization)
|
||||
{
|
||||
// Use default deserialization
|
||||
value = JsonDocument.ParseValue(ref reader).Deserialize(targetType, options);
|
||||
value = JsonDocument.ParseValue(ref reader).Deserialize(attribute.PropertyInfo.PropertyType, SerializerOptions.WithConverters);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace CryptoExchange.Net.Converters.SystemTextJson
|
||||
if (reader.TokenType is JsonTokenType.Number)
|
||||
{
|
||||
var longValue = reader.GetDouble();
|
||||
if (longValue == 0 || longValue == -1)
|
||||
if (longValue == 0 || longValue < 0)
|
||||
return default;
|
||||
|
||||
return ParseFromDouble(longValue);
|
||||
|
||||
@@ -172,6 +172,13 @@ namespace CryptoExchange.Net.Converters.SystemTextJson
|
||||
return true;
|
||||
}
|
||||
|
||||
if (objectType.IsDefined(typeof(FlagsAttribute)))
|
||||
{
|
||||
var intValue = int.Parse(value);
|
||||
result = Enum.ToObject(objectType, intValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// If no explicit mapping is found try to parse string
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
<PackageId>CryptoExchange.Net</PackageId>
|
||||
<Authors>JKorf</Authors>
|
||||
<Description>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.</Description>
|
||||
<PackageVersion>8.6.1</PackageVersion>
|
||||
<AssemblyVersion>8.6.1</AssemblyVersion>
|
||||
<FileVersion>8.6.1</FileVersion>
|
||||
<PackageVersion>8.7.4</PackageVersion>
|
||||
<AssemblyVersion>8.7.4</AssemblyVersion>
|
||||
<FileVersion>8.7.4</FileVersion>
|
||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||
<PackageTags>OKX;OKX.Net;Mexc;Mexc.Net;Kucoin;Kucoin.Net;Kraken;Kraken.Net;Huobi;Huobi.Net;CoinEx;CoinEx.Net;Bybit;Bybit.Net;Bitget;Bitget.Net;Bitfinex;Bitfinex.Net;Binance;Binance.Net;CryptoCurrency;CryptoCurrency Exchange</PackageTags>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
|
||||
@@ -261,6 +261,7 @@ namespace CryptoExchange.Net
|
||||
if (price != null)
|
||||
{
|
||||
adjustedPrice = AdjustValueStep(0, decimal.MaxValue, symbol.PriceStep, RoundingType.Down, price.Value);
|
||||
adjustedPrice = symbol.PriceSignificantFigures.HasValue ? RoundToSignificantDigits(adjustedPrice.Value, symbol.PriceSignificantFigures.Value, RoundingType.Closest) : adjustedPrice;
|
||||
adjustedPrice = symbol.PriceDecimals.HasValue ? RoundDown(price.Value, symbol.PriceDecimals.Value) : adjustedPrice;
|
||||
if (adjustedPrice != 0 && adjustedPrice * quantity < symbol.MinNotionalValue)
|
||||
{
|
||||
|
||||
@@ -16,6 +16,11 @@ namespace CryptoExchange.Net.Interfaces
|
||||
/// </summary>
|
||||
string BaseAddress { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not API credentials have been configured for this client. Does not check the credentials are actually valid.
|
||||
/// </summary>
|
||||
bool Authenticated { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Format a base and quote asset to an exchange accepted symbol
|
||||
/// </summary>
|
||||
@@ -36,7 +41,7 @@ namespace CryptoExchange.Net.Interfaces
|
||||
/// <summary>
|
||||
/// Set new options. Note that when using a proxy this should be provided in the options even when already set before or it will be reset.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Api crentials type</typeparam>
|
||||
/// <typeparam name="T">Api credentials type</typeparam>
|
||||
/// <param name="options">Options to set</param>
|
||||
void SetOptions<T>(UpdateOptions<T> options) where T : ApiCredentials;
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace CryptoExchange.Net.Logging.Extensions
|
||||
_sendingData = LoggerMessage.Define<int, int, string>(
|
||||
LogLevel.Trace,
|
||||
new EventId(2028, "SendingData"),
|
||||
"[Sckt {SocketId}] [Req {RequestId}] sending messsage: {Data}");
|
||||
"[Sckt {SocketId}] [Req {RequestId}] sending message: {Data}");
|
||||
|
||||
_receivedMessageNotMatchedToAnyListener = LoggerMessage.Define<int, string, string>(
|
||||
LogLevel.Warning,
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace CryptoExchange.Net.Requests
|
||||
handler.DefaultProxyCredentials = CredentialCache.DefaultCredentials;
|
||||
}
|
||||
catch (PlatformNotSupportedException) { }
|
||||
catch (NotImplementedException) { } // Mono runtime throws NotImplementedException
|
||||
|
||||
if (proxy != null)
|
||||
{
|
||||
|
||||
@@ -46,6 +46,10 @@
|
||||
/// </summary>
|
||||
public int? PriceDecimals { get; set; }
|
||||
/// <summary>
|
||||
/// The max amount of significant figures to use for price. For example with value of 5 these values are valid: 0.00001, 0.12300, 123.53, 12345, but this is not: 12345.1
|
||||
/// </summary>
|
||||
public int? PriceSignificantFigures { get; set; }
|
||||
/// <summary>
|
||||
/// Whether the symbol is currently available for trading
|
||||
/// </summary>
|
||||
public bool Trading { get; set; }
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
using CryptoExchange.Net.Objects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// A symbol representation based on a base and quote asset
|
||||
/// </summary>
|
||||
public class SharedSymbol
|
||||
public record SharedSymbol
|
||||
{
|
||||
/// <summary>
|
||||
/// The base asset of the symbol
|
||||
|
||||
@@ -604,7 +604,7 @@ namespace CryptoExchange.Net.Sockets
|
||||
}
|
||||
catch (Exception wse)
|
||||
{
|
||||
if (!_ctsSource.Token.IsCancellationRequested)
|
||||
if (!_ctsSource.Token.IsCancellationRequested && !_stopRequested)
|
||||
// Connection closed unexpectedly
|
||||
await (OnError?.Invoke(wse) ?? Task.CompletedTask).ConfigureAwait(false);
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace CryptoExchange.Net.Testing.Comparers
|
||||
int i = 0;
|
||||
foreach (var item in jObj.Children())
|
||||
{
|
||||
var arrayProp = resultProps.Where(p => p.Item2 != null).SingleOrDefault(p => p.Item2!.Index == i).p;
|
||||
var arrayProp = resultProps.Where(p => p.Item2 != null).FirstOrDefault(p => p.Item2!.Index == i).p;
|
||||
if (arrayProp != null)
|
||||
CheckPropertyValue(method, item, arrayProp.GetValue(resultObj), arrayProp.PropertyType, arrayProp.Name, "Array index " + i, ignoreProperties!);
|
||||
i++;
|
||||
@@ -264,9 +264,9 @@ namespace CryptoExchange.Net.Testing.Comparers
|
||||
int i = 0;
|
||||
foreach (var item in jtoken.Children())
|
||||
{
|
||||
var arrayProp = resultProps.Where(p => p.Item2 != null).SingleOrDefault(p => p.Item2!.Index == i).p;
|
||||
var arrayProp = resultProps.Where(p => p.Item2 != null).FirstOrDefault(p => p.Item2!.Index == i).p;
|
||||
if (arrayProp != null)
|
||||
CheckPropertyValue(method, item, arrayProp.GetValue(resultObj), propertyType, arrayProp.Name, "Array index " + i, ignoreProperties);
|
||||
CheckPropertyValue(method, item, arrayProp.GetValue(resultObj), arrayProp.PropertyType, arrayProp.Name, "Array index " + i, ignoreProperties);
|
||||
|
||||
i++;
|
||||
}
|
||||
@@ -350,7 +350,7 @@ namespace CryptoExchange.Net.Testing.Comparers
|
||||
int i = 0;
|
||||
foreach (var item in jObjs.Children())
|
||||
{
|
||||
var arrayProp = resultProps.Where(p => p.Item2 != null).SingleOrDefault(p => p.Item2!.Index == i).p;
|
||||
var arrayProp = resultProps.Where(p => p.Item2 != null).FirstOrDefault(p => p.Item2!.Index == i).p;
|
||||
if (arrayProp != null)
|
||||
CheckPropertyValue(method, item, arrayProp.GetValue(propertyValue), arrayProp.PropertyType, arrayProp.Name, "Array index " + i, ignoreProperties!);
|
||||
i++;
|
||||
|
||||
@@ -150,9 +150,9 @@ namespace CryptoExchange.Net.Testing
|
||||
/// </summary>
|
||||
/// <typeparam name="TClient"></typeparam>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public static void CheckForMissingRestInterfaces<TClient>()
|
||||
public static void CheckForMissingRestInterfaces<TClient>(string[]? excludeInterfaces = null)
|
||||
{
|
||||
CheckForMissingInterfaces(typeof(TClient), typeof(Task));
|
||||
CheckForMissingInterfaces(typeof(TClient), typeof(Task), excludeInterfaces);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -160,26 +160,32 @@ namespace CryptoExchange.Net.Testing
|
||||
/// </summary>
|
||||
/// <typeparam name="TClient"></typeparam>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public static void CheckForMissingSocketInterfaces<TClient>()
|
||||
public static void CheckForMissingSocketInterfaces<TClient>(string[]? excludeInterfaces = null)
|
||||
{
|
||||
CheckForMissingInterfaces(typeof(TClient), typeof(Task<CallResult<UpdateSubscription>>));
|
||||
CheckForMissingInterfaces(typeof(TClient), typeof(Task<CallResult<UpdateSubscription>>), excludeInterfaces);
|
||||
}
|
||||
|
||||
private static void CheckForMissingInterfaces(Type clientType, Type implementationTypes)
|
||||
private static void CheckForMissingInterfaces(Type clientType, Type implementationTypes, string[]? excludeInterfaces = null)
|
||||
{
|
||||
var assembly = Assembly.GetAssembly(clientType);
|
||||
var interfaceType = clientType.GetInterface("I" + clientType.Name);
|
||||
var clientInterfaces = assembly!.GetTypes().Where(t => t.Name.StartsWith("I" + clientType.Name) && !t.Name.EndsWith("Shared"));
|
||||
var clientInterfaces = assembly!.GetTypes()
|
||||
.Where(t => t.Name.StartsWith("I" + clientType.Name)
|
||||
&& !t.Name.EndsWith("Shared")
|
||||
&& (excludeInterfaces?.Contains(t.Name) != true));
|
||||
|
||||
foreach (var clientInterface in clientInterfaces)
|
||||
{
|
||||
var implementations = assembly.GetTypes().Where(t => clientInterface.IsAssignableFrom(t) && t != clientInterface);
|
||||
var implementations = assembly.GetTypes().Where(t => clientInterface.IsAssignableFrom(t) && !t.IsInterface && t != clientInterface);
|
||||
foreach (var implementation in implementations)
|
||||
{
|
||||
int methods = 0;
|
||||
foreach (var method in implementation.GetMethods().Where(m => implementationTypes.IsAssignableFrom(m.ReturnType)))
|
||||
{
|
||||
var interfaceMethod = clientInterface.GetMethod(method.Name, method.GetParameters().Select(p => p.ParameterType).ToArray()) ?? throw new Exception($"Missing interface for method {method.Name} in {implementation.Name} implementing interface {clientInterface.Name}");
|
||||
var interfaceMethod =
|
||||
clientInterface.GetMethod(method.Name, method.GetParameters().Select(p => p.ParameterType).ToArray())
|
||||
?? clientInterface.GetInterfaces().Select(x => x.GetMethod(method.Name, method.GetParameters().Select(p => p.ParameterType).ToArray())).FirstOrDefault()
|
||||
?? throw new Exception($"Missing interface for method {method.Name} in {implementation.Name} implementing interface {clientInterface.Name}");
|
||||
methods++;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,23 +5,25 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Binance.Net" Version="10.9.0" />
|
||||
<PackageReference Include="Bitfinex.Net" Version="7.10.0" />
|
||||
<PackageReference Include="BitMart.Net" Version="1.7.0" />
|
||||
<PackageReference Include="Bybit.Net" Version="3.16.0" />
|
||||
<PackageReference Include="CoinEx.Net" Version="7.9.0" />
|
||||
<PackageReference Include="CryptoCom.Net" Version="1.2.0" />
|
||||
<PackageReference Include="GateIo.Net" Version="1.12.0" />
|
||||
<PackageReference Include="JK.BingX.Net" Version="1.14.0" />
|
||||
<PackageReference Include="JK.Bitget.Net" Version="1.13.0" />
|
||||
<PackageReference Include="JK.Mexc.Net" Version="1.11.0" />
|
||||
<PackageReference Include="JK.OKX.Net" Version="2.8.0" />
|
||||
<PackageReference Include="JKorf.Coinbase.Net" Version="1.4.0" />
|
||||
<PackageReference Include="JKorf.HTX.Net" Version="6.4.0" />
|
||||
<PackageReference Include="KrakenExchange.Net" Version="5.2.0" />
|
||||
<PackageReference Include="Kucoin.Net" Version="5.18.0" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
|
||||
<PackageReference Include="WhiteBit.Net" Version="1.0.0" />
|
||||
<PackageReference Include="Binance.Net" Version="10.16.2" />
|
||||
<PackageReference Include="Bitfinex.Net" Version="8.0.2" />
|
||||
<PackageReference Include="BitMart.Net" Version="1.12.2" />
|
||||
<PackageReference Include="Bybit.Net" Version="4.0.2" />
|
||||
<PackageReference Include="CoinEx.Net" Version="7.14.0" />
|
||||
<PackageReference Include="CryptoCom.Net" Version="1.5.1" />
|
||||
<PackageReference Include="GateIo.Net" Version="1.18.0" />
|
||||
<PackageReference Include="HyperLiquid.Net" Version="1.0.1" />
|
||||
<PackageReference Include="JK.BingX.Net" Version="1.20.1" />
|
||||
<PackageReference Include="JK.Bitget.Net" Version="1.20.0" />
|
||||
<PackageReference Include="JK.Mexc.Net" Version="2.0.0" />
|
||||
<PackageReference Include="JK.OKX.Net" Version="2.14.2" />
|
||||
<PackageReference Include="JKorf.BitMEX.Net" Version="1.0.0" />
|
||||
<PackageReference Include="JKorf.Coinbase.Net" Version="1.7.2" />
|
||||
<PackageReference Include="JKorf.HTX.Net" Version="6.8.2" />
|
||||
<PackageReference Include="KrakenExchange.Net" Version="5.6.0" />
|
||||
<PackageReference Include="Kucoin.Net" Version="5.23.5" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
|
||||
<PackageReference Include="WhiteBit.Net" Version="1.3.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -2,14 +2,16 @@
|
||||
@inject IBinanceRestClient binanceClient
|
||||
@inject IBingXRestClient bingXClient
|
||||
@inject IBitfinexRestClient bitfinexClient
|
||||
@inject IBitMartRestClient bitmartClient
|
||||
@inject IBitgetRestClient bitgetClient
|
||||
@inject IBitMartRestClient bitmartClient
|
||||
@inject IBitMEXRestClient bitmexClient
|
||||
@inject IBybitRestClient bybitClient
|
||||
@inject ICoinbaseRestClient coinbaseClient
|
||||
@inject ICoinExRestClient coinexClient
|
||||
@inject ICryptoComRestClient cryptocomClient
|
||||
@inject IGateIoRestClient gateioClient
|
||||
@inject IHTXRestClient huobiClient
|
||||
@inject IHTXRestClient htxClient
|
||||
@inject IHyperLiquidRestClient hyperLiquidClient
|
||||
@inject IKrakenRestClient krakenClient
|
||||
@inject IKucoinRestClient kucoinClient
|
||||
@inject IMexcRestClient mexcClient
|
||||
@@ -32,12 +34,14 @@
|
||||
var bitfinexTask = bitfinexClient.SpotApi.ExchangeData.GetTickerAsync("tBTCUSD");
|
||||
var bitgetTask = bitgetClient.SpotApi.ExchangeData.GetTickerAsync("BTCUSDT_SPBL");
|
||||
var bitmartTask = bitmartClient.SpotApi.ExchangeData.GetTickerAsync("BTC_USDT");
|
||||
var bitmexTask = bitmexClient.ExchangeApi.ExchangeData.GetSymbolsAsync("XBT_USDT");
|
||||
var bybitTask = bybitClient.V5Api.ExchangeData.GetSpotTickersAsync("BTCUSDT");
|
||||
var coinbaseTask = coinbaseClient.AdvancedTradeApi.ExchangeData.GetSymbolAsync("BTC-USDT");
|
||||
var coinexTask = coinexClient.SpotApi.ExchangeData.GetTickerAsync("BTCUSDT");
|
||||
var cryptocomTask = cryptocomClient.ExchangeApi.ExchangeData.GetTickersAsync("BTC_USDT");
|
||||
var gateioTask = gateioClient.SpotApi.ExchangeData.GetTickersAsync("BTC_USDT");
|
||||
var htxTask = huobiClient.SpotApi.ExchangeData.GetTickerAsync("btcusdt");
|
||||
var htxTask = htxClient.SpotApi.ExchangeData.GetTickerAsync("btcusdt");
|
||||
var hyperLiquidTask = hyperLiquidClient.FuturesApi.ExchangeData.GetExchangeInfoAndTickersAsync(); // HyperLiquid does not have BTC spot trading
|
||||
var krakenTask = krakenClient.SpotApi.ExchangeData.GetTickerAsync("XBTUSD");
|
||||
var kucoinTask = kucoinClient.SpotApi.ExchangeData.GetTickerAsync("BTC-USDT");
|
||||
var mexcTask = mexcClient.SpotApi.ExchangeData.GetTickerAsync("BTCUSDT");
|
||||
@@ -61,6 +65,9 @@
|
||||
if (bitmartTask.Result.Success)
|
||||
_prices.Add("BitMart", bitgetTask.Result.Data.ClosePrice);
|
||||
|
||||
if (bitmexTask.Result.Success)
|
||||
_prices.Add("BitMEX", bitmexTask.Result.Data.First().LastPrice);
|
||||
|
||||
if (bybitTask.Result.Success)
|
||||
_prices.Add("Bybit", bybitTask.Result.Data.List.First().LastPrice);
|
||||
|
||||
@@ -79,6 +86,13 @@
|
||||
if (htxTask.Result.Success)
|
||||
_prices.Add("HTX", htxTask.Result.Data.ClosePrice ?? 0);
|
||||
|
||||
if (hyperLiquidTask.Result.Success)
|
||||
{
|
||||
// HyperLiquid API doesn't offer an endpoint to filter for a specific ticker, so we have to filter client side
|
||||
var tickers = hyperLiquidTask.Result.Data.Tickers;
|
||||
_prices.Add("HyperLiquid", tickers.Single(x => x.Symbol == "BTC").MidPrice ?? 9);
|
||||
}
|
||||
|
||||
if (krakenTask.Result.Success)
|
||||
_prices.Add("Kraken", krakenTask.Result.Data.First().Value.LastTrade.Price);
|
||||
|
||||
|
||||
@@ -4,12 +4,14 @@
|
||||
@inject IBitfinexSocketClient bitfinexSocketClient
|
||||
@inject IBitgetSocketClient bitgetSocketClient
|
||||
@inject IBitMartSocketClient bitmartSocketClient
|
||||
@inject IBitMEXSocketClient bitmexSocketClient
|
||||
@inject IBybitSocketClient bybitSocketClient
|
||||
@inject ICoinbaseSocketClient coinbaseSocketClient
|
||||
@inject ICoinExSocketClient coinExSocketClient
|
||||
@inject ICryptoComSocketClient cryptocomSocketClient
|
||||
@inject IGateIoSocketClient gateioSocketClient
|
||||
@inject IHTXSocketClient htxSocketClient
|
||||
@inject IHyperLiquidSocketClient hyperLiquidSocketClient
|
||||
@inject IKrakenSocketClient krakenSocketClient
|
||||
@inject IKucoinSocketClient kucoinSocketClient
|
||||
@inject IMexcSocketClient mexcSocketClient
|
||||
@@ -40,13 +42,16 @@
|
||||
bitfinexSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("tETHBTC", data => UpdateData("Bitfinex", data.Data.LastPrice)),
|
||||
bitgetSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETHBTC", data => UpdateData("Bitget", data.Data.LastPrice)),
|
||||
bitmartSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETH_BTC", data => UpdateData("BitMart", data.Data.LastPrice)),
|
||||
bitmexSocketClient.ExchangeApi.SubscribeToSymbolUpdatesAsync("ETH_XBT", data => UpdateData("BitMEX", data.Data.LastPrice ?? 0)),
|
||||
bybitSocketClient.V5SpotApi.SubscribeToTickerUpdatesAsync("ETHBTC", data => UpdateData("Bybit", data.Data.LastPrice)),
|
||||
coinExSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETHBTC", data => UpdateData("CoinEx", data.Data.LastPrice)),
|
||||
coinbaseSocketClient.AdvancedTradeApi.SubscribeToTickerUpdatesAsync("ETH-BTC", data => UpdateData("Coinbase", data.Data.LastPrice)),
|
||||
coinExSocketClient.SpotApiV2.SubscribeToTickerUpdatesAsync(["ETHBTC"], data => UpdateData("CoinEx", data.Data.First().LastPrice)),
|
||||
coinbaseSocketClient.AdvancedTradeApi.SubscribeToTickerUpdatesAsync("ETH-BTC", data => UpdateData("Coinbase", data.Data.LastPrice ?? 0)),
|
||||
cryptocomSocketClient.ExchangeApi.SubscribeToTickerUpdatesAsync("ETH_BTC", data => UpdateData("CryptoCom", data.Data.LastPrice ?? 0)),
|
||||
gateioSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETH_BTC", data => UpdateData("GateIo", data.Data.LastPrice)),
|
||||
htxSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ethbtc", data => UpdateData("HTX", data.Data.ClosePrice ?? 0)),
|
||||
krakenSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETH/XBT", data => UpdateData("Kraken", data.Data.LastPrice)),
|
||||
// HyperLiquid doesn't support the ETH/BTC pair
|
||||
//hyperLiquidSocketClient.SpotApi.SubscribeToSymbolUpdatesAsync("ETH", data => UpdateData("HyperLiquid", data.Data.MidPrice ?? 0)),
|
||||
krakenSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETH/BTC", data => UpdateData("Kraken", data.Data.LastPrice)),
|
||||
kucoinSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETH-BTC", data => UpdateData("Kucoin", data.Data.LastPrice ?? 0)),
|
||||
mexcSocketClient.SpotApi.SubscribeToMiniTickerUpdatesAsync("ETHBTC", data => UpdateData("Mexc", data.Data.LastPrice)),
|
||||
okxSocketClient.UnifiedApi.ExchangeData.SubscribeToTickerUpdatesAsync("ETH-BTC", data => UpdateData("OKX", data.Data.LastPrice ?? 0)),
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
@using Bitfinex.Net.Interfaces
|
||||
@using Bitget.Net.Interfaces;
|
||||
@using BitMart.Net.Interfaces;
|
||||
@using BitMEX.Net.Interfaces;
|
||||
@using Bybit.Net.Interfaces
|
||||
@using CoinEx.Net.Interfaces
|
||||
@using Coinbase.Net.Interfaces
|
||||
@@ -13,6 +14,7 @@
|
||||
@using CryptoCom.Net.Interfaces
|
||||
@using GateIo.Net.Interfaces
|
||||
@using HTX.Net.Interfaces
|
||||
@using HyperLiquid.Net.Interfaces
|
||||
@using Kraken.Net.Interfaces
|
||||
@using Kucoin.Net.Clients
|
||||
@using Kucoin.Net.Interfaces
|
||||
@@ -24,12 +26,14 @@
|
||||
@inject IBitfinexOrderBookFactory bitfinexFactory
|
||||
@inject IBitgetOrderBookFactory bitgetFactory
|
||||
@inject IBitMartOrderBookFactory bitmartFactory
|
||||
@inject IBitMEXOrderBookFactory bitmexFactory
|
||||
@inject IBybitOrderBookFactory bybitFactory
|
||||
@inject ICoinbaseOrderBookFactory coinbaseFactory
|
||||
@inject ICoinExOrderBookFactory coinExFactory
|
||||
@inject ICryptoComOrderBookFactory cryptocomFactory
|
||||
@inject IGateIoOrderBookFactory gateioFactory
|
||||
@inject IHTXOrderBookFactory htxFactory
|
||||
@inject IHyperLiquidOrderBookFactory hyperLiquidFactory
|
||||
@inject IKrakenOrderBookFactory krakenFactory
|
||||
@inject IKucoinOrderBookFactory kucoinFactory
|
||||
@inject IMexcOrderBookFactory mexcFactory
|
||||
@@ -73,12 +77,15 @@
|
||||
{ "Bitfinex", bitfinexFactory.Create("tETHBTC") },
|
||||
{ "Bitget", bitgetFactory.CreateSpot("ETHBTC") },
|
||||
{ "BitMart", bitmartFactory.CreateSpot("ETH_BTC", null) },
|
||||
{ "BitMEX", bitmexFactory.Create("ETH_XBT") },
|
||||
{ "Bybit", bybitFactory.Create("ETHBTC", Bybit.Net.Enums.Category.Spot) },
|
||||
{ "Coinbase", coinbaseFactory.Create("ETH-BTC", null) },
|
||||
{ "CoinEx", coinExFactory.CreateSpot("ETHBTC") },
|
||||
{ "CryptoCom", cryptocomFactory.Create("ETH_BTC") },
|
||||
{ "GateIo", gateioFactory.CreateSpot("ETH_BTC") },
|
||||
{ "HTX", htxFactory.CreateSpot("ethbtc") },
|
||||
// HyperLiquid does not support the ETH/BTC pair
|
||||
//{ "HyperLiquid", hyperLiquidFactory.Create("ETH/BTC") },
|
||||
{ "Kraken", krakenFactory.CreateSpot("ETH/BTC") },
|
||||
{ "Kucoin", kucoinFactory.CreateSpot("ETH-BTC") },
|
||||
{ "Mexc", mexcFactory.CreateSpot("ETHBTC") },
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
@using BingX.Net.Interfaces
|
||||
@using Bitfinex.Net.Interfaces
|
||||
@using Bitget.Net.Interfaces;
|
||||
@using BitMEX.Net.Interfaces;
|
||||
@using BitMart.Net.Interfaces;
|
||||
@using Bybit.Net.Interfaces
|
||||
@using CoinEx.Net.Interfaces
|
||||
@@ -15,6 +16,7 @@
|
||||
@using CryptoExchange.Net.Trackers.Trades
|
||||
@using GateIo.Net.Interfaces
|
||||
@using HTX.Net.Interfaces
|
||||
@using HyperLiquid.Net.Interfaces
|
||||
@using Kraken.Net.Interfaces
|
||||
@using Kucoin.Net.Clients
|
||||
@using Kucoin.Net.Interfaces
|
||||
@@ -26,12 +28,14 @@
|
||||
@inject IBitfinexTrackerFactory bitfinexFactory
|
||||
@inject IBitgetTrackerFactory bitgetFactory
|
||||
@inject IBitMartTrackerFactory bitmartFactory
|
||||
@inject IBitMEXTrackerFactory bitmexFactory
|
||||
@inject IBybitTrackerFactory bybitFactory
|
||||
@inject ICoinbaseTrackerFactory coinbaseFactory
|
||||
@inject ICoinExTrackerFactory coinExFactory
|
||||
@inject ICryptoComTrackerFactory cryptocomFactory
|
||||
@inject IGateIoTrackerFactory gateioFactory
|
||||
@inject IHTXTrackerFactory htxFactory
|
||||
@inject IHyperLiquidTrackerFactory hyperLiquidFactory
|
||||
@inject IKrakenTrackerFactory krakenFactory
|
||||
@inject IKucoinTrackerFactory kucoinFactory
|
||||
@inject IMexcTrackerFactory mexcFactory
|
||||
@@ -59,26 +63,29 @@
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var symbol = new SharedSymbol(TradingMode.Spot, "BTC", "USDT");
|
||||
var usdtSymbol = new SharedSymbol(TradingMode.Spot, "BTC", "USDT");
|
||||
|
||||
_trackers = new List<ITradeTracker>
|
||||
{
|
||||
{ binanceFactory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ bingXFactory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ bitfinexFactory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ bitgetFactory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ bitmartFactory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ bybitFactory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ coinbaseFactory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ coinExFactory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ cryptocomFactory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ gateioFactory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ htxFactory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ krakenFactory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ kucoinFactory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ mexcFactory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ okxFactory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ whitebitFactory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ binanceFactory.CreateTradeTracker(usdtSymbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ bingXFactory.CreateTradeTracker(usdtSymbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ bitfinexFactory.CreateTradeTracker(usdtSymbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ bitgetFactory.CreateTradeTracker(usdtSymbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ bitmartFactory.CreateTradeTracker(usdtSymbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ bitmexFactory.CreateTradeTracker(usdtSymbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ bybitFactory.CreateTradeTracker(usdtSymbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ coinbaseFactory.CreateTradeTracker(usdtSymbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ coinExFactory.CreateTradeTracker(usdtSymbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ cryptocomFactory.CreateTradeTracker(usdtSymbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ gateioFactory.CreateTradeTracker(usdtSymbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ htxFactory.CreateTradeTracker(usdtSymbol, period: TimeSpan.FromMinutes(5)) },
|
||||
// HyperLiquid doesn't support spot pair, but does have a futures BTC/USDC pair
|
||||
{ hyperLiquidFactory.CreateTradeTracker(new SharedSymbol(TradingMode.PerpetualLinear, "BTC", "USDC"), period: TimeSpan.FromMinutes(5)) },
|
||||
{ krakenFactory.CreateTradeTracker(usdtSymbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ kucoinFactory.CreateTradeTracker(usdtSymbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ mexcFactory.CreateTradeTracker(usdtSymbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ okxFactory.CreateTradeTracker(usdtSymbol, period: TimeSpan.FromMinutes(5)) },
|
||||
{ whitebitFactory.CreateTradeTracker(usdtSymbol, period: TimeSpan.FromMinutes(5)) },
|
||||
};
|
||||
|
||||
await Task.WhenAll(_trackers.Select(b => b.StartAsync()));
|
||||
|
||||
@@ -40,11 +40,13 @@ namespace BlazorClient
|
||||
services.AddBitfinex();
|
||||
services.AddBitget();
|
||||
services.AddBitMart();
|
||||
services.AddBitMEX();
|
||||
services.AddBybit();
|
||||
services.AddCoinbase();
|
||||
services.AddCoinEx();
|
||||
services.AddCryptoCom();
|
||||
services.AddGateIo();
|
||||
services.AddHyperLiquid();
|
||||
services.AddHTX();
|
||||
services.AddKraken();
|
||||
services.AddKucoin();
|
||||
|
||||
@@ -13,12 +13,14 @@
|
||||
@using Bitfinex.Net.Interfaces.Clients;
|
||||
@using Bitget.Net.Interfaces.Clients;
|
||||
@using BitMart.Net.Interfaces.Clients;
|
||||
@using BitMEX.Net.Interfaces.Clients;
|
||||
@using Bybit.Net.Interfaces.Clients;
|
||||
@using Coinbase.Net.Interfaces.Clients;
|
||||
@using CoinEx.Net.Interfaces.Clients;
|
||||
@using CryptoCom.Net.Interfaces.Clients;
|
||||
@using GateIo.Net.Interfaces.Clients;
|
||||
@using HTX.Net.Interfaces.Clients;
|
||||
@using HyperLiquid.Net.Interfaces.Clients;
|
||||
@using Kraken.Net.Interfaces.Clients;
|
||||
@using Kucoin.Net.Interfaces.Clients;
|
||||
@using Mexc.Net.Interfaces.Clients;
|
||||
|
||||
@@ -17,6 +17,7 @@ The following API's are directly supported. Note that there are 3rd party implem
|
||||
|Bitfinex|[JKorf/Bitfinex.Net](https://github.com/JKorf/Bitfinex.Net)|[](https://www.nuget.org/packages/Bitfinex.Net)|
|
||||
|Bitget|[JKorf/Bitget.Net](https://github.com/JKorf/Bitget.Net)|[](https://www.nuget.org/packages/JK.Bitget.Net)|
|
||||
|BitMart|[JKorf/BitMart.Net](https://github.com/JKorf/BitMart.Net)|[](https://www.nuget.org/packages/BitMart.Net)|
|
||||
|BitMEX|[JKorf/BitMEX.Net](https://github.com/JKorf/BitMEX.Net)|[](https://www.nuget.org/packages/JKorf.BitMEX.Net)|
|
||||
|Bybit|[JKorf/Bybit.Net](https://github.com/JKorf/Bybit.Net)|[](https://www.nuget.org/packages/Bybit.Net)|
|
||||
|Coinbase|[JKorf/Coinbase.Net](https://github.com/JKorf/Coinbase.Net)|[](https://www.nuget.org/packages/JKorf.Coinbase.Net)|
|
||||
|CoinEx|[JKorf/CoinEx.Net](https://github.com/JKorf/CoinEx.Net)|[](https://www.nuget.org/packages/CoinEx.Net)|
|
||||
@@ -24,6 +25,7 @@ The following API's are directly supported. Note that there are 3rd party implem
|
||||
|Crypto.com|[JKorf/CryptoCom.Net](https://github.com/JKorf/CryptoCom.Net)|[](https://www.nuget.org/packages/CryptoCom.Net)|
|
||||
|Gate.io|[JKorf/GateIo.Net](https://github.com/JKorf/GateIo.Net)|[](https://www.nuget.org/packages/GateIo.Net)|
|
||||
|HTX|[JKorf/HTX.Net](https://github.com/JKorf/HTX.Net)|[](https://www.nuget.org/packages/JKorf.HTX.Net)|
|
||||
|HyperLiquid|[JKorf/HyperLiquid.Net](https://github.com/JKorf/HyperLiquid.Net)|[](https://www.nuget.org/packages/HyperLiquid.Net)|
|
||||
|Kraken|[JKorf/Kraken.Net](https://github.com/JKorf/Kraken.Net)|[](https://www.nuget.org/packages/KrakenExchange.Net)|
|
||||
|Kucoin|[JKorf/Kucoin.Net](https://github.com/JKorf/Kucoin.Net)|[](https://www.nuget.org/packages/Kucoin.Net)|
|
||||
|Mexc|[JKorf/Mexc.Net](https://github.com/JKorf/Mexc.Net)|[](https://www.nuget.org/packages/JK.Mexc.Net)|
|
||||
@@ -50,6 +52,7 @@ When creating an account on new exchanges please consider using a referral link
|
||||
|CoinEx|[https://www.coinex.com/register?refer_code=hd6gn](https://www.coinex.com/register?refer_code=hd6gn)|
|
||||
|Crypto.com|[https://crypto.com/exch/26ge92xbkn](https://crypto.com/exch/26ge92xbkn)|
|
||||
|HTX|[https://www.htx.com/invite/en-us/1f?invite_code=fxp9](https://www.htx.com/invite/en-us/1f?invite_code=fxp9)|
|
||||
|HyperLiquid|[https://app.hyperliquid.xyz/join/JKORF](https://app.hyperliquid.xyz/join/JKORF)|
|
||||
|Kucoin|[https://www.kucoin.com/r/rf/QBS4FPED](https://www.kucoin.com/r/rf/QBS4FPED)|
|
||||
|OKX|[https://okx.com/join/48046699](https://okx.com/join/48046699)|
|
||||
|WhiteBit|[https://whitebit.com/referral/a8e59b59-186c-4662-824c-3095248e0edf](https://whitebit.com/referral/a8e59b59-186c-4662-824c-3095248e0edf)|
|
||||
@@ -66,6 +69,26 @@ Make a one time donation in a crypto currency of your choice. If you prefer to d
|
||||
Alternatively, sponsor me on Github using [Github Sponsors](https://github.com/sponsors/JKorf).
|
||||
|
||||
## Release notes
|
||||
* Version 8.7.4 - 08 Feb 2025
|
||||
* Fixed exception when creating rest client for mono runtime
|
||||
|
||||
* Version 8.7.3 - 05 Feb 2025
|
||||
* Added handling of negative number DateTime deserialization to default
|
||||
* Updated SharedSymbol from class to record
|
||||
* Fixed issue with serialization of nullable types in System.Text.Json ArrayConverter
|
||||
* Fix for unnecessary error message in logging when closing websocket connection
|
||||
|
||||
* Version 8.7.2 - 27 Jan 2025
|
||||
* Some small fixes in the System.Text.Json ArrayConverter
|
||||
* Added support for Flags enum deserialization in System.Text.Json EnumConverter
|
||||
|
||||
* Version 8.7.1 - 24 Jan 2025
|
||||
* Added Authenticated property to IBaseApiClient interface to check if a client was provided API credentials
|
||||
|
||||
* Version 8.7.0 - 21 Jan 2025
|
||||
* Added GetMillisecondTimestampLong helper method to AuthenticationProvider
|
||||
* Added PriceSignificationFigures to SharedSpotSymbol model
|
||||
|
||||
* Version 8.6.1 - 09 Jan 2025
|
||||
* Fixed websocket connection getting stuck after a ping frame timeout
|
||||
* Removed websocket Error callback when exception is expected
|
||||
|
||||
+231
-2
@@ -151,6 +151,7 @@
|
||||
<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>BitMEX</td><td><a href="https://github.com/JKorf/BitMEX.Net">JKorf/BitMEX.Net</a></td><td><a href="https://www.nuget.org/packages/JKorf.BitMEX.Net" target="_blank"><img src="https://img.shields.io/nuget/v/JKorf.BitMEX.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>
|
||||
@@ -158,6 +159,7 @@
|
||||
<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>
|
||||
@@ -197,13 +199,14 @@
|
||||
|
||||
<b>Referral</b>
|
||||
<p>When creating an account on new exchanges please consider using a referral link from below to support development</p>
|
||||
<table>
|
||||
<tr><td>Exchange</td><td>Link</td></tr>
|
||||
<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>
|
||||
@@ -280,6 +283,9 @@
|
||||
<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>
|
||||
@@ -345,6 +351,9 @@
|
||||
<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" />
|
||||
@@ -420,6 +429,9 @@
|
||||
<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>
|
||||
@@ -478,6 +490,9 @@
|
||||
</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>
|
||||
@@ -542,6 +557,9 @@
|
||||
<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>
|
||||
@@ -975,6 +993,39 @@
|
||||
</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>
|
||||
@@ -1237,6 +1288,9 @@
|
||||
<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>
|
||||
@@ -1409,6 +1463,18 @@ if (!tickersResult.Success)
|
||||
// Handle error, tickersResult.Error contains more information
|
||||
}
|
||||
else
|
||||
{
|
||||
// Handle data, tickersResult.Data will contain the actual data
|
||||
}</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="rest-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>
|
||||
@@ -1595,6 +1661,9 @@ else
|
||||
<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>
|
||||
@@ -1745,6 +1814,17 @@ if (!subscribeResult.Success)
|
||||
{
|
||||
// Handle error, subscribeResult.Error contains more information on why the subscription failed
|
||||
}
|
||||
// Subscribing was successfull, the data will now be streamed into the data handler</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="socket-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">
|
||||
@@ -1999,6 +2079,9 @@ var binanceTriggered = CheckForTrigger(lastBinanceTicker);</code></pre>
|
||||
<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>
|
||||
@@ -2152,6 +2235,19 @@ 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
|
||||
@@ -2485,6 +2581,9 @@ options.ApiCredentials = new ApiCredentials("YOUR PUBLIC KEY", "YOUR PRIVATE KEY
|
||||
<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>
|
||||
@@ -2656,6 +2755,18 @@ builder.Services.AddGateIo(builder.Configuration.GetSection("GateIo"));</code></
|
||||
|
||||
// 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(
|
||||
@@ -2775,6 +2886,9 @@ builder.Services.AddXT(builder.Configuration.GetSection("XT"));</code></pre>
|
||||
<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>
|
||||
@@ -2869,6 +2983,12 @@ builder.Services.AddXT(builder.Configuration.GetSection("XT"));</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>
|
||||
@@ -2952,6 +3072,9 @@ builder.Services.AddXT(builder.Configuration.GetSection("XT"));</code></pre>
|
||||
<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>
|
||||
@@ -3055,6 +3178,13 @@ var client = new GateIoRestClient();</code></pre>
|
||||
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 =>
|
||||
@@ -3317,6 +3447,9 @@ var client = new XTRestClient();</code></pre>
|
||||
<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>
|
||||
@@ -3490,6 +3623,19 @@ if (!startResult.Success)
|
||||
}
|
||||
// Book has successfully started and synchronized
|
||||
|
||||
// Once no longer needed you can stop the live sync functionality by calling StopAsync()
|
||||
await book.StopAsync();
|
||||
</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="book-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>
|
||||
@@ -3726,6 +3872,9 @@ foreach (var book in books.Where(b => b.Status == OrderBookStatus.Synced))
|
||||
<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>
|
||||
@@ -3983,6 +4132,26 @@ if (!startResult.Success)
|
||||
// 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>
|
||||
@@ -4441,6 +4610,9 @@ var binanceClient = new BinanceRestClient(new HttpClient(), logFactory, options
|
||||
<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>
|
||||
@@ -4583,6 +4755,20 @@ var binanceClient = new BinanceRestClient(new HttpClient(), logFactory, options
|
||||
<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">
|
||||
@@ -4760,6 +4946,9 @@ var responseSource = result.DataSource;</code></pre>
|
||||
<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>
|
||||
@@ -4823,6 +5012,9 @@ await exchangeRestClient.GetSpotSymbolsAsync(new GetSymbolsRequest(), ["Binance"
|
||||
</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>
|
||||
@@ -4896,6 +5088,9 @@ await exchangeRestClient.GetSpotSymbolsAsync(new GetSymbolsRequest(), ["Binance"
|
||||
<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>
|
||||
@@ -4961,6 +5156,11 @@ await coinbaseClient.AdvancedTradeApi.ExchangeData.GetSymbolAsync("BTC-USDT");</
|
||||
</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>
|
||||
@@ -5036,6 +5236,9 @@ var ticker = tickersResult.Data.Single(x => x.Symbol == "BTC_USDT");</code></pre
|
||||
<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>
|
||||
@@ -5103,6 +5306,9 @@ 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>
|
||||
@@ -5176,6 +5382,9 @@ var result = await htxClient.SpotApi.Account.GetBalancesAsync();</code></pre>
|
||||
<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>
|
||||
@@ -5241,6 +5450,10 @@ 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>
|
||||
@@ -5314,6 +5527,9 @@ var result = await htxClient.SpotApi.Trading.PlaceOrderAsync(account.Id, "BTCUSD
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="example-stream-ticker-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>
|
||||
@@ -5400,6 +5616,11 @@ await exchangeSocketClient.SubscribeToTickerUpdatesAsync(new SubscribeTickerRequ
|
||||
<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">
|
||||
@@ -5494,6 +5715,9 @@ await exchangeSocketClient.SubscribeToTickerUpdatesAsync(new SubscribeTickerRequ
|
||||
<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>
|
||||
@@ -5621,6 +5845,11 @@ _ = Task.Run(async () => {
|
||||
<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">
|
||||
|
||||
Reference in New Issue
Block a user