You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NextPageToken is set to null when the number of klines returned is less than the number requested. It should be set to null when the number returned is 0, because entries for some timestamps are missing on the server.
to reproduce run the following:
using Bybit.Net;
using Bybit.Net.Clients;
using CryptoExchange.Net.SharedApis;
using System.Diagnostics;
SharedSymbol symbol = new(TradingMode.Spot, "BTC", "USDT");
BybitRestClient restClient = new(options => {options.Environment = BybitEnvironment.Testnet;});
var klineClient = restClient.V5Api.SharedClient;
var interval = SharedKlineInterval.OneMinute;
var limit = klineClient.GetKlinesOptions.MaxLimit;
DateTime endTime = new(2022, 9, 9, 17, 14, 0, DateTimeKind.Utc);
GetKlinesRequest request = new(symbol, interval, endTime: endTime, limit: limit);
var res = await klineClient.GetKlinesAsync(request);
Debug.Assert(res.NextPageToken == null);
var data = res.Data.ToArray();
Debug.Assert(data.Length == 995); // less than 1000 entries has been retrieved
Debug.Assert(data[657].OpenTime == new DateTime(2022, 9, 9, 6, 17, 0, DateTimeKind.Utc));
Debug.Assert(data[658].OpenTime == new DateTime(2022, 9, 9, 6, 11, 0, DateTimeKind.Utc)); // 5 entries are missing (12-16 minutes), so Data contains fewer entries
endTime = data[994].OpenTime.AddMinutes(-1);
request = new(symbol, interval, endTime: endTime, limit: limit);
res = await klineClient.GetKlinesAsync(request);
Debug.Assert(res.Data.Count() == 1000); // however there are more records on the server
The text was updated successfully, but these errors were encountered:
Hi, thanks for the clear reproduction scenario. It's a bit weird that there is no data there, but nevertheless I've updated the logic in the latest version to work correctly.
NextPageToken is set to null when the number of klines returned is less than the number requested. It should be set to null when the number returned is 0, because entries for some timestamps are missing on the server.
to reproduce run the following:
The text was updated successfully, but these errors were encountered: