From 9be53d2ca4b2bb19cf32b16374fc0b82db94036f Mon Sep 17 00:00:00 2001 From: Evgeniy Timokhov Date: Wed, 14 Oct 2020 11:31:55 +0300 Subject: [PATCH] Fixed returning data range If we response data since "from" time (with limit 1000 bars), it leads the chart doesn't load skipped data range. Thus, it'd be better to filter out data since "to" date, so chart will be able to load data prior _returned_ "from" date (first returned item). --- request-processor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/request-processor.js b/request-processor.js index d154c79..f60a7f8 100644 --- a/request-processor.js +++ b/request-processor.js @@ -242,7 +242,7 @@ function filterDataPeriod(data, fromSeconds, toSeconds) { s = 'no_data'; } - toIndex = Math.min(fromIndex + 1000, toIndex); // do not send more than 1000 bars for server capacity reasons + fromIndex = Math.max(fromIndex, toIndex - 1000); // do not send more than 1000 bars for server capacity reasons return { t: data.t.slice(fromIndex, toIndex),