From 2f616e2c3520d1a5d98e379b2d8dfc0f5437a625 Mon Sep 17 00:00:00 2001 From: Simon Roberts Date: Mon, 27 Sep 2021 20:04:17 +1000 Subject: [PATCH] When we are not aggregating multiple prices, use the oldest data available as the left hand side of chart, not the requested start. --- cointop/chart.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cointop/chart.go b/cointop/chart.go index df44409..223fc6b 100644 --- a/cointop/chart.go +++ b/cointop/chart.go @@ -174,9 +174,9 @@ func (ct *Cointop) ChartPoints(symbol string, name string) error { // Resample cachedata timeQuantum := timedata.CalculateTimeQuantum(cacheData) - newStart := time.Unix(start, 0).Add(timeQuantum) + newStart := cacheData[0][0] // use the first data point newEnd := time.Unix(end, 0).Add(-timeQuantum) - timeData := timedata.ResampleTimeSeriesData(cacheData, float64(newStart.UnixMilli()), float64(newEnd.UnixMilli()), chart.GetChartDataSize(maxX)) + timeData := timedata.ResampleTimeSeriesData(cacheData, newStart, float64(newEnd.UnixMilli()), chart.GetChartDataSize(maxX)) labels := timedata.BuildTimeSeriesLabels(timeData) // Extract just the values from the data