Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix liquidation stream response from IEnumerable to single object #169

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);

}
}
Loading