From 4d921b0b367d33493213c5a9b0282a98e59012b4 Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 19 Jan 2022 18:33:54 +0800 Subject: [PATCH] kucoin: fix klines ordering --- pkg/exchange/kucoin/exchange.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/exchange/kucoin/exchange.go b/pkg/exchange/kucoin/exchange.go index 1aa56de75..ee347d24a 100644 --- a/pkg/exchange/kucoin/exchange.go +++ b/pkg/exchange/kucoin/exchange.go @@ -3,6 +3,7 @@ package kucoin import ( "context" "fmt" + "sort" "strconv" "time" @@ -193,6 +194,10 @@ func (e *Exchange) QueryKLines(ctx context.Context, symbol string, interval type }) } + sort.Slice(klines, func(i, j int) bool { + return klines[i].StartTime.Before(klines[j].StartTime.Time()) + }) + return klines, nil }