Skip to content

Commit

Permalink
Added check for snapshot data in shared spot trades stream
Browse files Browse the repository at this point in the history
  • Loading branch information
JKorf committed Oct 9, 2024
1 parent 661e86a commit b05e06e
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ async Task<ExchangeResult<UpdateSubscription>> ITradeSocketClient.SubscribeToTra
return new ExchangeResult<UpdateSubscription>(Exchange, validationError);

var symbol = request.Symbol.GetSymbol(FormatSymbol);
var result = await SubscribeToTradeUpdatesAsync(symbol, update => handler(update.AsExchangeEvent<IEnumerable<SharedTrade>>(Exchange, update.Data.Select(x => new SharedTrade(x.Quantity, x.Price, x.Timestamp)).ToArray())), ct).ConfigureAwait(false);
var result = await SubscribeToTradeUpdatesAsync(symbol, update =>
{
if (update.UpdateType == SocketUpdateType.Snapshot)
return;

handler(update.AsExchangeEvent<IEnumerable<SharedTrade>>(Exchange, update.Data.Select(x => new SharedTrade(x.Quantity, x.Price, x.Timestamp)).ToArray()));
}, ct).ConfigureAwait(false);

return new ExchangeResult<UpdateSubscription>(Exchange, result);
}
Expand Down

0 comments on commit b05e06e

Please sign in to comment.