Skip to content

Commit

Permalink
Added listenkey clients retrieval in to ExchangeRestClient
Browse files Browse the repository at this point in the history
  • Loading branch information
JKorf committed Sep 30, 2024
1 parent 07280e3 commit 57004c6
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
27 changes: 27 additions & 0 deletions CryptoClients.Net/CryptoClients.Net.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions CryptoClients.Net/ExchangeRestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ public class ExchangeRestClient : IExchangeRestClient
/// <inheritdoc />
public IPositionHistoryRestClient? GetPositionHistoryClient(TradingMode api, string exchange) => _sharedClients.OfType<IPositionHistoryRestClient>().SingleOrDefault(s => s.SupportedTradingModes.Contains(api) && s.Exchange == exchange);

/// <inheritdoc />
public IEnumerable<IListenKeyRestClient> GetListenKeyClients() => _sharedClients.OfType<IListenKeyRestClient>();
/// <inheritdoc />
public IEnumerable<IListenKeyRestClient> GetListenKeyClients(TradingMode api) => _sharedClients.OfType<IListenKeyRestClient>().Where(s => s.SupportedTradingModes.Contains(api));
/// <inheritdoc />
public IListenKeyRestClient? GetListenKeyClient(TradingMode api, string exchange) => _sharedClients.OfType<IListenKeyRestClient>().SingleOrDefault(s => s.SupportedTradingModes.Contains(api) && s.Exchange == exchange);

/// <summary>
/// Create a new ExchangeRestClient instance. Client instances will be created with default options.
/// </summary>
Expand Down
16 changes: 16 additions & 0 deletions CryptoClients.Net/Interfaces/IExchangeRestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,22 @@ public interface IExchangeRestClient
/// <param name="exchange">Exchange name</param>
IPositionHistoryRestClient? GetPositionHistoryClient(TradingMode tradingMode, string exchange);

/// <summary>
/// Get the <see cref="IListenKeyRestClient"/> clients for all exchanges
/// </summary>
IEnumerable<IListenKeyRestClient> GetListenKeyClients();
/// <summary>
/// Get all <see cref="IListenKeyRestClient"/> clients for all exchanges which supports the provided trading mode
/// </summary>
/// <param name="tradingMode">The trading mode the client should support</param>
IEnumerable<IListenKeyRestClient> GetListenKeyClients(TradingMode tradingMode);
/// <summary>
/// Get the <see cref="IListenKeyRestClient"/> client for a specific exchange which supports the provided trading mode
/// </summary>
/// <param name="tradingMode">Trading mode</param>
/// <param name="exchange">Exchange name</param>
IListenKeyRestClient? GetListenKeyClient(TradingMode tradingMode, string exchange);

/// <summary>
/// Get spot ticker information for all symbols on all exchanges, async returning in the order the response from the server is received
/// </summary>
Expand Down

0 comments on commit 57004c6

Please sign in to comment.