Skip to content

Commit e380e8e

Browse files
committed
changed GetCandlesWebSocketAsync() to allow for async callback
1 parent 7063138 commit e380e8e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/ExchangeSharp/API/Exchanges/_Base/ExchangeAPI.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ protected virtual Task<ExchangeMarginPositionResult> OnGetOpenPositionAsync(stri
178178
throw new NotImplementedException();
179179
protected virtual Task<ExchangeCloseMarginPositionResult> OnCloseMarginPositionAsync(string marketSymbol) =>
180180
throw new NotImplementedException();
181-
protected virtual Task<IWebSocket> OnGetCandlesWebSocketAsync(Action<IReadOnlyCollection<MarketCandle>> callback, params string[] marketSymbols) =>
181+
protected virtual Task<IWebSocket> OnGetCandlesWebSocketAsync(Func<IReadOnlyCollection<MarketCandle>, Task> callbackAsync, params string[] marketSymbols) =>
182182
throw new NotImplementedException();
183183
protected virtual Task<IWebSocket> OnGetTickersWebSocketAsync(Action<IReadOnlyCollection<KeyValuePair<string, ExchangeTicker>>> tickers, params string[] marketSymbols) =>
184184
throw new NotImplementedException();
@@ -1002,13 +1002,13 @@ public virtual async Task<ExchangeCloseMarginPositionResult> CloseMarginPosition
10021002
/// <summary>
10031003
/// Gets Candles (OHLC) websocket
10041004
/// </summary>
1005-
/// <param name="callback">Callback</param>
1005+
/// <param name="callbackAsync">Callback</param>
10061006
/// <param name="marketSymbols">Market Symbols</param>
10071007
/// <returns>Web socket, call Dispose to close</returns>
1008-
protected virtual Task<IWebSocket> GetCandlesWebSocketAsync(Action<IReadOnlyCollection<MarketCandle>> callback, params string[] marketSymbols)
1008+
public virtual Task<IWebSocket> GetCandlesWebSocketAsync(Func<IReadOnlyCollection<MarketCandle>, Task> callbackAsync, params string[] marketSymbols)
10091009
{
1010-
callback.ThrowIfNull(nameof(callback), "Callback must not be null");
1011-
return OnGetCandlesWebSocketAsync(callback, marketSymbols);
1010+
callbackAsync.ThrowIfNull(nameof(callbackAsync), "Callback must not be null");
1011+
return OnGetCandlesWebSocketAsync(callbackAsync, marketSymbols);
10121012
}
10131013

10141014
/// <summary>

src/ExchangeSharp/API/Exchanges/_Base/IExchangeAPI.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,10 @@ public interface IExchangeAPI : IDisposable, IBaseAPI, IOrderBookProvider
240240
/// <summary>
241241
/// Gets Candles (OHLC) websocket
242242
/// </summary>
243-
/// <param name="callback">Callback</param>
243+
/// <param name="callbackAsync">Callback</param>
244244
/// <param name="marketSymbols">Market Symbols</param>
245245
/// <returns>Web socket, call Dispose to close</returns>
246-
Task<IWebSocket> GetCandlesWebSocketAsync(Action<IReadOnlyCollection<MarketCandle>> callback, params string[] marketSymbols);
246+
Task<IWebSocket> GetCandlesWebSocketAsync(Func<IReadOnlyCollection<MarketCandle>, Task> callbackAsync, params string[] marketSymbols);
247247

248248
/// <summary>
249249
/// Get all tickers via web socket

0 commit comments

Comments
 (0)