mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2026-02-16 14:13:46 +00:00
Compare commits
No commits in common. "c9d10d51ae8b17b221f381d6076fde20e1898aff" and "a7500750220058528593dd4a66b9dbdffc3a625c" have entirely different histories.
c9d10d51ae
...
a750075022
@ -39,11 +39,6 @@ namespace CryptoExchange.Net.Clients
|
||||
/// </summary>
|
||||
public string Exchange { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether client is disposed
|
||||
/// </summary>
|
||||
public bool Disposed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Api clients in this client
|
||||
/// </summary>
|
||||
@ -130,8 +125,6 @@ namespace CryptoExchange.Net.Clients
|
||||
/// </summary>
|
||||
public virtual void Dispose()
|
||||
{
|
||||
Disposed = true;
|
||||
|
||||
foreach (var client in ApiClients)
|
||||
client.Dispose();
|
||||
}
|
||||
|
||||
@ -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>10.3.1</PackageVersion>
|
||||
<AssemblyVersion>10.3.1</AssemblyVersion>
|
||||
<FileVersion>10.3.1</FileVersion>
|
||||
<PackageVersion>10.3.0</PackageVersion>
|
||||
<AssemblyVersion>10.3.0</AssemblyVersion>
|
||||
<FileVersion>10.3.0</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;CryptoExchange.Net</PackageTags>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
|
||||
@ -32,66 +32,6 @@ namespace CryptoExchange.Net
|
||||
_symbolInfos[topicId] = new ExchangeInfo(DateTime.UtcNow, updateData.ToDictionary(x => x.Name, x => x.SharedSymbol));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the specific topic has been cached
|
||||
/// </summary>
|
||||
/// <param name="topicId">Id</param>
|
||||
public static bool HasCached(string topicId)
|
||||
{
|
||||
if (!_symbolInfos.TryGetValue(topicId, out var exchangeInfo))
|
||||
return false;
|
||||
|
||||
return exchangeInfo.Symbols.Count > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether a specific exchange(topic) support the provided symbol
|
||||
/// </summary>
|
||||
/// <param name="topicId">Id for the provided data</param>
|
||||
/// <param name="symbolName">The symbol name</param>
|
||||
public static bool SupportsSymbol(string topicId, string symbolName)
|
||||
{
|
||||
if (!_symbolInfos.TryGetValue(topicId, out var exchangeInfo))
|
||||
return false;
|
||||
|
||||
if (!exchangeInfo.Symbols.TryGetValue(symbolName, out var symbolInfo))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether a specific exchange(topic) support the provided symbol
|
||||
/// </summary>
|
||||
/// <param name="topicId">Id for the provided data</param>
|
||||
/// <param name="symbol">The symbol info</param>
|
||||
public static bool SupportsSymbol(string topicId, SharedSymbol symbol)
|
||||
{
|
||||
if (!_symbolInfos.TryGetValue(topicId, out var exchangeInfo))
|
||||
return false;
|
||||
|
||||
return exchangeInfo.Symbols.Any(x =>
|
||||
x.Value.TradingMode == symbol.TradingMode
|
||||
&& x.Value.BaseAsset == symbol.BaseAsset
|
||||
&& x.Value.QuoteAsset == symbol.QuoteAsset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all symbols for a specific base asset
|
||||
/// </summary>
|
||||
/// <param name="topicId">Id for the provided data</param>
|
||||
/// <param name="baseAsset">Base asset name</param>
|
||||
public static SharedSymbol[] GetSymbolsForBaseAsset(string topicId, string baseAsset)
|
||||
{
|
||||
if (!_symbolInfos.TryGetValue(topicId, out var exchangeInfo))
|
||||
return [];
|
||||
|
||||
return exchangeInfo.Symbols
|
||||
.Where(x => x.Value.BaseAsset.Equals(baseAsset, StringComparison.InvariantCultureIgnoreCase))
|
||||
.Select(x => x.Value)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse a symbol name to a SharedSymbol
|
||||
/// </summary>
|
||||
|
||||
@ -22,10 +22,5 @@ namespace CryptoExchange.Net.Interfaces.Clients
|
||||
/// The exchange name
|
||||
/// </summary>
|
||||
string Exchange { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether client is disposed
|
||||
/// </summary>
|
||||
bool Disposed { get; }
|
||||
}
|
||||
}
|
||||
@ -35,11 +35,6 @@ namespace CryptoExchange.Net.Interfaces.Clients
|
||||
/// </summary>
|
||||
public int CurrentSubscriptions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether client is disposed
|
||||
/// </summary>
|
||||
bool Disposed { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Unsubscribe from a stream using the subscription id received when starting the subscription
|
||||
/// </summary>
|
||||
|
||||
@ -12,25 +12,6 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// Futures symbol request options
|
||||
/// </summary>
|
||||
EndpointOptions<GetSymbolsRequest> GetFuturesSymbolsOptions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Get all futures symbols for a specific base asset
|
||||
/// </summary>
|
||||
/// <param name="baseAsset">Asset, for example `ETH`</param>
|
||||
Task<ExchangeResult<SharedSymbol[]>> GetFuturesSymbolsForBaseAssetAsync(string baseAsset);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the client supports a futures symbol
|
||||
/// </summary>
|
||||
/// <param name="symbol">The symbol</param>
|
||||
Task<ExchangeResult<bool>> SupportsFuturesSymbolAsync(SharedSymbol symbol);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the client supports a futures symbol
|
||||
/// </summary>
|
||||
/// <param name="symbolName">The symbol name</param>
|
||||
Task<ExchangeResult<bool>> SupportsFuturesSymbolAsync(string symbolName);
|
||||
|
||||
/// <summary>
|
||||
/// Get info on all futures symbols supported on the exchange
|
||||
/// </summary>
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using CryptoExchange.Net.Objects;
|
||||
using System.Threading;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
@ -14,24 +13,6 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// </summary>
|
||||
EndpointOptions<GetSymbolsRequest> GetSpotSymbolsOptions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Get all spot symbols for a specific base asset
|
||||
/// </summary>
|
||||
/// <param name="baseAsset">Asset, for example `ETH`</param>
|
||||
Task<ExchangeResult<SharedSymbol[]>> GetSpotSymbolsForBaseAssetAsync(string baseAsset);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the client supports a spot symbol
|
||||
/// </summary>
|
||||
/// <param name="symbol">The symbol</param>
|
||||
Task<ExchangeResult<bool>> SupportsSpotSymbolAsync(SharedSymbol symbol);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the client supports a spot symbol
|
||||
/// </summary>
|
||||
/// <param name="symbolName">The symbol name</param>
|
||||
Task<ExchangeResult<bool>> SupportsSpotSymbolAsync(string symbolName);
|
||||
|
||||
/// <summary>
|
||||
/// Get info on all available spot symbols on the exchange
|
||||
/// </summary>
|
||||
|
||||
@ -38,17 +38,6 @@ namespace CryptoExchange.Net.SharedApis
|
||||
Exchange = exchange;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public ExchangeResult(
|
||||
string exchange,
|
||||
T result) :
|
||||
base(result, null, null)
|
||||
{
|
||||
Exchange = exchange;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString() => $"{Exchange} - " + base.ToString();
|
||||
}
|
||||
|
||||
@ -55,11 +55,6 @@ namespace CryptoExchange.Net.Trackers.Klines
|
||||
/// </summary>
|
||||
SharedKline? Last { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The kline interval
|
||||
/// </summary>
|
||||
public SharedKlineInterval Interval { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Event for when a new kline is added
|
||||
/// </summary>
|
||||
|
||||
@ -45,6 +45,10 @@ namespace CryptoExchange.Net.Trackers.Klines
|
||||
/// </summary>
|
||||
protected bool _changed = false;
|
||||
/// <summary>
|
||||
/// The kline interval
|
||||
/// </summary>
|
||||
protected readonly SharedKlineInterval _interval;
|
||||
/// <summary>
|
||||
/// Whether the snapshot has been set
|
||||
/// </summary>
|
||||
protected bool _snapshotSet;
|
||||
@ -62,10 +66,6 @@ namespace CryptoExchange.Net.Trackers.Klines
|
||||
/// </summary>
|
||||
protected DateTime? _firstTimestamp;
|
||||
|
||||
/// <summary>
|
||||
/// The kline interval
|
||||
/// </summary>
|
||||
public SharedKlineInterval Interval { get; }
|
||||
/// <inheritdoc/>
|
||||
public SyncStatus Status
|
||||
{
|
||||
@ -165,7 +165,7 @@ namespace CryptoExchange.Net.Trackers.Klines
|
||||
Exchange = restClient.Exchange;
|
||||
Limit = limit;
|
||||
Period = period;
|
||||
Interval = interval;
|
||||
_interval = interval;
|
||||
_socketClient = socketClient;
|
||||
_restClient = restClient;
|
||||
}
|
||||
@ -180,7 +180,7 @@ namespace CryptoExchange.Net.Trackers.Klines
|
||||
Status = SyncStatus.Syncing;
|
||||
_logger.KlineTrackerStarting(SymbolName);
|
||||
|
||||
var subResult = await _socketClient.SubscribeToKlineUpdatesAsync(new SubscribeKlineRequest(Symbol, Interval),
|
||||
var subResult = await _socketClient.SubscribeToKlineUpdatesAsync(new SubscribeKlineRequest(Symbol, _interval),
|
||||
update =>
|
||||
{
|
||||
AddOrUpdate(update.Data);
|
||||
@ -237,7 +237,7 @@ namespace CryptoExchange.Net.Trackers.Klines
|
||||
|
||||
var limit = Math.Min(_restClient.GetKlinesOptions.MaxLimit, Limit ?? 100);
|
||||
|
||||
var request = new GetKlinesRequest(Symbol, Interval, startTime, DateTime.UtcNow, limit: limit);
|
||||
var request = new GetKlinesRequest(Symbol, _interval, startTime, DateTime.UtcNow, limit: limit);
|
||||
var data = new List<SharedKline>();
|
||||
await foreach (var result in ExchangeHelpers.ExecutePages(_restClient.GetKlinesAsync, request).ConfigureAwait(false))
|
||||
{
|
||||
|
||||
@ -67,9 +67,6 @@ 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 10.3.1 - 27 Jan 2026
|
||||
* Fixed potential collection modified exception upon logging message not handled in websocket message handling
|
||||
|
||||
* Version 10.3.0 - 22 Jan 2026
|
||||
* Added PlatformInfo class for specifying platform metadata
|
||||
* Added better handling for enabling AutoTimestamp in client options when not implemented in the API
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user