Skip to content

Commit

Permalink
Fix liquidation stream response from IEnumerable to single object (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bradtus authored Sep 26, 2023
1 parent e449871 commit 2d72841
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions ByBit.Net/Clients/V5/BybitSocketClientBaseApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,19 @@ public async Task<CallResult<UpdateSubscription>> SubscribeToKlineUpdatesAsync(I
}

/// <inheritdoc />
public Task<CallResult<UpdateSubscription>> SubscribeToLiquidationUpdatesAsync(string symbol, Action<DataEvent<IEnumerable<BybitLiquidation>>> handler, CancellationToken ct = default)
public Task<CallResult<UpdateSubscription>> SubscribeToLiquidationUpdatesAsync(string symbol, Action<DataEvent<BybitLiquidation>> handler, CancellationToken ct = default)
=> SubscribeToLiquidationUpdatesAsync(new string[] { symbol }, handler, ct);

/// <inheritdoc />
public async Task<CallResult<UpdateSubscription>> SubscribeToLiquidationUpdatesAsync(IEnumerable<string> symbols, Action<DataEvent<IEnumerable<BybitLiquidation>>> handler, CancellationToken ct = default)
public async Task<CallResult<UpdateSubscription>> SubscribeToLiquidationUpdatesAsync(IEnumerable<string> symbols, Action<DataEvent<BybitLiquidation>> handler, CancellationToken ct = default)
{
var internalHandler = new Action<DataEvent<JToken>>(data =>
{
var internalData = data.Data["data"];
if (internalData == null)
return;
var desResult = Deserialize<IEnumerable<BybitLiquidation>>(internalData);
var desResult = Deserialize<BybitLiquidation>(internalData);
if (!desResult)
{
_logger.Log(LogLevel.Warning, $"Failed to deserialize {nameof(BybitLiquidation)} object: " + desResult.Error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public interface IBybitSocketClientLinearApi : IBybitSocketClientBaseApi
/// <param name="handler">Data handler</param>
/// <param name="ct">Cancellation token. Cancelling will cancel the subscription</param>
/// <returns></returns>
Task<CallResult<UpdateSubscription>> SubscribeToLiquidationUpdatesAsync(IEnumerable<string> symbols, Action<DataEvent<IEnumerable<BybitLiquidation>>> handler, CancellationToken ct = default);
Task<CallResult<UpdateSubscription>> SubscribeToLiquidationUpdatesAsync(IEnumerable<string> symbols, Action<DataEvent<BybitLiquidation>> handler, CancellationToken ct = default);

/// <summary>
/// Subscribe to liquidation updates
Expand All @@ -51,7 +51,7 @@ public interface IBybitSocketClientLinearApi : IBybitSocketClientBaseApi
/// <param name="handler">Data handler</param>
/// <param name="ct">Cancellation token. Cancelling will cancel the subscription</param>
/// <returns></returns>
Task<CallResult<UpdateSubscription>> SubscribeToLiquidationUpdatesAsync(string symbol, Action<DataEvent<IEnumerable<BybitLiquidation>>> handler, CancellationToken ct = default);
Task<CallResult<UpdateSubscription>> SubscribeToLiquidationUpdatesAsync(string symbol, Action<DataEvent<BybitLiquidation>> handler, CancellationToken ct = default);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public interface IBybitSocketClientOptionApi : IBybitSocketClientBaseApi
/// <param name="handler">Data handler</param>
/// <param name="ct">Cancellation token. Cancelling will cancel the subscription</param>
/// <returns></returns>
Task<CallResult<UpdateSubscription>> SubscribeToLiquidationUpdatesAsync(IEnumerable<string> symbols, Action<DataEvent<IEnumerable<BybitLiquidation>>> handler, CancellationToken ct = default);
Task<CallResult<UpdateSubscription>> SubscribeToLiquidationUpdatesAsync(IEnumerable<string> symbols, Action<DataEvent<BybitLiquidation>> handler, CancellationToken ct = default);

/// <summary>
/// Subscribe to liquidation updates
Expand All @@ -51,7 +51,7 @@ public interface IBybitSocketClientOptionApi : IBybitSocketClientBaseApi
/// <param name="handler">Data handler</param>
/// <param name="ct">Cancellation token. Cancelling will cancel the subscription</param>
/// <returns></returns>
Task<CallResult<UpdateSubscription>> SubscribeToLiquidationUpdatesAsync(string symbol, Action<DataEvent<IEnumerable<BybitLiquidation>>> handler, CancellationToken ct = default);
Task<CallResult<UpdateSubscription>> SubscribeToLiquidationUpdatesAsync(string symbol, Action<DataEvent<BybitLiquidation>> handler, CancellationToken ct = default);

}
}

0 comments on commit 2d72841

Please sign in to comment.