diff --git a/src/ExchangeSharp/API/Exchanges/_Base/ExchangeAPI.cs b/src/ExchangeSharp/API/Exchanges/_Base/ExchangeAPI.cs index 2a323d8f..dcc2158e 100644 --- a/src/ExchangeSharp/API/Exchanges/_Base/ExchangeAPI.cs +++ b/src/ExchangeSharp/API/Exchanges/_Base/ExchangeAPI.cs @@ -178,6 +178,8 @@ protected virtual Task OnGetOpenPositionAsync(stri throw new NotImplementedException(); protected virtual Task OnCloseMarginPositionAsync(string marketSymbol) => throw new NotImplementedException(); + protected virtual Task OnGetCandlesWebSocketAsync(Func, Task> callbackAsync, params string[] marketSymbols) => + throw new NotImplementedException(); protected virtual Task OnGetTickersWebSocketAsync(Action>> tickers, params string[] marketSymbols) => throw new NotImplementedException(); protected virtual Task OnGetTradesWebSocketAsync(Func, Task> callback, params string[] marketSymbols) => @@ -997,6 +999,17 @@ public virtual async Task CloseMarginPosition #endregion REST API #region Web Socket API + /// + /// Gets Candles (OHLC) websocket + /// + /// Callback + /// Market Symbols + /// Web socket, call Dispose to close + public virtual Task GetCandlesWebSocketAsync(Func, Task> callbackAsync, params string[] marketSymbols) + { + callbackAsync.ThrowIfNull(nameof(callbackAsync), "Callback must not be null"); + return OnGetCandlesWebSocketAsync(callbackAsync, marketSymbols); + } /// /// Get all tickers via web socket diff --git a/src/ExchangeSharp/API/Exchanges/_Base/IExchangeAPI.cs b/src/ExchangeSharp/API/Exchanges/_Base/IExchangeAPI.cs index 24eda096..e264ad5c 100644 --- a/src/ExchangeSharp/API/Exchanges/_Base/IExchangeAPI.cs +++ b/src/ExchangeSharp/API/Exchanges/_Base/IExchangeAPI.cs @@ -237,6 +237,13 @@ public interface IExchangeAPI : IDisposable, IBaseAPI, IOrderBookProvider #endregion REST #region Web Socket + /// + /// Gets Candles (OHLC) websocket + /// + /// Callback + /// Market Symbols + /// Web socket, call Dispose to close + Task GetCandlesWebSocketAsync(Func, Task> callbackAsync, params string[] marketSymbols); /// /// Get all tickers via web socket @@ -254,6 +261,8 @@ public interface IExchangeAPI : IDisposable, IBaseAPI, IOrderBookProvider /// Web socket, call Dispose to close Task GetTradesWebSocketAsync(Func, Task> callback, params string[] marketSymbols); + // Task GetDeltaOrderBookWebSocketAsync is in IOrderBookProvider + /// /// Get the details of all changed orders via web socket /// @@ -268,6 +277,7 @@ public interface IExchangeAPI : IDisposable, IBaseAPI, IOrderBookProvider /// Web socket, call Dispose to close Task GetCompletedOrderDetailsWebSocketAsync(Action callback); + Task GetUserDataWebSocketAsync(Action callback, string listenKey); #endregion Web Socket } }