Skip to content

Commit 79aa9bc

Browse files
vsleejjxtra
authored andcommitted
KuCoin: handle when total # sym is not a multiple of 100 in Trades websocket (#452)
1 parent 850f447 commit 79aa9bc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ExchangeSharp/API/Exchanges/KuCoin/ExchangeKuCoinAPI.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,9 @@ protected override async Task<IWebSocket> OnGetTradesWebSocketAsync(Func<KeyValu
513513
int tunnelInt = 0;
514514
while (marketSymbolsList.Count > 0)
515515
{ // can only subscribe to 100 symbols per session (started w/ API 2.0)
516-
var nextBatch = marketSymbolsList.GetRange(index: 0, count: 100);
517-
marketSymbolsList.RemoveRange(index: 0, count: 100);
516+
var batchSize = marketSymbolsList.Count > 100 ? 100 : marketSymbolsList.Count;
517+
var nextBatch = marketSymbolsList.GetRange(index: 0, count: batchSize);
518+
marketSymbolsList.RemoveRange(index: 0, count: batchSize);
518519
// create a new tunnel
519520
await _socket.SendMessageAsync(new
520521
{

0 commit comments

Comments
 (0)