JKorf/Kraken.Net

KrakenSocketClient, SubscribeToTickerUpdatesAsync doesn't work expected.

khaNuri opened this issue · 2 comments

SubscribeToTickerUpdatesAsync take only one message.
SubscribeToTickerUpdatesAsync send only one data at all and stoped without any exception.

        KrakenSocketClient.SetDefaultOptions(new KrakenSocketClientOptions()
        {
            ApiCredentials = new ApiCredentials("KEY", "SECRET"),
            LogLevel = LogLevel.Debug,
            LogWriters = new List<ILogger> { new ConsoleLogger() }
        });

        var socketClient = new KrakenSocketClient();

        decimal lastBid = 0m;
        decimal lastAsk = 0m;

        socketClient.SubscribeToTickerUpdatesAsync("XRP/USDT", data =>
        {
            bool print = false;
            if (lastBid != data.Data.BestBids.Price)
            {

                lastBid = data.Data.BestBids.Price;
                print = true;
            }
            if (lastAsk != data.Data.BestAsks.Price)
            {
                lastAsk = data.Data.BestAsks.Price;
                print = true;
            }
            if (print)
                Console.WriteLine($"Ask {lastAsk:N4} - Bid {lastBid:N4}");
        });

        Console.ReadLine();
        socketClient.UnsubscribeAllAsync();

image

JKorf commented

This works fine for me in the latest version. You'll probably want to await the sub/unsub calls. If you put LogLevel to Trace you'll have more info on what the socket is receiving

Yes, You are right! The very slow data flow misled me. I tought it must be same as Binance... I closed issue. Thanks.